Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

DietPi-Banner | Error if "CPU temp" and "MOTD" are not selected #3313

Closed
Joulinar opened this issue Jan 3, 2020 · 4 comments
Closed

DietPi-Banner | Error if "CPU temp" and "MOTD" are not selected #3313

Joulinar opened this issue Jan 3, 2020 · 4 comments
Labels
Bug 🐞 Solution available 🥂 Definite solution has been done
Milestone

Comments

@Joulinar
Copy link
Collaborator

Joulinar commented Jan 3, 2020

Hi,

I'm getting following error message as soon as CPU temp and MOTD are not selected within dietpi-banner

/DietPi/dietpi/func/dietpi-banner: line 191: G_TERM_CLEAR: command not found

It seems the issue was introduced with v6.27.2 as I can reproduce it on my VM as well as on the RPi4B running v6.28 but it's not visible on my RPi3B+ running v6.26.3

RPi4B

login as: root
[email protected]'s password:
/DietPi/dietpi/func/dietpi-banner: Zeile 191: G_TERM_CLEAR: command not found
 ─────────────────────────────────────────────────────
 DietPi v6.28.0 : 23:45 - Fr 03.01.2020
 ─────────────────────────────────────────────────────
 - Device model : RPi 4 Model B (armv7l)
 - Uptime : up 3 hours, 3 minutes
 - LAN IP : 192.168.0.12 (eth0)
 - Info Text : !!! NEW RPi4 System !!!
 ─────────────────────────────────────────────────────

RPi3B+

login as: root
[email protected]'s password:

The programs included with the Debian GNU/Linux system are free software;
the exact distribution terms for each program are described in the
individual files in /usr/share/doc/*/copyright.

Debian GNU/Linux comes with ABSOLUTELY NO WARRANTY, to the extent
permitted by applicable law.
 ─────────────────────────────────────────────────────
 DietPi v6.26.3 : Update available
 ─────────────────────────────────────────────────────
 - Device model : RPi 3 Model B+ (armv7l)
 - Uptime : up 10 hours, 49 minutes
 - LAN IP : 192.168.0.11 (eth0)
 - Info Text : !!! PRODUCTION SYSTEM !!!
 ─────────────────────────────────────────────────────

As soon as CPU temp or MOTD are selected, the issue is gone

login as: root
[email protected]'s password:
 ─────────────────────────────────────────────────────
 DietPi v6.28.0 : 23:53 - Fr 03.01.2020
 ─────────────────────────────────────────────────────
 - Device model : RPi 4 Model B (armv7l)
 - Uptime : up 3 hours, 11 minutes
 - CPU temp : 40'C : 104'F (Optimal temperature)
 - LAN IP : 192.168.0.12 (eth0)
 - Info Text : !!! NEW RPi4 System !!!
 ─────────────────────────────────────────────────────

Looks like you only calling dietpi-globals if one of these 2 options is selected.
[[ ${aENABLED[2]} != 1 && ${aENABLED[12]} != 1 || $G_PROGRAM_NAME ]] || . /DietPi/dietpi/func/dietpi-globals

@MichaIng
Copy link
Owner

MichaIng commented Jan 3, 2020

@Joulinar
Many thanks for your report, indeed a bug.

Hmm, that new function assures that previous command outputs are preserved in scrollback buffer since the previous print '\ec' purges current screen content on most terminal types. Not yet sure how to handle best. Simplest would be to load DietPi-Globals always, but since it is a bid heavy, I'd like to avoid it if not required 🤔.

@MichaIng MichaIng added this to the v6.29 milestone Jan 3, 2020
@Joulinar
Copy link
Collaborator Author

Joulinar commented Jan 3, 2020

I just came across by accident because usually I deselect MOTD and on my VM's I don't have any CPU information. I guess majority of people will have CPU or MOTD selected because usually you will have some CPU information from physical devices. Therefore dietpi-globals will be called at this point anyway. Now it would be good to have some statistics which options are used the most, to be able to decide how to deal with it 😆

however for me it's working if I switch to this
[[ $G_PROGRAM_NAME ]] || . /DietPi/dietpi/func/dietpi-globals

@MichaIng
Copy link
Owner

MichaIng commented Jan 4, 2020

@Joulinar
Yeah that means globals are always leaded. Okay I'll add it the way that this is done which simplifies the code as well. For next release I plan do increase globals load performance anyway by making all scripts source-able, hence no mawk/grep/sed required to read settings from our own files.

MichaIng added a commit that referenced this issue Jan 4, 2020
+ DietPi-Banner | Always load DietPi-Globals: #3313
+ DietPi-Banner | Run G_INIT only on menu calls to allow concurrent banner prints but a single menu call only
+ DietPi-Banner | Menu calls require root permissions to write to settings files
+ DietPi-Banner | Only re-obtain network details if resulting file does not exist instead of if it exist
@MichaIng
Copy link
Owner

MichaIng commented Jan 4, 2020

Resolved for v6.29 with: c77812d
Changelog: 8d6cbab
Hacked in a fix via MOTD for live systems:
cat /var/www/motd

[[ $G_DIETPI_VERSION_SUB == 2[78] && -w '/DietPi/dietpi/func/dietpi-banner' ]] && sed -i '/G_TERM_CLEAR$/s/$/ 2> \/dev\/null || printf "\\ec"/' /DietPi/dietpi/func/dietpi-banner
motd='★☆ ✿¸.•*¨★*☆*★`*•..¸✿ ☆¯`★
          ★[̲̅̅H̲̅][̲̅̅A̲̅][̲̅̅P̲̅][̲̅̅P̲̅][̲̅̅Y̲̅]★[̲̅̅N̲̅][̲̅̅E̲̅][̲̅̅W̲̅]★[̲̅̅Y̲̅][̲̅̅E̲̅][̲̅̅A̲̅][̲̅̅R̲̅]★
          *”˜˜”*°•.♥ღϠ₡ღ♥♥ღϠ₡ღ♥♥ღϠ₡ღ*”˜”*'
  • Easy safe one which does least changes/overhead, only suppressing the error and calls the old screen clear method in case.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
Bug 🐞 Solution available 🥂 Definite solution has been done
Projects
None yet
Development

No branches or pull requests

2 participants