Last active
June 11, 2016 12:35
-
-
Save Nama/bb96b57359c59bd075e7cd1aabf9a7a1 to your computer and use it in GitHub Desktop.
Script for Arch Linux. Hibernate can't continue if a new kernel is installed. So this script instead suggests to shutdown. Put in /etc/profile.d/ and run via command "hibernate". Should work with LTS and GRSEC kernels, too.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
#!/bin/bash | |
KERNEL="/boot/vmlinuz-linux" | |
hibernate() { | |
grep $(uname -r) $KERNEL* > /dev/null | |
if [[ $? == 0 ]]; then | |
echo "Newest kernel is running, hibernating..." | |
systemctl hibernate | |
else | |
echo "New kernel is installed, can't continue after hibernate..." | |
read -n1 -s -p "Press any key to shutdown... or CTRL + C to cancel" | |
shutdown -h now | |
fi | |
} |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment