Skip to content

Instantly share code, notes, and snippets.

@NICHOLAS85
Created March 3, 2020 18:10
Show Gist options
  • Save NICHOLAS85/c599f5f3db5666dd28ac980d8d87cef1 to your computer and use it in GitHub Desktop.
Save NICHOLAS85/c599f5f3db5666dd28ac980d8d87cef1 to your computer and use it in GitHub Desktop.
Automatically boot into OS after hibernation when using rEFInd
#!/bin/sh
dir="/boot/efi/EFI/refind/timeout.conf"
timeout="5"
if [ "$2" = "hibernate" ]; then
case "$1" in
pre)
echo "refindhibernate.sh: Setting timeout to -1"
sed 's/timeout.*/timeout -1/g' "$dir" > "$dir"~
;;
post)
echo "refindhibernate.sh: Setting timeout to $timeout"
sed "s/timeout.*/timeout $timeout/g" "$dir" > "$dir"~
;;
esac
mv "$dir"~ "$dir"
fi
@NICHOLAS85
Copy link
Author

Drop this file into /usr/lib/systemd/system-sleep/
Add include timeout.conf to your refind.conf and adjust the $dir and $timeout variables accordingly.
Create the timeout.conf file at the directory indicated by the $dir variable with the config value you want, ie timeout 5

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment