From 281e64136bb3e6e5e3ba37ee8d958ceb903cd181 Mon Sep 17 00:00:00 2001 From: Renato Botelho Date: Mon, 11 Apr 2016 19:00:39 -0300 Subject: Exit build process if install_pkg_install_ports() fails --- tools/builder_common.sh | 12 +++++++++--- 1 file changed, 9 insertions(+), 3 deletions(-) diff --git a/tools/builder_common.sh b/tools/builder_common.sh index 2d791e1..1e7b385 100644 --- a/tools/builder_common.sh +++ b/tools/builder_common.sh @@ -1659,9 +1659,12 @@ pkg_chroot() { cp -f /etc/resolv.conf ${_root}/etc/resolv.conf touch ${BUILDER_LOGS}/install_pkg_install_ports.txt script -aq ${BUILDER_LOGS}/install_pkg_install_ports.txt pkg -c ${_root} $@ >/dev/null 2>&1 + local result=$? rm -f ${_root}/etc/resolv.conf /sbin/umount -f ${_root}/dev /sbin/umount -f ${_root}/var/cache/pkg + + return $result } @@ -1719,16 +1722,19 @@ install_pkg_install_ports() { [ -d ${SCRATCHDIR}/pkg_cache ] || \ mkdir -p ${SCRATCHDIR}/pkg_cache - echo ">>> Installing built ports (packages) in chroot (${STAGE_CHROOT_DIR})... (starting)" + echo -n ">>> Installing built ports (packages) in chroot (${STAGE_CHROOT_DIR})... " # First mark all packages as automatically installed pkg_chroot ${STAGE_CHROOT_DIR} set -A 1 -a # Install all necessary packages - pkg_chroot ${STAGE_CHROOT_DIR} install ${MAIN_PKG} ${custom_package_list} + if ! pkg_chroot ${STAGE_CHROOT_DIR} install ${MAIN_PKG} ${custom_package_list}; then + echo "Failed!" + print_error_pfS + fi # Make sure required packages are set as non-automatic pkg_chroot ${STAGE_CHROOT_DIR} set -A 0 pkg ${MAIN_PKG} ${custom_package_list} # Remove unnecessary packages pkg_chroot ${STAGE_CHROOT_DIR} autoremove - echo ">>> Installing built ports (packages) in chroot (${STAGE_CHROOT_DIR})... (finshied)" + echo "Done!" } install_bsdinstaller() { -- cgit v1.1