Changing package dependency checks within chroot to work outside as well.

This commit is contained in:
Daniel Baumann 2015-01-04 18:08:09 +01:00
parent 691305c11e
commit fdc9250bca
21 changed files with 57 additions and 59 deletions

View File

@ -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
}

BIN
scripts/build/.grep.swp Normal file

Binary file not shown.

View File

@ -51,7 +51,7 @@ Check_architectures amd64 i386
Check_crossarchitectures
# Checking depends
Check_package chroot/usr/sbin/grub grub-legacy
Check_package chroot /usr/sbin/grub grub-legacy
# Restoring cache
Restore_cache cache/packages.binary

View File

@ -51,7 +51,7 @@ Check_architectures amd64 i386
Check_crossarchitectures
# Checking depends
Check_package chroot/usr/bin/grub-mkimage grub-pc
Check_package chroot /usr/bin/grub-mkimage grub-pc
# Restoring cache
Restore_cache cache/packages.binary

View File

@ -46,22 +46,22 @@ Create_lockfile .lock
# Checking depends
case "${LB_BINARY_FILESYSTEM}" in
fat*)
Check_package chroot/sbin/mkdosfs dosfstools
Check_package chroot /sbin/mkdosfs dosfstools
;;
ntfs)
Check_package chroot/sbin/mkfs.nfts ntfs-3g
Check_package chroot /sbin/mkfs.nfts ntfs-3g
;;
esac
Check_package chroot/usr/share/doc/mtools mtools
Check_package chroot/sbin/parted parted
Check_package chroot /usr/share/doc/mtools mtools
Check_package chroot /sbin/parted parted
if [ "${LB_ARCHITECTURES}" = "sparc" ]
then
case "${LB_BINARY_FILESYSTEM}" in
ext2|ext3|ext4)
Check_package chroot/sbin/mkfs.${LB_BINARY_FILESYSTEM} e2fsprogs
Check_package chroot /sbin/mkfs.${LB_BINARY_FILESYSTEM} e2fsprogs
;;
*)
@ -73,7 +73,7 @@ fi
case "${LB_BOOTLOADER}" in
grub)
Check_package chroot/usr/sbin/grub grub
Check_package chroot /usr/sbin/grub grub
;;
syslinux)
@ -89,7 +89,7 @@ case "${LB_BOOTLOADER}" in
exit 1
;;
esac
Check_package chroot/usr/bin/${_BOOTLOADER} ${_BOOTLOADER}
Check_package chroot /usr/bin/${_BOOTLOADER} ${_BOOTLOADER}
;;
esac

View File

@ -53,7 +53,7 @@ Check_lockfile .lock
Create_lockfile .lock
# Checking depends
Check_package chroot/usr/bin/xorriso xorriso
Check_package chroot /usr/bin/xorriso xorriso
# Restoring cache
Restore_cache cache/packages.binary

View File

@ -48,7 +48,7 @@ case "${LB_ARCHITECTURES}" in
case "${LB_BUILD_WITH_CHROOT}" in
true)
# Checking depends
Check_package chroot/usr/lib/loadlin/loadlin.exe.gz loadlin
Check_package chroot /usr/lib/loadlin/loadlin.exe.gz loadlin
# Restoring cache
Restore_cache cache/packages.binary

View File

@ -64,11 +64,11 @@ fi
# Checking depends
case "${LB_MEMTEST}" in
memtest86)
Check_package chroot/boot/memtest86.bin memtest86
Check_package chroot /boot/memtest86.bin memtest86
;;
memtest86+)
Check_package chroot/boot/memtest86+.bin memtest86+
Check_package chroot /boot/memtest86+.bin memtest86+
;;
esac

View File

@ -51,7 +51,7 @@ Create_lockfile .lock
if [ "${LB_ARCHITECTURES}" = "sparc" ]
then
# Checking depends
Check_package chroot/usr/bin/elftoaout sparc-utils
Check_package chroot /usr/bin/elftoaout sparc-utils
# Restoring cache
Restore_cache cache/packages.binary

View File

@ -59,8 +59,8 @@ then
Restore_cache cache/packages.chroot
# Check depends
Check_package chroot/usr/bin/apt-ftparchive apt-utils
Check_package chroot/usr/bin/grep-aptavail dctrl-tools
Check_package chroot /usr/bin/apt-ftparchive apt-utils
Check_package chroot /usr/bin/grep-aptavail dctrl-tools
# Installing depends
Install_package

View File

@ -85,7 +85,7 @@ done
case "${LB_CHROOT_FILESYSTEM}" in
ext2|ext3|ext4)
# Checking depends
Check_package chroot/sbin/mkfs.${LB_CHROOT_FILESYSTEM} e2fsprogs
Check_package chroot /sbin/mkfs.${LB_CHROOT_FILESYSTEM} e2fsprogs
# Restoring cache
Restore_cache cache/packages.binary
@ -211,7 +211,7 @@ case "${LB_CHROOT_FILESYSTEM}" in
jffs2)
# Checking depends
Check_package chroot/usr/sbin/mkfs.jffs2 mtd-tools
Check_package chroot /usr/sbin/mkfs.jffs2 mtd-tools
# Restoring cache
Restore_cache cache/packages.binary
@ -310,7 +310,7 @@ case "${LB_CHROOT_FILESYSTEM}" in
squashfs)
# Checking depends
Check_package chroot/usr/share/doc/squashfs-tools squashfs-tools
Check_package chroot /usr/share/doc/squashfs-tools squashfs-tools
# Restoring cache
Restore_cache cache/packages.binary

View File

@ -123,12 +123,12 @@ fi
# Checking depends
case "${LB_BUILD_WITH_CHROOT}" in
true)
Check_package chroot/usr/lib/$(echo ${_BOOTLOADER} | tr [a-z] [A-Z]) ${_BOOTLOADER}
Check_package chroot/usr/lib/syslinux syslinux-common
Check_package chroot /usr/lib/$(echo ${_BOOTLOADER} | tr [a-z] [A-Z]) ${_BOOTLOADER}
Check_package chroot /usr/lib/syslinux syslinux-common
if ls "${_SOURCE}"/*.svg* > /dev/null 2>&1
then
Check_package chroot/usr/bin/rsvg-convert librsvg2-bin
Check_package chroot /usr/bin/rsvg-convert librsvg2-bin
fi
;;

View File

@ -48,7 +48,7 @@ case "${LB_ARCHITECTURES}" in
if [ "${LB_BUILD_WITH_CHROOT}" = "true" ]
then
# Checking depends
Check_package chroot/usr/share/win32/win32-loader.exe win32-loader
Check_package chroot /usr/share/win32/win32-loader.exe win32-loader
# Restoring cache
Restore_cache cache/packages.binary

View File

@ -49,7 +49,7 @@ Check_lockfile .lock
Create_lockfile .lock
# Checking depends
Check_package chroot/usr/bin/zsyncmake zsync
Check_package chroot /usr/bin/zsyncmake zsync
# Restoring cache
Restore_cache cache/packages.binary

View File

@ -37,7 +37,7 @@ Check_crossarchitectures
Echo_message "Begin bootstrapping system..."
Check_package /usr/sbin/debootstrap debootstrap
Check_package chroot bin/debootstrap debootstrap
# Checking stage file
Check_stagefile .build/bootstrap

View File

@ -275,7 +275,7 @@ EOF
fi
# Check depends
Check_package chroot/usr/bin/apt-ftparchive apt-utils
Check_package chroot /usr/bin/apt-ftparchive apt-utils
# Installing depends
Install_package

View File

@ -52,7 +52,7 @@ fi
case "${LB_BUILD_WITH_CHROOT}" in
true)
# Checking depends
Check_package chroot/usr/bin/grep-aptavail dctrl-tools
Check_package chroot /usr/bin/grep-aptavail dctrl-tools
# Restoring cache
Restore_cache cache/packages.chroot

View File

@ -43,7 +43,7 @@ if ls config/preseed/*.cfg > /dev/null 2>&1 || \
ls chroot/root/packages.chroot.cfg > /dev/null 2>&1
then
# Check dependency
Check_package chroot/usr/bin/debconf-set-selections debconf
Check_package chroot /usr/bin/debconf-set-selections debconf
# Install dependency
Install_package

View File

@ -64,8 +64,8 @@ Check_lockfile .lock
Create_lockfile .lock
# Checking depends
Check_package chroot/usr/bin/wget wget
Check_package chroot/usr/bin/apt-ftparchive apt-utils
Check_package chroot /usr/bin/wget wget
Check_package chroot /usr/bin/apt-ftparchive apt-utils
# Restoring cache
Restore_cache cache/packages.binary

View File

@ -49,8 +49,8 @@ Check_lockfile .lock
Create_lockfile .lock
# Checking depends
Check_package chroot/sbin/mkdosfs dosfstools
Check_package chroot/sbin/parted parted
Check_package chroot /sbin/mkdosfs dosfstools
Check_package chroot /sbin/parted parted
# Installing depends
Install_package

View File

@ -53,7 +53,7 @@ Check_lockfile .lock
Create_lockfile .lock
# Checking depends
Check_package chroot/usr/bin/xorriso xorriso
Check_package chroot /usr/bin/xorriso xorriso
# Installing depends
Install_package