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 [ -z "$INSTANTARCH" ]; then
9 echo "defaulting instantarch location to /root/instantARCH"
10 INSTANTARCH="/root/instantARCH"
14 if [ -e /opt/noguimode ]; then
18 if [ -n "$GUIMODE" ]; then
25 # add installation info to summary
31 # set status wallpaper
33 guimode && feh --bg-scale /usr/share/liveutils/$1.jpg &
37 if command -v systemctl; then
38 echo "regular arch/manjaro detected"
42 echo "You appear to be installing the non-systemd version of instantOS.
43 Support for non-systemd setups is experimental
44 Any issues should be solvable with manual intervention
45 Here's a list of things that do not work from the installer and how to work around them:
46 disk editor: set up partitions beforehand or use automatic partitioning
47 keyboard locale: set it manually after installation in the settings
48 systemd-swap (obviously)" | imenu -M
52 # ask for keyboard layout
54 cd "$INSTANTARCH"/data/lang/keyboard
55 while [ -z "$NEWKEY" ]; do
57 NEWKEY="$(ls | imenu -l 'Select keyboard layout ')"
59 # allow directly typing in layout name
60 if [ "$NEWKEY" = "other" ]; then
61 if command -v localectl; then
62 OTHERKEY="$(localectl list-x11-keymap-layouts | imenu -l 'select keyboard layout ')"
64 if [ -z "$OTHERKEY" ]; then
67 # newline is intentional!!!
69 $OTHERKEY" >/root/instantARCH/data/lang/keyboard/other
72 imenu -m "not supported yet without systemd"
79 # option to cancel the installer
80 if [ "${NEWKEY}" = "forcequit" ]; then
83 iroot keyboard "$NEWKEY"
86 # ask for default locale
88 cd "$INSTANTARCH"/data/lang/locale
89 while [ -z "$NEWLOCALE" ]; do
90 NEWLOCALE="$(ls | imenu -l 'Select language> ')"
92 iroot locale "$NEWLOCALE"
96 # ask for region with region/city
98 cd /usr/share/zoneinfo
99 while [ -z "$REGION" ]; do
100 REGION=$(ls | imenu -l "select region ")
103 if [ -d "$REGION" ]; then
105 while [ -z "$CITY" ]; do
106 CITY=$(ls | imenu -l "select the City nearest to you ")
110 iroot region "$REGION"
111 [ -n "$CITY" ] && iroot city "$CITY"
115 # choose between different nvidia drivers
117 if lspci | grep -iq 'nvidia'; then
118 echo "nvidia card detected"
119 while [ -z "$DRIVERCHOICE" ]; do
120 DRIVERCHOICE="$(echo 'nvidia proprietary (recommended)
121 nvidia-dkms (try if proprietary does not work)
123 install without graphics drivers (not recommended)' | imenu -l 'select graphics drivers')"
125 if grep -q "without" <<<"$DRIVERCHOICE"; then
126 if ! echo "are you sure you do not want to install graphics drivers?
127 This could prevent the system from booting" | imenu -C; then
134 if grep -qi "dkms" <<<"$DRIVERCHOICE"; then
135 iroot graphics "dkms"
136 elif grep -qi "nvidia" <<<"$DRIVERCHOICE"; then
137 iroot graphics "nvidia"
138 elif grep -qi "open" <<<"$DRIVERCHOICE"; then
139 iroot graphics "open"
140 elif [ -z "$DRIVERCHOICE" ]; then
141 iroot graphics "nodriver"
145 echo "no nvidia card detected"
150 # offer to choose mirror country
154 echo 'auto detect mirrors (not recommended for speed)'
155 curl -s 'https://archlinux.org/mirrorlist/all/' | grep '##' | grep -iEv '(linux|arch|generated|filter)' |
156 grep -o '[^# ]*' | grep '.....'
157 } | imenu -l 'select mirror location')"
159 if grep -q 'auto detect' <<<"$MIRRORCODE"; then
162 iroot countrycode "$MIRRORCODE"
163 if echo '> manually sorting mirrors may take a long time
164 use arch ranking score (recommended)
165 sort all mirrors by speed' | imenu -l 'choose mirror settings' | grep -q 'speed'; then
171 # ask for user details
173 while [ -z "$NEWUSER" ]; do
175 NEWUSER="$(imenu -i 'set username')"
177 # validate input as a unix name
178 if ! grep -Eq '^[a-z_]([a-z0-9_-]{0,31}|[a-z0-9_-]{0,30}\$)$' <<<"$NEWUSER"; then
179 imenu -e "invalid username, usernames must not contain spaces or special symbols and start with a lowercase letter"
184 while ! [ "$NEWPASS" = "$NEWPASS2" ] || [ -z "$NEWPASS" ]; do
185 NEWPASS="$(imenu -P 'set password')"
186 NEWPASS2="$(imenu -P 'confirm password')"
187 if ! [ "$NEWPASS" = "$NEWPASS2" ]; then
188 echo "the confirmation password doesn't match.
189 Please enter a new password" | imenu -M
193 iroot user "$NEWUSER"
194 iroot password "$NEWPASS"
198 # ask about which hypervisor is used
200 if imvirt | grep -iq 'physical'; then
201 echo "system does not appear to be a virtual machine"
205 while [ -z "$VIRTCONFIRM" ]; do
206 if ! imenu -c "is this system a virtual machine?"; then
207 if echo "Are you sure it's not?
208 giving the wrong answer here might greatly decrease performance. " | imenu -C; then
219 other" | imenu -l "which hypervisor is being used?" >/tmp/vmtype
221 HYPERVISOR="$(cat /tmp/vmtype)"
222 case "$HYPERVISOR" in
224 if grep 'vendor' /proc/cpuinfo | grep -iq 'AMD'; then
226 kvm/QEMU on AMD is not meant for desktop use and
227 is lacking some graphics features.
228 This installation will work, but some features will have to be disabled and
229 others might not perform well.
230 It is highly recommended to use Virtualbox instead." | imenu -M
232 if lshw -c video | grep -iq 'qxl'; then
234 QXL graphics detected
235 These may trigger a severe Xorg memory leak on kvm/QEMU on AMD,
236 leading to degraded video and input performance,
237 please switch your video card to either virtio or passthrough
238 until this is fixed" | imenu -M
244 if imenu -c "would you like to install virtualbox guest additions?"; then
245 iroot guestadditions 1
250 echo "selecting other"