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=$?
if [ "$return" -eq 0 ]; then
exit 0
amf_return=0
else
echo "~> Either internet is unavailable or archlinux.org is down..."
echo "~> (ping returned $return. Maybe check the logs in /tmp."
exit 1
amf_return=1
fi

View File

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

View File

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

View File

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

View File

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