OSDN Git Service

Merge branch 'master' of https://github.com/instantos/instantARCH
[instantos/instantARCH.git] / archinstall.sh
index bcd7c7d..3ec5c11 100755 (executable)
@@ -7,8 +7,6 @@
 
 # main script calling others
 
-# DO NOT USE ON ACTUAL HARDWARE YET
-
 if ! whoami | grep -iq '^root'; then
     echo "not running as root, switching"
     curl -Lg git.io/instantarch | sudo bash
@@ -16,9 +14,8 @@ if ! whoami | grep -iq '^root'; then
 fi
 
 if [ -e /usr/share/liveutils ]; then
-    echo "preparing isntallation
+    echo "preparing installation
 OK" | instantmenu -c -bw 4 -l 2 &
-    sleep 1
 else
     # print logo
     echo ""
@@ -50,15 +47,13 @@ setinfo() {
     echo "$@"
 }
 
-# sort mirrors
-pacman -Sy --noconfirm
-if command -v pacstrap; then
-    pacman -S reflector --noconfirm
-    echo "selecting fastest mirror"
-    reflector --latest 40 --protocol http --protocol https --sort rate --save /etc/pacman.d/mirrorlist
+if command -v python; then
+    echo "import time; time.sleep(10009)" | python &
+    sleep 2
+    pkill python3
 fi
 
-# install dependencies
+# sort mirrors
 pacman -Sy --noconfirm
 pacman -S git --noconfirm --needed
 
@@ -67,18 +62,82 @@ cd /root
 git clone --depth=1 https://github.com/instantos/instantARCH.git
 cd instantARCH
 
+# use alternative versions of the installer
+if [ -n "$1" ]; then
+    case "$1" in
+    "test")
+        echo "switching to testing branch"
+        git checkout -b testing
+        ;;
+    "manual")
+        if ! [ -e /root/manualarch ]; then
+            echo "no manual instantARCH version found. Please clone it to /root/manualarch"
+            sleep 5
+            echo "exiting"
+            exit
+        fi
+        rm -rf ./*
+        cp -r /root/manualarch/* .
+        ;;
+    *)
+        echo "running normal installer version"
+        ;;
+    esac
+
+fi
+chmod +x *.sh
+chmod +x */*.sh
+
 ./depend/depend.sh
+./artix/preinstall.sh
+
 cd /root/instantARCH
+
 ./ask.sh || {
+    imenu -m "ask failed"
     echo "ask failed" && exit
 }
 
 chmod +x *.sh
 chmod +x **/*.sh
+
 echo "local install"
-./localinstall.sh
-echo "in-system install"
-./systeminstall.sh
+./localinstall.sh 2>&1 | tee /opt/localinstall &&
+    echo "system install" &&
+    ./systeminstall.sh 2>&1 | tee /opt/systeminstall
+
+pkill imenu
+pkill instantmenu
+sudo pkill imenu
+sudo pkill instantmenu
+sleep 2
+
+# ask to reboot, upload error data if install failed
+if ! [ -e /opt/installfailed ] || ! [ -e /opt/installsuccess ]; then
+    if command -v installapplet; then
+        notify-send "rebooting"
+        sleep 2
+        reboot
+    fi
+else
+
+    echo "installaion failed"
+    echo "uploading error data"
+
+    cat /opt/localinstall >/opt/install.log
+
+    if [ -e /opt/systeminstall ]; then
+        cat /opt/systeminstall >>/opt/install.log
+    fi
+
+    cd /opt
+    cp /root/instantARCH/data/netrc ~/.netrc
+    curl -n -F 'f:1=@install.log' ix.io
+    dialog --msgbox "installation failed
+please go to https://instantos.github.io/instantos.github.io/support
+for assistance or error reporting" 1000 1000
+
+fi
 
 if [ -e /tmp/removeimenu ]; then
     rm /usr/bin/imenu