Move to 'source' and own return value variable

This commit is contained in:
maride 2017-08-31 16:27:55 +02:00
parent ba1e4bff49
commit 51af650e99
6 changed files with 25 additions and 28 deletions

View File

@ -4,9 +4,9 @@ ping -c 1 archlinux.org 2>/tmp/arch-maride-flavour_checks_internet_error.log 1>/
return=$? return=$?
if [ "$return" -eq 0 ]; then if [ "$return" -eq 0 ]; then
exit 0 amf_return=0
else else
echo "~> Either internet is unavailable or archlinux.org is down..." echo "~> Either internet is unavailable or archlinux.org is down..."
echo "~> (ping returned $return. Maybe check the logs in /tmp." echo "~> (ping returned $return. Maybe check the logs in /tmp."
exit 1 amf_return=1
fi fi

View File

@ -2,15 +2,15 @@
if [ "$bootloader" == "EFI" ]; then if [ "$bootloader" == "EFI" ]; then
echo "~> Not an EFI host, not checking for EFI." echo "~> Not an EFI host, not checking for EFI."
exit 0 amf_return=0
fi fi
ls /sys/firmware/efi/efivars 2>/tmp/arch-maride-flavour_checks_uefi_error.log 1>/tmp/arch-maride-flavour_checks_uefi_out.log ls /sys/firmware/efi/efivars 2>/tmp/arch-maride-flavour_checks_uefi_error.log 1>/tmp/arch-maride-flavour_checks_uefi_out.log
return=$? return=$?
if [ "$return" -eq 0 ]; then if [ "$return" -eq 0 ]; then
exit 0 amf_return=0
else else
echo "~> This doesn't seem to be an UEFI boot. Please boot UEFI." echo "~> This doesn't seem to be an UEFI boot. Please boot UEFI."
exit 1 amf_return=1
fi fi

View File

@ -37,8 +37,7 @@ for check in checks/*.check
do do
echo "=> Running check '$check'..." echo "=> Running check '$check'..."
$check $check
return=$? if [ "$amf_return" -ne 0 ]; then
if [ "$return" -ne 0 ]; then
echo "=> Check failed. Fix it, maybe." echo "=> Check failed. Fix it, maybe."
exit exit
fi fi
@ -47,9 +46,8 @@ done
for step in steps/*.step for step in steps/*.step
do do
echo "=> Running step '$step'..." echo "=> Running step '$step'..."
$step source $step
return=$? if [ "$amf_return" -ne 0 ]; then
if [ "$return" -ne 0 ]; then
echo "=> Step failed. That is weird. Sorry. Check logs maybe." echo "=> Step failed. That is weird. Sorry. Check logs maybe."
exit exit
fi fi
@ -63,9 +61,8 @@ do
if [ "$answer" == "y" ] || [ "$answer" == "Y" ]; then if [ "$answer" == "y" ] || [ "$answer" == "Y" ]; then
echo "=> Running flavour '$flavour'..." echo "=> Running flavour '$flavour'..."
pushd $flavour pushd $flavour
./install.sh source install.sh
return=$? if [ "$amf_return" -ne 0 ]; then
if [ "$return" -ne 0 ]; then
echo "=> Flavour failed. :(" echo "=> Flavour failed. :("
fi fi
popd popd

View File

@ -5,16 +5,16 @@ echo -n "~> Wipe block device? (Y/n) "
read answer read answer
if [ "$answer" == "n" ] || [ "$answer" == "N" ]; then if [ "$answer" == "n" ] || [ "$answer" == "N" ]; then
exit 0 amf_return=0
fi else
echo -n "~> You sure? (y/N) " echo -n "~> You sure? (y/N) "
read answer read answer
if [ "$answer" == "y" ] || [ "$answer" == "Y" ]; then if [ "$answer" == "y" ] || [ "$answer" == "Y" ]; then
echo "~> OK. Be patient now, that could take some time..." echo "~> OK. Be patient now, that could take some time..."
dd if=/dev/zero of=$blockdevice status=progress dd if=/dev/zero of=$blockdevice status=progress
exit 0 amf_return=0
else else
exit 1 amf_return=1
fi
fi fi

View File

@ -8,8 +8,8 @@ echo -e "g\nn\n1\n2048\n+300M\nn\n2\n\n\np\nw" | fdisk $blockdevice
if [ "$?" -eq 0 ]; then if [ "$?" -eq 0 ]; then
echo "~> Seems to have worked. Yay!" echo "~> Seems to have worked. Yay!"
exit 0 amf_return=0
else else
echo "~> Failed. :(" echo "~> Failed. :("
exit 1 amf_return=1
fi fi

View File

@ -7,12 +7,12 @@ echo -n "~> Do you want to create an user account? (Y/n) "
read answer read answer
if [ "$answer" == "n" ] || [ "$answer" == "N" ]; then if [ "$answer" == "n" ] || [ "$answer" == "N" ]; then
exit 0 amf_return=0
else else
echo -n " Name of your new user? " echo -n " Name of your new user? "
read name read name
export username=$name export username=$name
arch-chroot /mnt useradd -m $name arch-chroot /mnt useradd -m $name
arch-chroot /mnt passwd $name arch-chroot /mnt passwd $name
exit 0 amf_return=0
fi fi