messagebox "welcome to instantARCH, the easy arch installer"
-cd /root/instantARCH/data/lang/keyboard
-while [ -z "$NEWKEY" ]; do
- NEWKEY="$(ls | fzf --prompt 'Select keyboard layout> ')"
-done
+# go back to the beginning if user isn't happy with settings
+while ! [ -e /root/instantARCH/config/confirm ]; do
+ cd /root/instantARCH/data/lang/keyboard
+ while [ -z "$NEWKEY" ]; do
+ NEWKEY="$(ls | fzf --prompt 'Select keyboard layout> ')"
+ done
-echo "$NEWKEY" >/root/instantARCH/config/keyboard
+ echo "$NEWKEY" >/root/instantARCH/config/keyboard
-loadkeys $(tail -1 /root/instantARCH/data/lang/keyboard/"$NEWKEY")
+ loadkeys $(tail -1 /root/instantARCH/data/lang/keyboard/"$NEWKEY")
-cd ../locale
-while [ -z "$NEWLOCALE" ]; do
- NEWLOCALE="$(ls | fzf --prompt 'Select language> ')"
-done
-echo "$NEWLOCALE" >/root/instantARCH/config/locale
+ cd ../locale
+ while [ -z "$NEWLOCALE" ]; do
+ NEWLOCALE="$(ls | fzf --prompt 'Select language> ')"
+ done
+ echo "$NEWLOCALE" >/root/instantARCH/config/locale
-cd /usr/share/zoneinfo
+ cd /usr/share/zoneinfo
-while [ -z "$REGION" ]; do
- REGION=$(ls | fzf --prompt "select region> ")
-done
+ while [ -z "$REGION" ]; do
+ REGION=$(ls | fzf --prompt "select region> ")
+ done
+
+ if [ -d "$REGION" ]; then
+ cd "$REGION"
+ while [ -z "$CITY" ]; do
+ CITY=$(ls | fzf --prompt "select the City nearest to you> ")
+ done
+ fi
-if [ -d "$REGION" ]; then
- cd "$REGION"
- while [ -z "$CITY" ]; do
- CITY=$(ls | fzf --prompt "select the City nearest to you> ")
+ echo "$REGION" >/root/instantARCH/config/region
+ [ -n "$CITY" ] echo "$CITY" >/root/instantARCH/config/city
+
+ while [ -z "$DISK" ]; do
+ DISK=$(fdisk -l | grep -i '^Disk /.*:' | fzf --prompt "select disk> ")
+ if ! confirm "Install on $DISK ?\n this will delete all existing data"; then
+ unset DISK
+ fi
done
-fi
-echo "$REGION" >/root/instantARCH/config/region
-[ -n "$CITY" ] echo "$CITY" >/root/instantARCH/config/city
+ echo "$DISK" | grep -o '/dev/[^:]*' >/root/instantARCH/config/disk
-while [ -z "$DISK" ]; do
- DISK=$(fdisk -l | grep -i '^Disk /.*:' | fzf --prompt "select disk> ")
- if ! confirm "Install on $DISK ?\n this will delete all existing data"; then
- unset DISK
- fi
-done
+ NEWUSER="$(textbox 'set username')"
-echo "$DISK" | grep -o '/dev/[^:]*' >/root/instantARCH/config/disk
+ while ! [ "$NEWPASS" = "$NEWPASS2" ] || [ -z "$NEWPASS" ]; do
+ NEWPASS="$(passwordbox 'set password')"
+ NEWPASS2="$(passwordbox 'confirm password')"
+ done
-NEWUSER="$(textbox 'set username')"
+ echo "$NEWUSER" >/root/instantARCH/config/user
+ echo "$NEWPASS" >/root/instantARCH/config/password
-while ! [ "$NEWPASS" = "$NEWPASS2" ] || [ -z "$NEWPASS" ]; do
- NEWPASS="$(passwordbox 'set password')"
- NEWPASS2="$(passwordbox 'confirm password')"
-done
+ while [ -z "$NEWHOSTNAME" ]; do
+ NEWHOSTNAME=$(textbox "enter name of this computer")
+ done
-echo "$NEWUSER" >/root/instantARCH/config/user
-echo "$NEWPASS" >/root/instantARCH/config/password
+ echo "$NEWHOSTNAME" >/root/instantARCH/config/hostname
-while [ -z "$NEWHOSTNAME" ]; do
- NEWHOSTNAME=$(textbox "enter name of this computer")
-done
+ SUMMARY="Installation Summary:"
-echo "$NEWHOSTNAME" >/root/instantARCH/config/hostname
+ addsum() {
+ SUMMARY="$SUMMARY
+ $1: $(cat /root/instantARCH/config/$2)"
+ }
+
+ addsum "Username" "user"
+ addsum "Locale" "locale"
+ addsum "Region" "region"
+ addsum "Nearest City" "city"
+ addsum "Keyboard layout" "keyboard"
+ addsum "Target install drive" "disk"
+ addsum "Hostname" "hostname"
+ SUMMARY="$SUMMARY
+Should installation proceed with the following parameters?"
+
+ if confirm "$SUMMARY"; then
+ touch /root/instantARCH/config/confirm
+ fi
+done
-messagebox "arch linux will now install. this could take a while. "
+messagebox "The installation will now begin. this could take a while. "