### Slackware Installer script ###########################################################
# Script......: /usr/share/hwm-configure/platform/aarch64/installer/helper.scr/010-pwrmgmt
# Called from : /usr/lib/setup/armedslack-postinstall-scripts/001-hwm-os-configure
# Purpose.....: Power management configuration helper for all Hardware Models
# Author......: Stuart Winter <mozes@slackware.com>
# Date........: 26-Feb-2024
# Contributors: Brenton Earl
### Slackware Installer script ###########################################################

# Hardware Model settings:
#case $HWM in
#   "Pine64 RockPro64"*|"Pine64 Pinebook Pro"*)
#esac

# Feb-2024
# We had planned to restrict this to specific Hardware Models, but power management
# just doesn't seem to work well for us on ARM at the moment, so we'll disable it
# across the board.
eloginsleepconf=${T_PX}/etc/elogind/sleep.conf
if [ -f ${eloginsleepconf} ]; then
   # Hard set to "no"
   sed -i 's?^#AllowSuspend=yes?AllowSuspend=no?g' ${eloginsleepconf}
   sed -i 's?^#AllowHibernation=yes?AllowHibernation=no?g' ${eloginsleepconf}
   sed -i 's?^#AllowSuspendThenHibernate=yes?AllowSuspendThenHibernate=no?g' ${eloginsleepconf}
   sed -i 's?^#AllowHybridSleep=yes?AllowHybridSleep=no?g' ${eloginsleepconf}
   #sed -i 's?^#SuspendState=mem standby freeze?SuspendState=mem standby freeze?g' ${eloginsleepconf}
   #sed -i 's?^#SuspendMode=.*?SuspendMode=s2idle?g' ${eloginsleepconf}
fi
