[install][tests] Add sleep service

to disable wireless devices to improve battery life.

Resolves 
This commit is contained in:
Luke Short 2025-05-18 19:15:37 -06:00
commit 040c4cf6aa
5 changed files with 17 additions and 0 deletions

View file

@ -12,6 +12,7 @@
- Add dual-boot support with Fedora.
- Add support for the Framework Desktop.
- Add support for the MSI Claw A1M, 7 AI+ A2VM, and 8 AI+ A2VM.
- Add service to disable wireless connections during sleep.
## 4.3.0 - The Wayland Update

View file

@ -158,6 +158,7 @@ These are custom files and scripts that are installed as part of winesapOS. Unle
- `/usr/lib/sysctl.d/50-winesapos-open-files.conf` = Configures an increased open files and memory mapping limit.
- Source: `scripts/winesapos-install.sh`
- `/usr/lib/systemd/system/pacman-mirrors.service` = On Manjaro builds, this provides a service to find and configure the fastest mirrors for Pacman. This is not needed on Arch Linux builds as it has a Reflector service that comes with a service file.
- `/usr/lib/systemd/system/sleep-rfkill.service` = Disable Bluetooth and Wi-Fi before sleep and re-active it afterwards to lower battery drain.
- `/usr/lib/systemd/system/winesapos-resize-root-file-system.service` = A service that runs a script to resize the root file system upon first boot.
- `/usr/lib/systemd/system/winesapos-sddm-health-check.service` = Run the SDDM health check script for the first 5 minutes.
- `/usr/lib/systemd/user/winesapos-mute.service` = A user (not system) service for muting all audio. This is required for some newer Macs that have in-development hardware drivers that are extremely loud by default.

View file

@ -0,0 +1,11 @@
[Unit]
Before=sleep.target
Description=Disable Bluetooth and Wi-Fi before sleep and re-active it afterwards to lower battery drain
[Service]
ExecStart=/usr/bin/rfkill block all
ExecStop=/usr/bin/rfkill unblock all
Type=oneshot
[Install]
WantedBy=sleep.target

View file

@ -1316,6 +1316,9 @@ cp ../rootfs/usr/lib/os-release-winesapos "${WINESAPOS_INSTALL_DIR}"/usr/lib/
# shellcheck disable=SC2140
echo -e "VARIANT=\"${WINESAPOS_IMAGE_TYPE}"\"\\nVARIANT_ID="${WINESAPOS_IMAGE_TYPE}" | tee -a "${WINESAPOS_INSTALL_DIR}"/usr/lib/os-release-winesapos
chroot "${WINESAPOS_INSTALL_DIR}" ln -s /usr/lib/os-release-winesapos /etc/os-release-winesapos
# Add service to help improve battery life during sleep by disabling wireless devices.
cp ../rootfs/usr/lib/systemd/system/sleep-rfkill.service "${WINESAPOS_INSTALL_DIR}"/usr/lib/systemd/system/
chroot "${WINESAPOS_INSTALL_DIR}" systemctl enable sleep-rfkill
cp /tmp/winesapos-install.log "${WINESAPOS_INSTALL_DIR}"/var/winesapos/
# Continue to log to the file after it has been copied over.
exec > >(tee -a "${WINESAPOS_INSTALL_DIR}"/var/winesapos/winesapos-install.log) 2>&1

View file

@ -651,6 +651,7 @@ for i in \
NetworkManager \
paccache.timer \
sddm \
sleep-rfkill \
snapd \
snapper-timeline.timer \
systemd-timesyncd \