diff options
author | Leah Neukirchen <leah@vuxu.org> | 2023-06-15 16:50:02 +0200 |
---|---|---|
committer | Leah Neukirchen <leah@vuxu.org> | 2023-06-15 16:50:02 +0200 |
commit | 0d783cd262a74367d467596052fc79cc4f75950b (patch) | |
tree | a1b5390b517197b3743a035bea0b0878606d6bdc | |
parent | 457e38b24337769ab3c1dfb970f1bb9376626c25 (diff) | |
download | runit-void-0d783cd262a74367d467596052fc79cc4f75950b.tar.gz runit-void-0d783cd262a74367d467596052fc79cc4f75950b.tar.xz runit-void-0d783cd262a74367d467596052fc79cc4f75950b.zip |
shutdown.d/90-kexec.sh: check for +x bit on noexec mounts properly
The fix in 79675bcb1a was insufficient, as test -x doesn't work on noexec mount (which /run often is), due to using access(X_OK) and not checking the actual stat. Use find instead. Found and fixed by feranur.
-rw-r--r-- | shutdown.d/90-kexec.sh | 5 |
1 files changed, 4 insertions, 1 deletions
diff --git a/shutdown.d/90-kexec.sh b/shutdown.d/90-kexec.sh index 62487f9..b5c8ad0 100644 --- a/shutdown.d/90-kexec.sh +++ b/shutdown.d/90-kexec.sh @@ -1,5 +1,8 @@ if [ -z "$VIRTUALIZATION" ]; then - if [ -x /run/runit/reboot ] && command -v kexec >/dev/null; then + # test -x returns false on a noexec mount, hence using find to detect x bit + if [ -n "$(find /run/runit/reboot -perm -u+x 2>/dev/null)" ] && + command -v kexec >/dev/null + then msg "Triggering kexec..." kexec -e 2>/dev/null # not reached when kexec was successful. |