From: Plom Heller Date: Sat, 12 Sep 2026 22:20:45 +0000 (+0200) Subject: Guard against "systemctl hibernate" calls not ensuring proper shutdown. X-Git-Url: https://plomlompom.com/repos/booking/pick_tasks?a=commitdiff_plain;h=0fbfca82c6fcc771f13ef618b7d4e0a3724f803b;p=confplom Guard against "systemctl hibernate" calls not ensuring proper shutdown. --- diff --git a/home/root/.aliases b/home/root/.aliases index f0ff635..41d452e 100644 --- a/home/root/.aliases +++ b/home/root/.aliases @@ -1,2 +1,8 @@ alias ls="ls --color=auto" +hibernate_safe="systemctl hibernate || systemctl poweroff" +systemctl () { + local MSG="Use 'hibernate_safe' instead." + [ "$@" = "hibernate" ] && echo "${MSG}" && return 1 + command systemctl "$@" +} diff --git a/home/user/.aliases b/home/user/.aliases index fbd9533..86f9029 100644 --- a/home/user/.aliases +++ b/home/user/.aliases @@ -1 +1,8 @@ alias ls="ls --color=auto" + +hibernate_safe="sudo -i hibernate_safe" +sudo() { + local MSG="Use 'hibernate_safe' instead." + [ "$1 $2" = "systemctl hibernate" ] && echo "${MSG}" && return 1 + command sudo "$@" +}