3 # User questions are seperated into functions to be reused in alternative installers
6 # check if the install session is GUI or cli
8 if [ -e /opt/noguimode ]; then
12 if [ -n "$GUIMODE" ]; then
19 # add installation info to summary
25 # set status wallpaper
27 guimode && feh --bg-scale /usr/share/liveutils/$1.jpg &
30 # ask for keyboard layout
32 cd /root/instantARCH/data/lang/keyboard
33 while [ -z "$NEWKEY" ]; do
35 NEWKEY="$(ls | imenu -l 'Select keyboard layout ')"
37 # allow directly typing in layout name
38 if [ "$NEWKEY" = "other" ]; then
39 OTHERKEY="$(localectl list-x11-keymap-layouts | imenu -l 'select keyboard layout ')"
41 if [ -z "$OTHERKEY" ]; then
44 # newline is intentional!!!
46 $OTHERKEY" >/root/instantARCH/data/lang/keyboard/other
51 # option to cancel the installer
52 if [ "${NEWKEY}" = "forcequit" ]; then
55 iroot keyboard "$NEWKEY"
58 # ask for default locale
60 cd /root/instantARCH/data/lang/locale
61 while [ -z "$NEWLOCALE" ]; do
62 NEWLOCALE="$(ls | imenu -l 'Select language> ')"
64 iroot locale "$NEWLOCALE"
68 # ask for region with region/city
70 cd /usr/share/zoneinfo
71 while [ -z "$REGION" ]; do
72 REGION=$(ls | imenu -l "select region ")
75 if [ -d "$REGION" ]; then
77 while [ -z "$CITY" ]; do
78 CITY=$(ls | imenu -l "select the City nearest to you ")
82 [ -n "$CITY" ] && iroot city "$CITY"
86 # choose between different nvidia drivers
88 if lspci | grep -iq 'nvidia'; then
89 echo "nvidia card detected"
90 while [ -z "$DRIVERCHOICE" ]; do
91 DRIVERCHOICE="$(echo 'nvidia proprietary (recommended)
92 nvidia-dkms (try if proprietary does not work)
94 install without graphics drivers (not recommended)' | imenu -l 'select graphics drivers')"
96 if grep -q "without" <<<"$DRIVERCHOICE"; then
97 if ! echo "are you sure you do not want to install graphics drivers?
98 This could prevent the system from booting" | imenu -C; then
105 if grep -qi "dkms" <<<"$DRIVERCHOICE"; then
106 iroot graphics "dkms"
107 elif grep -qi "nvidia" <<<"$DRIVERCHOICE"; then
108 iroot graphics "nvidia"
109 elif grep -qi "open" <<<"$DRIVERCHOICE"; then
110 iroot graphics "open"
111 elif [ -z "$DRIVERCHOICE" ]; then
112 iroot graphics "nodriver"
116 echo "no nvidia card detected"
121 # offer to choose mirror country
123 curl -s 'https://www.archlinux.org/mirrorlist/' | grep -i '<option value' >/tmp/mirrors.html
124 grep -v '>All<' /tmp/mirrors.html | sed 's/.*<option value=".*">\(.*\)<\/option>.*/\1/g' |
125 sed -e "1iauto detect mirrors" |
126 imenu -l "choose mirror location" >/tmp/mirrorselect
127 if ! grep -q 'auto detect' </tmp/mirrorselect; then
128 cat /tmp/mirrors.html | grep ">$(cat /tmp/mirrorselect)<" | grep -o '".*"' | grep -o '[^"]*' >/tmp/countrycode
129 echo "fetching mirrors for $(cat /tmp/mirrorselect)"
130 curl -s "https://www.archlinux.org/mirrorlist/?country=$(cat /tmp/countrycode)&protocol=http&protocol=https&ip_version=4" |
131 sed 's/^#Server /Server /g' >/tmp/mirrorlist
132 cat /etc/pacman.d/mirrorlist >/tmp/oldmirrorlist
134 cat /tmp/mirrorlist >/etc/pacman.d/mirrorlist
135 cat /tmp/oldmirrorlist >>/etc/pacman.d/mirrorlist
137 echo "ranking mirrors"
138 reflector --latest 40 --protocol http --protocol https --sort rate --save /etc/pacman.d/mirrorlist
142 # ask for user details
144 while [ -z $NEWUSER ]; do
146 NEWUSER="$(imenu -i 'set username')"
148 # validate input as a unix name
149 if ! grep -Eq '^[a-z_]([a-z0-9_-]{0,31}|[a-z0-9_-]{0,30}\$)$' <<<"$NEWUSER"; then
150 imenu -m "invalid username"
155 while ! [ "$NEWPASS" = "$NEWPASS2" ] || [ -z "$NEWPASS" ]; do
156 NEWPASS="$(imenu -P 'set password')"
157 NEWPASS2="$(imenu -P 'confirm password')"
160 iroot user "$NEWUSER"
161 iroot password "$NEWPASS"