From 0d783cd262a74367d467596052fc79cc4f75950b Mon Sep 17 00:00:00 2001 From: Leah Neukirchen Date: Thu, 15 Jun 2023 16:50:02 +0200 Subject: 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. --- shutdown.d/90-kexec.sh | 5 ++++- 1 file changed, 4 insertions(+), 1 deletion(-) 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. -- cgit 1.4.1