Simplify grep pattern in is_pkg_installed() for safer opkg matching (#117)

* Fix is_pkg_installed() opkg detection: use list-installed + exact grep match

opkg status always returns exit code 0 regardless of whether the package
is installed, making the previous check unreliable. Replace with
opkg list-installed piped through grep -q with an anchored pattern to
ensure exact package name matching without partial matches.

Co-authored-by: Slava-Shchipunov <92646230+Slava-Shchipunov@users.noreply.github.com>

---------

Co-authored-by: copilot-swe-agent[bot] <198982749+Copilot@users.noreply.github.com>
Co-authored-by: Slava-Shchipunov <92646230+Slava-Shchipunov@users.noreply.github.com>
This commit is contained in:
Copilot
2026-03-07 22:35:40 +07:00
committed by GitHub
parent 2c4fe317b3
commit 09256b1cc5

View File

@@ -31,7 +31,7 @@ is_pkg_installed() {
if [ "$PKG_MANAGER" = "apk" ]; then
apk info -e "$pkg_name" >/dev/null 2>&1
else
opkg status "$pkg_name" >/dev/null 2>&1
opkg list-installed 2>/dev/null | grep -q "^${pkg_name} "
fi
}