41 lines
1.1 KiB
Cheetah
Executable File
41 lines
1.1 KiB
Cheetah
Executable File
#!/bin/bash
|
|
# run_once_60-configure-laptop.sh
|
|
# Laptop only configuration.
|
|
|
|
set -euo pipefail
|
|
|
|
warn() { echo ">>> [configure-laptop] WARNING: $*" >&2; }
|
|
|
|
SYS="{{ .system | default "desktop" }}"
|
|
DISTRO_ID="{{ .chezmoi.osRelease.id | default "" }}"
|
|
|
|
if [ "$SYS" != "laptop" ]; then
|
|
echo ">>> [configure-laptop] system=$SYS, skipping (not a laptop)"
|
|
exit 0
|
|
fi
|
|
|
|
case "$DISTRO_ID" in
|
|
arch)
|
|
echo ">>> [configure-laptop] arch"
|
|
sudo pacman -Syu --noconfirm --needed tlp power-profiles-daemon
|
|
sudo systemctl enable tlp
|
|
sudo systemctl enable power-profiles-daemon
|
|
;;
|
|
|
|
ubuntu)
|
|
echo ">>> [configure-laptop] ubuntu"
|
|
|
|
sudo apt-get install -y tlp tlp-rdw power-profiles-daemon
|
|
sudo systemctl enable tlp
|
|
# tlp and power-profiles-daemon conflict on most hardware — mask the latter
|
|
sudo systemctl mask power-profiles-daemon || warn "systemctl mask power-profiles-daemon failed (tlp conflict may cause issues)"
|
|
;;
|
|
|
|
*)
|
|
echo ">>> [configure-laptop] unsupported distro: ${DISTRO_ID:-unknown}, skipping"
|
|
exit 0
|
|
;;
|
|
esac
|
|
|
|
echo ">>> [configure-laptop] done"
|