mirror of
https://github.com/Slava-Shchipunov/awg-openwrt.git
synced 2026-03-14 01:13:09 +00:00
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:
@@ -31,7 +31,7 @@ is_pkg_installed() {
|
|||||||
if [ "$PKG_MANAGER" = "apk" ]; then
|
if [ "$PKG_MANAGER" = "apk" ]; then
|
||||||
apk info -e "$pkg_name" >/dev/null 2>&1
|
apk info -e "$pkg_name" >/dev/null 2>&1
|
||||||
else
|
else
|
||||||
opkg status "$pkg_name" >/dev/null 2>&1
|
opkg list-installed 2>/dev/null | grep -q "^${pkg_name} "
|
||||||
fi
|
fi
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|||||||
Reference in New Issue
Block a user