summaryrefslogtreecommitdiffstats
path: root/admin/sudo/test-version.sh
blob: f8a0f1b586e8b3f039aa55e401aca56f36a08e5b (plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
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