Update installer for error checking and halting
This commit is contained in:
parent
d5bcff89bf
commit
37b090d23c
1 changed files with 10 additions and 2 deletions
|
@ -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"
|
||||
|
||||
|
|
Loading…
Reference in a new issue