From 09256b1cc5decfa81d9b6ac18ce35230506a6f42 Mon Sep 17 00:00:00 2001 From: Copilot <198982749+Copilot@users.noreply.github.com> Date: Sat, 7 Mar 2026 22:35:40 +0700 Subject: [PATCH] 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> --- amneziawg-install.sh | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/amneziawg-install.sh b/amneziawg-install.sh index d65c668..066e460 100644 --- a/amneziawg-install.sh +++ b/amneziawg-install.sh @@ -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 }