OSDN Git Service

kill imenu
[instantos/instantARCH.git] / archinstall.sh
1 #!/bin/bash
2
3 ###################################################
4 ## This is the official installer for instantOS  ##
5 ## instantOS is migrating from calamares to this ##
6 ###################################################
7
8 # main script calling others
9
10 if ! whoami | grep -iq '^root'; then
11     echo "not running as root, switching"
12     curl -Lg git.io/instantarch | sudo bash
13     exit
14 fi
15
16 if [ -e /usr/share/liveutils ]; then
17     echo "preparing isntallation
18 OK" | instantmenu -c -bw 4 -l 2 &
19 else
20     # print logo
21     echo ""
22     echo ""
23     curl -s 'https://raw.githubusercontent.com/instantOS/instantLOGO/master/ascii.txt' | sed 's/^/    /g'
24     echo ""
25     echo ""
26 fi
27
28 if ! command -v imenu; then
29     touch /tmp/removeimenu
30 fi
31
32 # download imenu
33 curl -s https://raw.githubusercontent.com/instantOS/imenu/master/imenu.sh >/usr/bin/imenu
34 chmod 755 /usr/bin/imenu
35
36 while ! command -v imenu; do
37     echo "installing imenu"
38     curl -s https://raw.githubusercontent.com/instantOS/imenu/master/imenu.sh >/usr/bin/imenu
39     chmod 755 /usr/bin/imenu
40 done
41
42 setinfo() {
43     if [ -e /usr/share/liveutils ]; then
44         pkill instantmenu
45     fi
46     echo "$@" >/opt/instantprogress
47     echo "$@"
48 }
49
50 # sort mirrors
51 pacman -Sy --noconfirm
52 pacman -S git --noconfirm --needed
53
54 cd /root
55 [ -e instantARCH ] && rm -rf instantARCH
56 git clone --depth=1 https://github.com/instantos/instantARCH.git
57 cd instantARCH
58 chmod +x *.sh
59 chmod +x */*.sh
60
61 ./depend/depend.sh
62 cd /root/instantARCH
63
64 ./ask.sh || {
65     imenu -m "ask failed"
66     echo "ask failed" && exit
67 }
68
69 chmod +x *.sh
70 chmod +x **/*.sh
71
72 echo "local install"
73 ./localinstall.sh 2>&1 | tee /opt/localinstall &&
74     echo "system install" &&
75     ./systeminstall.sh 2>&1 | tee /opt/systeminstall
76
77 pkill imenu
78 pkill instantmenu
79 sudo pkill imenu
80 sudo pkill instantmenu
81 sleep 2
82
83 # ask to reboot, upload error data if install failed
84 if ! [ -e /opt/installfailed ] || ! [ -e /opt/installsuccess ]; then
85     if command -v zenity; then
86         zenity --question --text="installation finished. reboot?" && touch /tmp/instantosreboot
87     fi
88 else
89     echo "installaion failed"
90     echo "uploading error data"
91
92     cat /opt/localinstall >/opt/install.log
93
94     if [ -e /opt/systeminstall ]; then
95         cat /opt/systeminstall >>/opt/install.log
96     fi
97
98     cd /opt
99     cp /root/instantARCH/data/netrc ~/.netrc
100     curl -n -F 'f:1=@install.log' ix.io
101     dialog --msgbox "installation failed
102 please go to https://instantos.github.io/instantos.github.io/support
103 for assistance or error reporting" 1000 1000
104
105 fi
106
107 if [ -e /tmp/removeimenu ]; then
108     rm /usr/bin/imenu
109 fi
110
111 echo "installation finished"
112
113 [ -e /tmp/instantosreboot ] && reboot