Editing dietpi-globals

Hi, everyone.
I just install dietpi on my Roseapple Pi.
The roseapple pi is a SBC like raspberry pi and I received long time ago, and now the developer of roseapple pi is discontinued. So I install dietpi on it using PREP_SYSTEM_FOR_DIETPI.sh script. And found that CPU temp on SSH banner shows 0*C all the time.
After I search for many hours, I found that roseapple CPU temp is on /sys/class/thermal/thermal_zone1/temp but dietpi read /sys/class/thermal/thermal_zone0/temp. So I edit dietpi-globals to read cpu temp from /sys/class/thermal/thermal_zone1/temp instead and that’s work!
I have a question that in future if dietpi has update. Will dietpi-globals overwritten and my script will gone ?


yes usually all DietPi scripts will be overwritten running dietpi-update

Thank you for the answer. Do you have any suggestion to keep SSH banner shows actual cpu temp?

Thank you.

not really, except it will be added to the script directly.

something to add to our script?

Does /sys/class/thermal/thermal_zone0/temp even exist and in case does it contain 0 or something else? If it does contain an integer, it’s difficult to get that fixed for Roseapple Pi without breaking it for other SBCs, since we have no dedicated hardware ID for Roseapple Pi. But if the other kernel tunables do not contain valid integers, we could add /sys/class/thermal/thermal_zone1/temp to the end of the list, so that it is only parsed if previous tunables are not present or contain garbage.

Yes, /sys/class/thermal/thermal_zone0/temp contain 0.
Are there any method to change thermal_zone1/ into thermal_zone0?

There is at least no generic way to rename kernel tunables. Probably we could treat all non-positive values as invalid. I mean theoretically it’s possible to use liquid nitrogen cooling and such to run a CPU at negative degree Celsius, but I doubt that any of our users practically does this. This also solves an issue for some OrangePi’s where currently temperatures like “-25435” are shown, whatever the meaning/purpose of this is kernel-wise.

That’s a great solution. I think this could solve the same problem on many SBCs. Will you implement this solution in the further update?

Just added: https://github.com/MichaIng/DietPi/commit/a1ecafb70f5d6aa207d785caaeeeb06f352d4ca7
Changelog: https://github.com/MichaIng/DietPi/commit/6a6262432215c81d1112b903c22985abd98ade57

Thank you very much.