Bug#774807: Fix broken Check_installed function
Package: live-build
Version: 4.0.4-1
Tags: patch
If checking against the host, whether through 'host' being specified (in
5.x), or LB_BUILD_WITH_CHROOT=false, and if dpkg-query is installed on
the host, the dpkg-query check is done against chroot, instead of the host.
This is so with v4.0.4-1, and also with 5.x, even after the improvement
in 5.x to improve host checking capabilities here.
commit b40a90fa9e56f070c677de2262caabf18e94ce59
Author: jnqnfe <jnqnfe@gmail.com>
Date: Wed Jan 7 19:36:48 2015 +0000
Fix Check_installed function when checking against host
diff --git a/functions/packages.sh b/functions/packages.sh
index 477d337..7e62daf 100755
--- a/functions/packages.sh
+++ b/functions/packages.sh
@@ -21,7 +21,7 @@ Check_package ()
_LB_PACKAGES="${_LB_PACKAGES} ${PACKAGE}"
;;
- 2)
+ 2|3)
Echo_error "You need to install %s on your host system." "${PACKAGE}"
exit 1
;;
@@ -63,8 +63,9 @@ Remove_package ()
# Check_installed
# uses as return value global var INSTALL_STATUS
# INSTALL_STATUS : 0 if package is installed
-# 1 if package isn't installed and we're in an apt managed system
-# 2 if package isn't installed and we aren't in an apt managed system
+# 1 if package isn't installed in chroot
+# 2 if package isn't installed in host
+# 3 if package isn't installed in host, and host is not an apt managed system
Check_installed ()
{
CHROOT="${1}"
@@ -82,16 +83,16 @@ Check_installed ()
else
if which dpkg-query > /dev/null 2>&1
then
- if Chroot chroot "dpkg-query -s ${PACKAGE}" 2> /dev/null | grep -qs "Status: install"
+ if dpkg-query -s ${PACKAGE} 2> /dev/null | grep -qs "Status: install"
then
INSTALL_STATUS=0
else
- INSTALL_STATUS=1
+ INSTALL_STATUS=2
fi
else
if [ ! -e "${FILE}" ]
then
- INSTALL_STATUS=2
+ INSTALL_STATUS=3
else
INSTALL_STATUS=0
fi
Reply to: