MichaIng / DietPi

Lightweight justice for your single-board computer!
https://dietpi.com/
GNU General Public License v2.0
4.81k stars 494 forks source link

DietPi-PreBoot | Move CPU governor adjustment into dedicated systemd unit #2913

Open FredericGuilbault opened 5 years ago

FredericGuilbault commented 5 years ago

From https://github.com/MichaIng/DietPi/pull/2833#issuecomment-494604437

Largest impact is of course the two child scripts (CPU governor + LED settings) that are executed in subshell and load dietpi-globals in case. Actually it should be at least possible to skip led settings, an additional setting to revert to system defaults, which removes the settings file and then scripts the execution. Actually we could move this as well as the CPU governor adjustment into an own systemd unit each. It does not really matter when they run, just after DietPi-RAMdisk. So they can be Type=simple to not delay any other boot scripts. This also makes it again simpler to revert to system defaults => disable the related systemd unit. Once applied settings (settings file) can be preserved then while toggling the service.

Just to keep it on the list.

FredericGuilbault commented 5 years ago

After this it will be possible to remove DietPi-PreBoot.service and it's script /DietPi/dietpi/preboot

MichaIng commented 5 years ago

@FredericGuilbault Jep thanks, good idea. I am not yet 100% sure about it, have 1-2 other things that might fit into the preboot script. But at least CPU and LED script should only be called, if settings have been actually chosen and it should be possible to revert settings to system defaults.