3 mkdir /root/instantARCH/config
6 source <(curl -Ls git.io/paperbash)
9 if [ -e /usr/share/liveutils ]; then
10 echo "GUI Mode active"
15 # check if the install session is GUI or cli
17 if [ -e /opt/noguimode ]; then
21 if [ -n "$GUIMODE" ]; then
29 pgrep instantmenu && pkill instantmenu
30 imenu -m "Welcome to the instantOS installer"
32 messagebox "Welcome to the instantOS installer"
35 # go back to the beginning if user isn't happy with settings
36 while ! [ -e /root/instantARCH/config/confirm ]; do
37 cd /root/instantARCH/data/lang/keyboard
38 while [ -z "$NEWKEY" ]; do
40 feh --bg-scale /usr/share/liveutils/worldmap.jpg &
41 NEWKEY="$(ls | imenu -l 'Select keyboard layout')"
43 NEWKEY="$(ls | fzf --prompt 'Select keyboard layout> ')"
46 # allow directly typing in layout name
47 if [ "$NEWKEY" = "other" ]; then
49 OTHERKEY="$(localectl list-x11-keymap-layouts | instantmenu -l 20 -c -p 'select keyboard layout')"
51 OTHERKEY="$(localectl list-x11-keymap-layouts | fzf --prompt 'select keyboard layout')"
54 if [ -z "$OTHERKEY" ]; then
58 $OTHERKEY" >/root/instantARCH/data/lang/keyboard/other
64 # option to cancel the installer
65 if [ "${NEWKEY}" = "forcequit" ]; then
69 echo "$NEWKEY" >/root/instantARCH/config/keyboard
71 if head -1 /root/instantARCH/data/lang/keyboard/"$NEWKEY" | greo -q '[^ ][^ ]'; then
72 loadkeys $(head -1 /root/instantARCH/data/lang/keyboard/"$NEWKEY")
75 guimode && setxkbmap -layout $(tail -1 /root/instantARCH/data/lang/keyboard/"$NEWKEY")
78 while [ -z "$NEWLOCALE" ]; do
80 NEWLOCALE="$(ls | imenu -l 'Select language> ')"
82 NEWLOCALE="$(ls | fzf --prompt 'Select language> ')"
86 echo "$NEWLOCALE" >/root/instantARCH/config/locale
88 cd /usr/share/zoneinfo
90 while [ -z "$REGION" ]; do
92 REGION=$(ls | imenu -l "select region")
94 REGION=$(ls | fzf --prompt "select region> ")
98 if [ -d "$REGION" ]; then
100 while [ -z "$CITY" ]; do
102 CITY=$(ls | imenu -l "select the City nearest to you")
104 CITY=$(ls | fzf --prompt "select the City nearest to you> ")
109 echo "$REGION" >/root/instantARCH/config/region
110 [ -n "$CITY" ] && echo "$CITY" >/root/instantARCH/config/city
112 while [ -z "$DISK" ]; do
114 feh --bg-scale /usr/share/liveutils/install.jpg &
115 DISK=$(fdisk -l | grep -i '^Disk /.*:' | imenu -l "select disk> ")
116 if ! echo "Install on $DISK ?
117 this will delete all existing data" | imenu -C; then
121 DISK=$(fdisk -l | grep -i '^Disk /.*:' | fzf --prompt "select disk> ")
122 if ! confirm "Install on $DISK ?\n this will delete all existing data"; then
128 echo "$DISK" | grep -o '/dev/[^:]*' >/root/instantARCH/config/disk
131 if lspci | grep -iq 'nvidia'; then
132 echo "nvidia card detected"
133 while [ -z "$DRIVERCHOICE" ]; do
135 DRIVERCHOICE="$(echo 'nvidia proprietary (recommended)
136 nvidia-dkms (try if proprietary doesn't work)
138 install without graphics drivers (not recommended)' | imenu -l 'select graphics drivers')"
140 if grep -q "without" <<<"$DRIVERCHOICE"; then
141 if ! echo "are you sure you do not want to install graphics drivers?
142 This could prevent the system from booting" | imenu -C; then
148 while [ -z "$DRIVERCHOICE" ]; do
149 while [ -z "$DRIVERCHOICE" ]; do
150 DRIVERCHOICE="$(echo 'nvidia proprietary (recommended)
151 nvidia-dkms (try if proprietary doesn't work)
153 install without graphics (not recommended)' | fzf --prompt 'select graphics drivers')"
157 if grep -q "without" <<<"$DRIVERCHOICE"; then
158 if ! confirm "are you sure you do not want to install graphics drivers?
159 This could prevent the system from booting"; then
168 if grep -qi "dkms" <<<"$DRIVERCHOICE"; then
169 echo "dkms" >/root/instantARCH/config/graphics
170 elif grep -qi "nvidia" <<<"$DRIVERCHOICE"; then
171 echo "nvidia" >/root/instantARCH/config/graphics
172 elif grep -qi "open" <<<"$DRIVERCHOICE"; then
173 echo "open" >/root/instantARCH/config/graphics
174 elif [ -z "$DRIVERCHOICE" ]; then
175 echo "nodriver" >/root/instantARCH/config/graphics
179 echo "no nvidia card detected"
182 while [ -z $NEWUSER ]; do
184 feh --bg-scale /usr/share/liveutils/user.jpg &
185 NEWUSER="$(imenu -i 'set username')"
187 NEWUSER="$(textbox 'set username')"
190 # validate input as a unix name
191 if ! grep -Eq '^[a-z_]([a-z0-9_-]{0,31}|[a-z0-9_-]{0,30}\$)$' <<<"$NEWUSER"; then
193 imenu -m "invalid username"
195 msgbox "invalid username"
201 while ! [ "$NEWPASS" = "$NEWPASS2" ] || [ -z "$NEWPASS" ]; do
203 NEWPASS="$(imenu -P 'set password')"
204 NEWPASS2="$(imenu -P 'confirm password')"
206 NEWPASS="$(passwordbox 'set password')"
207 NEWPASS2="$(passwordbox 'confirm password')"
211 echo "$NEWUSER" >/root/instantARCH/config/user
212 echo "$NEWPASS" >/root/instantARCH/config/password
214 while [ -z "$NEWHOSTNAME" ]; do
216 NEWHOSTNAME=$(imenu -i "enter name of this computer")
218 NEWHOSTNAME=$(textbox "enter name of this computer")
222 echo "$NEWHOSTNAME" >/root/instantARCH/config/hostname
224 guimode && feh --bg-scale /usr/share/liveutils/install.jpg &
225 SUMMARY="Installation Summary:"
229 $1: $(cat /root/instantARCH/config/$2)"
232 addsum "Username" "user"
233 addsum "Locale" "locale"
234 addsum "Region" "region"
235 addsum "Nearest City" "city"
236 addsum "Keyboard layout" "keyboard"
237 addsum "Target install drive" "disk"
238 addsum "Hostname" "hostname"
249 Should installation proceed with these parameters?"
252 if imenu -C <<<"$SUMMARY"; then
253 touch /root/instantARCH/config/confirm
266 if confirm "$SUMMARY"; then
267 touch /root/instantARCH/config/confirm
283 imenu -M <<<"The installation will now begin.
284 This could take a while.
285 Keep the machine powered and connected to the internet" &
287 messagebox "The installation will now begin. This could take a while. Keep the machine powered and connected to the internet"