Skip to content

Commit aef7824

Browse files
committed
Improved checking installed package on Alpine
1 parent ba4610a commit aef7824

File tree

1 file changed

+4
-4
lines changed

1 file changed

+4
-4
lines changed

scripts/common/package-management.sh

Lines changed: 4 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -81,24 +81,24 @@ function is_package_installed() {
8181
}
8282

8383
function is_native_package_installed() {
84-
local PKG="${1}"
84+
local PACKAGE_NAME="${1}"
8585

8686
if [ "${DISTRO_FAMILY}" = 'Alpine' ]; then
87-
if (call_package_manager info | grep -q "^${PKG}$"); then
87+
if call_package_manager -e "${PACKAGE_NAME}"; then
8888
return 0 # True
8989
else
9090
return 1 # False
9191
fi
9292
elif [ "${DISTRO_FAMILY}" = 'Arch' ]; then
93-
if (pacman -Q | grep -q "^${PKG}\s" > /dev/null); then
93+
if (pacman -Q | grep -q "^${PACKAGE_NAME}\s" > /dev/null); then
9494
return 0 # True
9595
else
9696
return 1 # False
9797
fi
9898
elif [ "${DISTRO_FAMILY}" = 'Android' ] \
9999
|| [ "${DISTRO_FAMILY}" = 'Debian' ] \
100100
|| [ "${DISTRO_FAMILY}" = 'Ubuntu' ]; then
101-
if (apt-cache policy "${PKG}" | grep -q '^\s*Installed:\s*[0-9]'); then
101+
if (apt-cache policy "${PACKAGE_NAME}" | grep -q '^\s*Installed:\s*[0-9]'); then
102102
return 0 # True
103103
else
104104
return 1 # False

0 commit comments

Comments
 (0)