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&use_mirror_status=on" |
131 grep -iE '(Server|generated)' |
132 sed 's/^#Server /Server /g' >/tmp/mirrorlist
133 cat /etc/pacman.d/mirrorlist >/tmp/oldmirrorlist
135 if echo "would you like to sort mirrors by speed? (recommended)" | imenu -C; then
136 touch /tmp/sortmirrors
139 if [ -e /tmp/sortmirrors ]; then
140 cat /tmp/mirrorlist | head -20 >/tmp/mirrorlist2
141 rankmirrors -n 6 /tmp/mirrorlist2 >/tmp/topmirrors
142 touch /tmp/mirrorcontinue
145 touch /tmp/mirrorcontinue
148 while ! [ -e /tmp/mirrorcontinue ]; do
149 imenu -m "sorting mirrors, please wait"
152 rm /tmp/mirrorcontinue
155 if [ -e /tmp/topmirrors ]; then
156 echo "" >/etc/pacman.d/mirrorlist
160 cat /tmp/topmirrors >/etc/pacman.d/mirrorlist
163 cat /tmp/mirrorlist >>/etc/pacman.d/mirrorlist
164 cat /tmp/oldmirrorlist >>/etc/pacman.d/mirrorlist
166 echo "ranking mirrors"
167 reflector --latest 40 --protocol http --protocol https --sort rate --save /etc/pacman.d/mirrorlist
172 # ask for user details
174 while [ -z $NEWUSER ]; do
176 NEWUSER="$(imenu -i 'set username')"
178 # validate input as a unix name
179 if ! grep -Eq '^[a-z_]([a-z0-9_-]{0,31}|[a-z0-9_-]{0,30}\$)$' <<<"$NEWUSER"; then
180 imenu -m "invalid username"
185 while ! [ "$NEWPASS" = "$NEWPASS2" ] || [ -z "$NEWPASS" ]; do
186 NEWPASS="$(imenu -P 'set password')"
187 NEWPASS2="$(imenu -P 'confirm password')"
190 iroot user "$NEWUSER"
191 iroot password "$NEWPASS"
195 # ask about which hypervisor is used
197 if imvirt | grep -iq 'physical'; then
198 echo "system does not appear to be a virtual machine"
202 while [ -z "$VIRTCONFIRM" ]; do
203 if ! imenu -c "is this system a virtual machine?"; then
204 if echo "Are you sure it's not?
205 giving the wrong answer here might greatly decrease performance. " | imenu -C; then
216 other" | imenu -l "which hypervisor is being used?" >/tmp/vmtype
218 HYPERVISOR="$(cat /tmp/vmtype)"
219 case "$HYPERVISOR" in
221 if grep 'vendor' /proc/cpuinfo | grep -iq 'AMD'; then
223 kvm/QEMU on AMD is not meant for desktop use and
224 is lacking some graphics features.
225 This installation will work, but some features will have to be disabled and
226 others might not perform well.
227 It is highly recommended to use Virtualbox instead." | imenu -M
229 if lshw -c video | grep -iq 'qxl'; then
231 QXL graphics detected
232 These may trigger a severe Xorg memory leak on kvm/QEMU on AMD,
233 leading to degraded video and input performance,
234 please switch your video card to either virtio or passthrough
235 until this is fixed" | imenu -M
244 echo "selecting other"