summaryrefslogtreecommitdiffstats
path: root/src/cmd/install.sh
diff options
context:
space:
mode:
authorP. J. McDermott <pj@pehjota.net>2016-01-17 16:10:31 (EST)
committer P. J. McDermott <pj@pehjota.net>2016-01-17 16:10:31 (EST)
commit09c583248e7c0aa5a833ec01262b8b4a7980234b (patch)
treee3ecd4028e888d6eb587d9703ace4d90396a624a /src/cmd/install.sh
parentd5e46c35ea98e43b6ad380ac7fbc197b7881b220 (diff)
parente3ab87a78aafd979f6eb8bb75ef70304d87a1d6b (diff)
Merge branch 'feature/improve-error-handling'
Diffstat (limited to 'src/cmd/install.sh')
-rw-r--r--src/cmd/install.sh23
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()