]> git.99rst.org Git - openwrt-packages.git/commitdiff
sudo: add test-version.sh and stop running sudo in tests
authorAlexandru Ardelean <redacted>
Mon, 10 Aug 2026 09:41:17 +0000 (12:41 +0300)
committerAlexandru Ardelean <redacted>
Mon, 10 Aug 2026 17:17:56 +0000 (20:17 +0300)
PKG_VERSION substitutes p->_p (1.9.17_p2) for a valid apk version, but the
binaries print the real 1.9.17p2, so the generic per-executable version
probe reports "no executables provided version" and fails. Add a
test-version.sh that matches the version string compiled into the binary.

Executing sudo under QEMU emulation (e.g. mips_24kc) hangs indefinitely, so
neither test-version.sh nor test.sh runs it any more: the version is read
from the binary and test.sh only checks the installed files.

Signed-off-by: Alexandru Ardelean <redacted>
admin/sudo/test-version.sh [new file with mode: 0755]
admin/sudo/test.sh [changed mode: 0644->0755]

diff --git a/admin/sudo/test-version.sh b/admin/sudo/test-version.sh
new file mode 100755 (executable)
index 0000000..f8a0f1b
--- /dev/null
@@ -0,0 +1,17 @@
+#!/bin/sh
+
+# shellcheck shell=busybox
+
+# PKG_VERSION substitutes p->_p for a valid apk version (1.9.17_p2); the binary
+# embeds the real 1.9.17p2. Executing sudo just to read its version hangs under
+# QEMU emulation (e.g. mips_24kc), so match the version string compiled into the
+# binary instead of running it.
+case "$1" in
+sudo)
+       grep -aqF "$(echo "$2" | tr -d '_')" /usr/bin/sudo
+       ;;
+*)
+       echo "Untested package: $1" >&2
+       exit 1
+       ;;
+esac
old mode 100644 (file)
new mode 100755 (executable)
index da24851..14701d4
@@ -1,7 +1,12 @@
 #!/bin/sh
 
+# sudo hangs when executed under QEMU emulation (e.g. mips_24kc), so verify the
+# installed files rather than running it. The version is checked in
+# test-version.sh against the string compiled into the binary.
 case "$1" in
-       sudo)
-               sudo --version | grep "${2//_p/p}"
-               ;;
+sudo)
+       [ -x /usr/bin/sudo ] || { echo "FAIL: /usr/bin/sudo missing"; exit 1; }
+       [ -x /usr/sbin/visudo ] || { echo "FAIL: /usr/sbin/visudo missing"; exit 1; }
+       [ -f /etc/sudoers ] || { echo "FAIL: /etc/sudoers missing"; exit 1; }
+       ;;
 esac
git clone https://git.99rst.org/PROJECT