summaryrefslogtreecommitdiff
path: root/functions
diff options
context:
space:
mode:
authorDaniel Baumann <mail@daniel-baumann.ch>2015-01-04 18:08:09 +0100
committerDaniel Baumann <mail@daniel-baumann.ch>2015-01-04 18:19:47 +0100
commitfdc9250bca7bfce660758d77af2ffa971bc19ecb (patch)
tree81a0ce184d4791742031f6cbc53f30c80883ed68 /functions
parent691305c11ea59ddf64faff5f778658914e7c6be7 (diff)
downloadvyos-live-build-fdc9250bca7bfce660758d77af2ffa971bc19ecb.tar.gz
vyos-live-build-fdc9250bca7bfce660758d77af2ffa971bc19ecb.zip
Changing package dependency checks within chroot to work outside as well.
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
}