From bdad0b6e1698b8062f5422f0a855b46605747546 Mon Sep 17 00:00:00 2001 From: Mhd Sulhan Date: Fri, 29 Jan 2016 19:14:03 +0700 Subject: scripts: split variable for normal and forced removed packages. --- scripts/_bootstrap_script.sh | 6 ++++++ scripts/rootfs.sh | 17 ++++++++++++----- 2 files changed, 18 insertions(+), 5 deletions(-) diff --git a/scripts/_bootstrap_script.sh b/scripts/_bootstrap_script.sh index 341ab52..3ca684e 100755 --- a/scripts/_bootstrap_script.sh +++ b/scripts/_bootstrap_script.sh @@ -76,6 +76,12 @@ bootstrap_remove_packages() { echo "==> remove unneeded packages ..." for pkg in ${PKGS_REMOVED[@]}; do echo " removing $pkg" + pacman -Rs --noconfirm $pkg + done + + echo ">>> force remove packages ..." + for pkg in ${PKGS_REMOVED_FORCE[@]}; do + echo " force removing $pkg" pacman -Rdd --noconfirm $pkg done } diff --git a/scripts/rootfs.sh b/scripts/rootfs.sh index 955aef9..ae0fa95 100755 --- a/scripts/rootfs.sh +++ b/scripts/rootfs.sh @@ -122,7 +122,12 @@ rootfs_uninstall() { echo "" echo "==> uninstalling packages ..." if [[ ${#PKGS_REMOVED} > 0 ]]; then - pacman -r "$ROOTFS" -Rdd --noconfirm ${PKGS_REMOVED} + pacman -r "$ROOTFS" -Rs --noconfirm ${PKGS_REMOVED} + fi + + echo ">>> force removing packages ..." + if [[ ${#PKGS_REMOVED_FORCE} > 0 ]]; then + pacman -r "$ROOTFS" -Rs --noconfirm ${PKGS_REMOVED_FORCE} fi } @@ -192,9 +197,11 @@ rootfs_to_docker() { ## rootfs_clean() { echo "" - echo "==> unmounting and cleaning previous rootfs ..." + echo "==> unmounting and cleaning previous rootfs '$ROOTFS'" - sudo umount -R $ROOTFS - rm -f ${ROOTFS}/* - rmdir ${ROOTFS} + if [ -d ${ROOTFS} ]; then + sudo umount -R $ROOTFS &>/dev/null + rm -f ${ROOTFS}/* &>/dev/null + rmdir ${ROOTFS} &>/dev/null + fi } -- cgit v1.3