OSDN Git Service

fix flatpak opener
[instantos/instantARCH.git] / ask.sh
diff --git a/ask.sh b/ask.sh
index f54e5b0..35dc3ca 100755 (executable)
--- a/ask.sh
+++ b/ask.sh
@@ -15,7 +15,7 @@ pb dialog
 
 source /root/instantARCH/askutils.sh
 
-if [ -e /usr/share/liveutils ]; then
+if [ -e /usr/share/liveutils ] && ! [ -e /tmp/nogui ]; then
     echo "GUI Mode active"
     export GUIMODE="True"
     GUIMODE="True"
@@ -24,42 +24,80 @@ fi
 # switch imenu to fzf and dialog
 if ! guimode; then
     touch /tmp/climenu
+    imenu -m "Welcome to the instantOS installer"
+else
+    NEXTCHOICE="$(echo '>>h              Welcome to the instantOS installer
+:g Next
+:r ﰸCancel' | instantmenu -q 'select using the mouse, keywords and arrow keys' -i -l 209 -h -1 -bw 8 -a 60 -w -1 -c)"
+
+    if grep -iq 'cancel' <<<"$NEXTCHOICE"; then
+        echo "canceling installation"
+        mkdir /opt/instantos
+        touch /opt/instantos/installcanceled
+        touch /opt/instantos/statuscanceled
+        exit 1
+    fi
+    if iroot installtest
+    then
+        imenu -m "WARNING: you're running a test version of the installer"
+    fi
 fi
 
-imenu -m "Welcome to the instantOS installer"
-
 # go back to the beginning if user isn't happy with settings
 # this loop wraps the rest of the installer
 while ! iroot confirm; do
 
+    # warning message for artix
+    artixinfo
+
     # ask for keyboard layout
     asklayout
     if head -1 /root/instantARCH/data/lang/keyboard/"$NEWKEY" | grep -q '[^ ][^ ]'; then
-        loadkeys $(head -1 /root/instantARCH/data/lang/keyboard/"$NEWKEY")
+        loadkeys "$(head -1 /root/instantARCH/data/lang/keyboard/"$NEWKEY")"
     fi
-    guimode && setxkbmap -layout $(tail -1 /root/instantARCH/data/lang/keyboard/"$NEWKEY")
+    guimode && setxkbmap -layout "$(tail -1 /root/instantARCH/data/lang/keyboard/"$NEWKEY")"
 
     asklocale
 
+    # artix and manjaro mirrors work differently
+    if command -v pacstrap; then
+        askmirrors
+    fi
+
+    askvm
     askregion
 
     while [ -z "$DISK" ]; do
         wallstatus install
-        DISK=$(fdisk -l | grep -i '^Disk /.*:' | imenu -l "select disk> ")
-        if ! echo "Install on $DISK ?
+        DISK=$(fdisk -l | grep -i '^Disk /.*:' | sed -e "\$aother (experimental)" | imenu -l "select disk> ")
+        if ! grep -q '^other' <<<"$DISK"; then
+            if ! echo "Install on $DISK ?
 this will delete all existing data" | imenu -C; then
-            unset DISK
+                unset DISK
+            fi
+        else
+            chmod +x /root/instantARCH/askdisk.sh
+            /root/instantARCH/askdisk.sh
+            if [ -e /tmp/loopaskdisk ]; then
+                unset DISK
+                rm /tmp/loopaskdisk
+            fi
         fi
     done
 
-    echo "$DISK" | grep -o '/dev/[^:]*' | iroot i disk
+    if ! grep -q '^other' <<<"$DISK"; then
 
-    if ! efibootmgr; then
-        echo "$DISK" | grep -o '/dev/[^:]*' | iroot i grubdisk
+        echo "$DISK" | grep -o '/dev/[^:]*' | iroot i disk
+
+        if ! efibootmgr; then
+            echo "$DISK" | grep -o '/dev/[^:]*' | iroot i grubdisk
+        fi
     fi
 
     # choice between multiple nvidia drivers
-    askdrivers
+    if ! grep -iq manjaro /etc/os-release; then
+        askdrivers
+    fi
 
     # create user and add to groups
     askuser
@@ -68,7 +106,11 @@ this will delete all existing data" | imenu -C; then
         NEWHOSTNAME=$(imenu -i "enter name of this computer")
     done
 
-    echo "$NEWHOSTNAME" >/root/instantARCH/config/hostname
+    iroot hostname "$NEWHOSTNAME"
+
+    if imenu -c -i "edit advanced settings? (use only if you know what you're doing)"; then
+        /root/instantARCH/askadvanced.sh
+    fi
 
     wallstatus install
     SUMMARY="Installation Summary:"
@@ -76,7 +118,7 @@ this will delete all existing data" | imenu -C; then
     addsum "Username" "user"
     addsum "Locale" "locale"
     addsum "Region" "region"
-    addsum "Nearest City" "city"
+    addsum "Subregion" "city"
     addsum "Keyboard layout" "keyboard"
     addsum "Target install drive" "disk"
     addsum "Hostname" "hostname"
@@ -92,6 +134,9 @@ GRUB: BIOS"
     SUMMARY="$SUMMARY
 Should installation proceed with these parameters?"
 
+    echo "summary:
+$SUMMARY"
+
     if imenu -C <<<"$SUMMARY"; then
         iroot confirm 1
     else
@@ -108,6 +153,8 @@ Should installation proceed with these parameters?"
 
 done
 
-imenu -M <<<"The installation will now begin.
+imenu -M <<<'The installation will now begin.
 This could take a while.
-Keep the machine powered and connected to the internet"
+You can check install progress by clicking on "2" in the top right
+Keep the machine powered and connected to the internet. 
+After the installation, the machine will automatically reboot'