Add the ability to hibernate

Builds and installs dynamic-hibernate and enables its associated services. This dynamically creates a swapfile before hibernation, automatically hides the bootloader - pinning the currently booted image - then allowing you to hibernate to the created swapfile. This circumvents the requirement for a swap partition or pre-existing swapfile. It also includes a notifier which alerts the user if and why hibernation fails.

See gitlab.com/evlaV/steamos-customizations/-/commit/3d13dcb03258d237fc0a8dc9d3d74a1da7fe7385 for basis
This commit is contained in:
Thomas Duckworth
2025-12-06 23:01:34 +11:00
parent e8e815e550
commit b88d39315b
5 changed files with 18 additions and 1 deletions

View File

@@ -11,4 +11,5 @@ Packages=boost
pacman
python-setproctitle # For kde-builder
python-yaml # For kde-builder
rust

View File

@@ -74,3 +74,6 @@ chown -R live:live /home/live/
# Start the basic-test (if it wants to be started)
systemctl daemon-reload
systemctl start --no-block kde-linux-basic-test.service
# Disable hibernation since dynamic-hibernate won't work in a live environment
systemctl mask hibernate.target

View File

@@ -33,8 +33,10 @@ enable kde-linux-live-setup.service
enable kde-linux-volatile-var-lib-flatpak.service
enable plasma-setup-live-system.service
enable var-lib-snapd-snap.mount
# also one of ours but not prefixed with kde-linux- so others can use it too
# also ours but not prefixed with kde-linux- so others can use it too
enable etc-factory.service
enable dynamic-hibernate-prepare.service
enable dynamic-hibernate-cleanup.service
# networkd - we use networkmanager
disable systemd-networkd-wait-online.service

View File

@@ -3,3 +3,7 @@
# Screen reading is opt-in
disable orca.service
# Sends an error notification if dynamic hibernation fails
# also ours but not prefixed with kde-linux- so others can use it too
enable dynamic-hibernate-notifier.service

View File

@@ -16,6 +16,13 @@ bootctl install
echo 'timeout 5' >> "$SYSTEMD_ESP_PATH/loader/loader.conf"
cp /usr/share/edk2-shell/x64/Shell.efi "$SYSTEMD_ESP_PATH/shellx64.efi"
# dynamic-hibernate
cd /tmp
git clone --depth 1 https://invent.kde.org/tduck/dynamic-hibernate # TODO: move to kde-linux org and integrate into i18n infra
cmake -S dynamic-hibernate -B dynamic-hibernate/build -DCMAKE_INSTALL_PREFIX=/usr
cmake --build dynamic-hibernate/build -v
cmake --install dynamic-hibernate/build
# Meanwhile cleanup a bit
## Unnecessary for us
pacman --remove --noconfirm qt6-doc qt6-examples || true