From a8af133037680c21730b10b0d42dc844cba69280 Mon Sep 17 00:00:00 2001 From: Bernhard Landauer Date: Tue, 14 Mar 2017 19:55:29 +0100 Subject: [PATCH] handle errors when installing pkgs; close https://github.com/Chrysostomus/manjaro-architect/issues/117 --- data/translations/english.trans | 1 + lib/util-base.sh | 6 +++--- lib/util-desktop.sh | 3 +-- lib/util-menu.sh | 8 +++++--- 4 files changed, 10 insertions(+), 8 deletions(-) diff --git a/data/translations/english.trans b/data/translations/english.trans index 3fbf8d8..a9ef8df 100644 --- a/data/translations/english.trans +++ b/data/translations/english.trans @@ -256,6 +256,7 @@ _ExtErrBody="Partition cannot be mounted due to a problem with the mountpoint na # Install Base _WarnInstBase="A Manjaro Base has already been installed on this partition.\nProceed anyway?" _InstBseTitle="Install Base" +_InstFail="Installation failed." _InstBseBody="Standard: Recommended for beginners. Choose up to two kernels (linux and linux-lts) and optionally the base-devel package group. sudo, btrfs-progs, f2fs-tools will also be installed.\n\nAdvanced: Choose up to four kernels (linux, lts, grsec, zen) and control individual base and base-devel packages. Additional configuration for grsec and zen may be required for Virtualbox and NVIDIA.\n\nNOTE: Unless already installed, at least one kernel must be selected." _InstStandBseBody="The base package group will be installed automatically. The base-devel package group is required to use the Arch User Repository (AUR)." _InstStandBase="Standard Installation" diff --git a/lib/util-base.sh b/lib/util-base.sh index b66daef..ce6fcd2 100644 --- a/lib/util-base.sh +++ b/lib/util-base.sh @@ -279,7 +279,7 @@ install_base() { filter_packages check_for_error "packages to install: $(cat /mnt/.base | tr '\n' ' ')" basestrap ${MOUNTPOINT} $(cat /mnt/.base) 2>$ERR - check_for_error "install basepkgs" $? + check_for_error "install basepkgs" $? || return 1 # If root is on btrfs volume, amend mkinitcpio.conf [[ $(lsblk -lno FSTYPE,MOUNTPOINT | awk '/ \/mnt$/ {print $1}') == btrfs ]] && sed -e '/^HOOKS=/s/\ fsck//g' -i ${MOUNTPOINT}/etc/mkinitcpio.conf && \ @@ -341,7 +341,7 @@ uefi_bootloader() { DIALOG " $_InstUefiBtTitle " --yesno "\n$_InstUefiBtBody\n " 0 0 || return 0 clear basestrap ${MOUNTPOINT} grub efibootmgr dosfstools 2>$ERR - check_for_error "$FUNCNAME grub" $? + check_for_error "$FUNCNAME grub" $? || return 1 DIALOG " $_InstGrub " --infobox "\n$_PlsWaitBody\n " 0 0 # if root is encrypted, amend /etc/default/grub @@ -416,7 +416,7 @@ bios_bootloader() { if [[ $(cat ${PACKAGES}) != "" ]]; then sed -i 's/+ \|\"//g' ${PACKAGES} basestrap ${MOUNTPOINT} $(cat ${PACKAGES}) 2>$ERR - check_for_error "$FUNCNAME" $? + check_for_error "$FUNCNAME" $? || return 1 # If Grub, select device if [[ $(cat ${PACKAGES} | grep "grub") != "" ]]; then diff --git a/lib/util-desktop.sh b/lib/util-desktop.sh index e7a9bba..4c3fcee 100644 --- a/lib/util-desktop.sh +++ b/lib/util-desktop.sh @@ -149,7 +149,7 @@ install_manjaro_de_wm() { check_for_error "packages to install: $(cat /mnt/.base | sort | uniq | tr '\n' ' ')" clear basestrap ${MOUNTPOINT} $(cat /mnt/.base | sort | uniq) 2>$ERR - check_for_error "install desktop-pkgs" "$?" + check_for_error "install desktop-pkgs" "$?" || return 1 # copy the profile overlay to the new root echo "Copying overlay files to the new root" @@ -180,7 +180,6 @@ install_manjaro_de_wm() { # Clear the packages file for installation of "common" packages echo "" > ${PACKAGES} - # Offer to install various "common" packages. install_extra fi diff --git a/lib/util-menu.sh b/lib/util-menu.sh index 7b776e8..7255a47 100644 --- a/lib/util-menu.sh +++ b/lib/util-menu.sh @@ -111,11 +111,13 @@ install_base_menu() { check_for_error 'refresh pacman-keys' ) ;; - "3") install_base + "3") install_base || DIALOG " $_InstBseTitle " --infobox "\n$_InstFail\n " 0 0 ;; - "4") check_base && install_manjaro_de_wm_pkg + "4") check_base && { + install_manjaro_de_wm_pkg || DIALOG " $_InstBseTitle " --infobox "\n$_InstFail\n " 0 0 + } ;; - "5") install_bootloader + "5") install_bootloader || DIALOG " $_InstBseTitle " --infobox "\n$_InstFail\n " 0 0 ;; *) loopmenu=0 return 0