summaryrefslogtreecommitdiff
path: root/functions
diff options
context:
space:
mode:
Diffstat (limited to 'functions')
-rwxr-xr-xfunctions/packages.sh50
1 files changed, 24 insertions, 26 deletions
diff --git a/functions/packages.sh b/functions/packages.sh
index 4211c0eaa..ebbeb4aa8 100755
--- a/functions/packages.sh
+++ b/functions/packages.sh
@@ -10,10 +10,11 @@
Check_package ()
{
- FILE="${1}"
- PACKAGE="${2}"
+ CHROOT="${1}"
+ FILE="${2}"
+ PACKAGE="${3}"
- Check_installed "${FILE}" "${PACKAGE}"
+ Check_installed "${CHROOT}" "${FILE}" "${PACKAGE}"
case "${INSTALL_STATUS}" in
1)
@@ -66,38 +67,35 @@ Remove_package ()
# 2 if package isn't installed and we aren't in an apt managed system
Check_installed ()
{
- FILE="${1}"
- PACKAGE="${2}"
+ CHROOT="${1}"
+ FILE="${2}"
+ PACKAGE="${3}"
- case "${LB_BUILD_WITH_CHROOT}" in
- true)
+ if [ "${LB_BUILD_WITH_CHROOT}" = "true" ] && [ "${CHROOT}" = "chroot" ]
+ then
+ if Chroot chroot "dpkg-query -s ${PACKAGE}" 2> /dev/null | grep -qs "Status: install"
+ then
+ INSTALL_STATUS=0
+ else
+ INSTALL_STATUS=1
+ fi
+ else
+ if which dpkg-query > /dev/null 2>&1
+ then
if Chroot chroot "dpkg-query -s ${PACKAGE}" 2> /dev/null | grep -qs "Status: install"
then
INSTALL_STATUS=0
else
INSTALL_STATUS=1
fi
- ;;
- false)
- if which dpkg-query > /dev/null 2>&1
+ else
+ if [ ! -e "${FILE}" ]
then
- if Chroot chroot "dpkg-query -s ${PACKAGE}" 2> /dev/null | grep -qs "Status: install"
- then
- INSTALL_STATUS=0
- else
- INSTALL_STATUS=1
- fi
+ INSTALL_STATUS=2
else
- FILE="$(echo ${FILE} | sed -e 's|chroot||')"
-
- if [ ! -e "${FILE}" ]
- then
- INSTALL_STATUS=2
- else
- INSTALL_STATUS=0
- fi
+ INSTALL_STATUS=0
fi
- ;;
- esac
+ fi
+ fi
}