diff --git a/gentoo-install.sh b/gentoo-install.sh index bf13a67..bcf8650 100755 --- a/gentoo-install.sh +++ b/gentoo-install.sh @@ -42,6 +42,14 @@ function show_help() { exit 0 } +function errormsg() { + local err=$1 + shift + + echo "$*" >&2 + exit "$err" +} + function prepare_disk() { if [[ "$DEBUG" ]]; then local cmd="echo" @@ -228,13 +236,13 @@ function stage_step() { #FIXME check $INSTALL_STAGE for http or local file if [[ "$INSTALL_STAGE" == http* ]]; then s4file="${INSTALL_STAGE##*/}" - ${cmd} curl -O "/mnt/gentoo/${s4file}" "$INSTALL_STAGE" + ${cmd} curl -O "/mnt/gentoo/${s4file}" "$INSTALL_STAGE" || errormsg 1 "Failed to download stage4 archive" s4file="/mnt/gentoo/${INSTALL_STAGE##*/}" else s4file="${INSTALL_STAGE}" fi - ${cmd} git clone "https://github.com/erenfro/gen2stage4" "$HOME/gen2stage4" + ${cmd} git clone "https://github.com/erenfro/gen2stage4" "$HOME/gen2stage4" || errormsg 1 "Failed to download gen2stage4" ${cmd} "$HOME/gen2stage4/gen2stage4" -q -t /mnt/gentoo "$s4file" ${cmd} rm -rf "$HOME/gen2stage4"