mirror of
https://github.com/basecamp/omarchy.git
synced 2026-02-17 15:25:37 +00:00
* Add option to enable/disable hibernation * Actually do it * Match hibernation toggle words * Both enable and disable * Match the tense * Match options * Remove excess CR
19 lines
455 B
Bash
Executable File
19 lines
455 B
Bash
Executable File
#!/bin/bash
|
|
|
|
# Check if hibernation is supported
|
|
if [[ ! -f /sys/power/image_size ]]; then
|
|
exit 1
|
|
fi
|
|
|
|
# Sum all swap sizes (excluding zram)
|
|
SWAPSIZE_KB=$(awk '!/Filename|zram/ {sum += $3} END {print sum+0}' /proc/swaps)
|
|
SWAPSIZE=$(( 1024 * ${SWAPSIZE_KB:-0} ))
|
|
|
|
HIBERNATION_IMAGE_SIZE=$(cat /sys/power/image_size)
|
|
|
|
if [[ "$SWAPSIZE" -gt "$HIBERNATION_IMAGE_SIZE" ]] && [[ -f /etc/mkinitcpio.conf.d/omarchy_resume.conf ]]; then
|
|
exit 0
|
|
else
|
|
exit 1
|
|
fi
|