diff options
Diffstat (limited to 'src/cmd/install.sh')
-rw-r--r-- | src/cmd/install.sh | 23 |
1 files changed, 16 insertions, 7 deletions
diff --git a/src/cmd/install.sh b/src/cmd/install.sh index ae26588..d32f488 100644 --- a/src/cmd/install.sh +++ b/src/cmd/install.sh @@ -30,13 +30,13 @@ cmd_install_main() if ! get_options "${@}"; then print_cmd_usage 'install' >&2 - exit 1 + return 1 fi shift $(($OPTIND - 1)) if [ ${#} -lt 2 ]; then print_cmd_usage 'install' >&2 - exit 1 + return 1 fi # TODO: Consider making suite optional, getting a default suite from the @@ -50,7 +50,9 @@ cmd_install_main() else profile='proteanos' fi - profile_set "${profile}" + if ! profile_set "${profile}"; then + return 2 + fi suite="$(profile_normalize_suite "${suite}")" if [ "x${cmd_install_opt_F+set}" = 'xset' ]; then @@ -62,14 +64,21 @@ cmd_install_main() dev='' if is_block "${root}"; then dev="${root}" - root="$(block_mount "${dev}")" + if ! root="$(block_mount "${dev}")"; then + return 2 + fi fi - install_system "${cmd_install_opt_m-}" "${suite}" \ - "${cmd_install_opt_a-}" "${cmd_install_opt_p-}" \ - "${root}" "${foreign}" + if ! install_system "${cmd_install_opt_m-}" "${suite}" \ + "${cmd_install_opt_a-}" "${cmd_install_opt_p-}" \ + "${root}" "${foreign}"; then + [ "x${dev}" != 'x' ] && block_umount "${root}" + return 1 + fi [ "x${dev}" != 'x' ] && block_umount "${root}" + + return 0 } cmd_install_register() |