Lots of scripts
This commit is contained in:
18
.local/bin/station-hibernation-available
Executable file
18
.local/bin/station-hibernation-available
Executable file
@@ -0,0 +1,18 @@
|
||||
#!/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 > HIBERNATION_IMAGE_SIZE )) ; then
|
||||
exit 0
|
||||
else
|
||||
exit 1
|
||||
fi
|
||||
Reference in New Issue
Block a user