From: Plom Heller Date: Wed, 2 Sep 2026 16:56:16 +0000 (+0200) Subject: Add TLP battery management. X-Git-Url: https://plomlompom.com/repos/%22https:/validator.w3.org/te%22st.html?a=commitdiff_plain;h=d62493460f01bcff4cb232a3c260940966b5fe61;p=confplom Add TLP battery management. --- diff --git a/start_root.sh b/start_root.sh index 1901de0..6ed54bb 100755 --- a/start_root.sh +++ b/start_root.sh @@ -5,11 +5,14 @@ cd "$(dirname "$0")" || exit # constants unlikely to change FNAME_START_HOME=start_home.sh PATH_SYSCTL_PRINTK=/etc/sysctl.d/60-printk-console.conf +PATH_TLP_THRESH_CONF=/etc/tlp.conf.d/60-thresholds.conf # constants we might want to change at some point -TO_INSTALL="man-db ntpsec-ntpdate sudo vim" +TO_INSTALL="man-db ntpsec-ntpdate sudo tlp vim" USERNAME=plom PRINTK_LEVELS="4 4 1 7" +TLP_THRESH_START=40 +TLP_THRESH_STOP=80 msg 'Calling %s …' "${FNAME_START_HOME}" "./${FNAME_START_HOME}" @@ -22,6 +25,13 @@ msg 'Quieting routine kernel messages on the console …' printf 'kernel.printk = %s\n' "${PRINTK_LEVELS}" >| "${PATH_SYSCTL_PRINTK}" sysctl -p "${PATH_SYSCTL_PRINTK}" +msg 'Setting TLP battery charge thresholds: start %s%%, stop %s%% …' \ + "${TLP_THRESH_START}" "${TLP_THRESH_STOP}" +mkdir -p "$(dirname "${PATH_TLP_THRESH_CONF}")" +printf 'START_CHARGE_THRESH_BAT0=%s\nSTOP_CHARGE_THRESH_BAT0=%s\n' \ + "${TLP_THRESH_START}" "${TLP_THRESH_STOP}" >| "${PATH_TLP_THRESH_CONF}" +tlp start + msg 'Setting up user: %s' "${USERNAME}" adduser --comment "" "${USERNAME}" usermod -a -G sudo "${USERNAME}"