From 32ed8052bf56bfd2b09655c2500610a82d5f55be Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Marek=20Marczykowski-G=C3=B3recki?= Date: Wed, 21 May 2014 18:58:58 +0200 Subject: [PATCH] fedora: improve error handling Make sure that all partitions got unmounted. --- qubeize_image | 4 ++-- scripts_fedora/04_install_qubes.sh | 6 +++--- 2 files changed, 5 insertions(+), 5 deletions(-) diff --git a/qubeize_image b/qubeize_image index f84f3c0..848fcfb 100755 --- a/qubeize_image +++ b/qubeize_image @@ -48,13 +48,13 @@ export IMG=qubeized_images/$NAME-root.img echo "--> Copying $CLEANIMG to $IMG..." cp $CLEANIMG $IMG || exit 1 -echo "--> Mouting $IMG" +echo "--> Mounting $IMG" mkdir -p mnt mount -o loop $IMG mnt || exit 1 export INSTALLDIR=mnt -$SCRIPTSDIR/04_install_qubes.sh || exit 1 +$SCRIPTSDIR/04_install_qubes.sh || { umount $INSTALLDIR; exit 1; } echo "--> Copying the Apps Menu shortcuts..." export APPSORIG=qubeized_images/$NAME-apps.orig diff --git a/scripts_fedora/04_install_qubes.sh b/scripts_fedora/04_install_qubes.sh index 3241602..f1a0c0b 100755 --- a/scripts_fedora/04_install_qubes.sh +++ b/scripts_fedora/04_install_qubes.sh @@ -2,12 +2,14 @@ echo "--> Preparing environment..." mount -t proc proc $PWD/mnt/proc +trap "umount $PWD/mnt/proc" EXIT + +export YUM0=$PWD/yum_repo_qubes if [ "$TEMPLATE_FLAVOR" == "minimal" ]; then YUM_OPTS="$YUM_OPTS --group_package_types=mandatory" fi echo "--> Installing RPMs..." -export YUM0=$PWD/yum_repo_qubes yum install -c $PWD/yum.conf $YUM_OPTS -y --installroot=$(pwd)/mnt @qubes-vm || RETCODE=1 rpm --root=$PWD/mnt --import $PWD/mnt/etc/pki/rpm-gpg/RPM-GPG-KEY-qubes-* @@ -17,6 +19,4 @@ if [ "$TEMPLATE_FLAVOR" != "minimal" ]; then $SCRIPTSDIR/add_3rd_party_software.sh || RETCODE=1 fi -umount $PWD/mnt/proc - exit $RETCODE