From e6b5746203c18b1c2e935a9a714909ad7e92e5f6 Mon Sep 17 00:00:00 2001 From: Dieter Plaetinck Date: Thu, 3 Mar 2011 19:31:48 +0100 Subject: be more strict and correct in worker exit codes --- src/core/procedures/automatic | 11 +++++------ src/core/procedures/base | 31 ++++++++++++++++++++----------- src/core/procedures/interactive | 11 ++++++----- 3 files changed, 31 insertions(+), 22 deletions(-) (limited to 'src/core/procedures') diff --git a/src/core/procedures/automatic b/src/core/procedures/automatic index a37803e..407a35b 100644 --- a/src/core/procedures/automatic +++ b/src/core/procedures/automatic @@ -82,7 +82,6 @@ worker_prepare_disks () inform "Partitions and filesystems made successfully" # TODO: fstab? auto-add to fstab with libs? auto mkdir's on target_dir? - true } worker_package_list () @@ -91,13 +90,13 @@ worker_package_list () var_TARGET_GROUPS=$TARGET_GROUPS var_TARGET_PACKAGES_EXCLUDE=$TARGET_PACKAGES_EXCLUDE [ -z "$var_TARGET_PACKAGES" -a -z "$var_TARGET_GROUPS" ] && var_TARGET_GROUPS=base + true } worker_install_packages () { - target_prepare_pacman core extra community - installpkg + target_prepare_pacman core extra community && installpkg } @@ -110,11 +109,11 @@ worker_set_clock () worker_install_bootloader () { - get_grub_map - grub-install $var_GRUB_DEVICE --root-directory=/mnt + get_grub_map || return 1 + grub-install $var_GRUB_DEVICE --root-directory=/mnt || return 1 # check if we have a seperate bootdev (/boot) # ToDo: This is double-work, find a better place! # See comment in generate_grub_menulst and interactive_grub bootdev=$(mount | grep $var_TARGET_DIR/boot | cut -d' ' -f 1) - generate_grub_menulst + generate_grub_menulst || return 1 } diff --git a/src/core/procedures/base b/src/core/procedures/base index 432a9f3..ec38f51 100644 --- a/src/core/procedures/base +++ b/src/core/procedures/base @@ -44,6 +44,7 @@ worker_intro () then die_error "User aborted base profile execution" fi + true } @@ -81,8 +82,12 @@ worker_runtime_repositories () do repo=${var_RUNTIME_REPOSITORIES[$(($i*2))]} location=${var_RUNTIME_REPOSITORIES[$(($i*2+1))]} - list_pacman_repos runtime | grep -q $repo || add_pacman_repo runtime $repo "$location" + if ! list_pacman_repos runtime | grep -q $repo + then + add_pacman_repo runtime $repo "$location" || return 1 + fi done + return 0 } @@ -90,8 +95,9 @@ worker_runtime_packages () { for pkg in $var_RUNTIME_PACKAGES do - $PACMAN -Sy --noconfirm --needed $pkg + $PACMAN -Sy --noconfirm --needed $pkg || return 1 done + return 0 } @@ -103,10 +109,16 @@ worker_set_clock () "1" "Select region and timezone" \ "2" "Set time and date" \ "3" "Return to Main Menu" || return 1 - [ "$ANSWER_OPTION" = 1 ] && execute worker interactive_timezone && default=2 - [ "$ANSWER_OPTION" = 2 ] && check_depend worker interactive_timezone && execute worker interactive_time && default=3 - [ "$ANSWER_OPTION" = 3 ] && break + case $ANSWER_OPTION in + "1") execute worker interactive_timezone && default=2 || return 1 ;; + "2") if check_depend worker interactive_timezone + then + execute worker interactive_time && default=3 || return 1 + fi ;; + "3") break ;; + esac done + return 0 } @@ -124,8 +136,7 @@ worker_interactive_time () worker_prepare_disks () { - partition # use lib-archboot function by default - get_possible_fs + partition && get_possible_fs # in official installer: autoprepare or diy first partitions, then mountpoints } @@ -139,14 +150,12 @@ worker_package_list () worker_install_packages () { - target_prepare_pacman core - installpkg + target_prepare_pacman core && installpkg } worker_configure_system () { - preconfigure_target - postconfigure_target + preconfigure_target && postconfigure_target } diff --git a/src/core/procedures/interactive b/src/core/procedures/interactive index 40021ef..0148389 100644 --- a/src/core/procedures/interactive +++ b/src/core/procedures/interactive @@ -86,8 +86,7 @@ worker_configure_system() worker_prepare_disks() { - get_possible_fs - interactive_prepare_disks + get_possible_fs && interactive_prepare_disks } @@ -111,9 +110,11 @@ select_source_extras_menu () "1" "${workertitles['runtime_network']}" \ "2" "Select mirror" \ "3" "Return to Main Menu" || return 1 - [ "$ANSWER_OPTION" = 1 ] && execute worker runtime_network && default=2 - [ "$ANSWER_OPTION" = 2 ] && interactive_select_mirror && default=3 - [ "$ANSWER_OPTION" = 3 ] && break + case $ANSWER_OPTION in + "1") execute worker runtime_network && default=2 || return 1 ;; + "2") interactive_select_mirror && default=3 || return 1 ;; + "3") break ;; + esac done return 0 } -- cgit v1.2.3-54-g00ecf