-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathinstaller.sh
More file actions
executable file
·114 lines (110 loc) · 3.06 KB
/
Copy pathinstaller.sh
File metadata and controls
executable file
·114 lines (110 loc) · 3.06 KB
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
#!/bin/bash
install(){
echo "To begin installation, your computer must be connected to the internet. Follow the wizard to connect to an existing network."
echo "Select your connection type:"
net=("Wifi" "Ethernet")
select nt in ${net[*]}; do
case $nt in
"Wifi") wifidct
break;;
"Ethernet") ethernet
break;;
*) echo "Invalid option, please try again."
;;
esac
done
}
wifidct(){
echo "Detecting wifi interface . . ."
wlan=($(ls /sys/class/net | grep wl*))
i=1
for j in ${wlan[@]};do
echo "${i}) ${j}"
i=$((i+1))
done
read -r -p 'Wifi interface detected, please enter your wifi interface:' c
ifconfig $c up
if [ $?=0 ]
then
echo "Scanning for wifi network . . ."
nmcli -t -f SIGNAL,SSID device wifi list | sort -nr
read -rp 'Please enter your Wifi SSID. If you cannot find it, please check whether your wifi connection is available or not.' ssid
wifitype=("WPA" "WPA-PSK" "WEP" "OPEN WIFI")
select wft in ${wifitype[@]};do
case $wft in
"WPA"|"WPA-PSK"|"WEP") read -r -p 'Enter password: ' password
echo -n "Is it a hidden network? [y/n] "
read ans
if [ ${ans}=="y" ] || [ ${ans}=="Y" ]
then
nmcli device wifi connect "${ssid}" password "${password}" ifname $c hidden yes
elif [ ${ans}=="n" ] || [ ${ans}=="N" ]
then
nmcli device wifi connect "${ssid}" password "${password}" ifname $c
else
echo "Invalid option, please try again."
wifidct
fi
break;;
"OPEN WIFI")echo "Connect to the chosen Wifi? [y/n]"
if [ ${ans}=="y" ] || [ ${ans}=="Y" ]
then
nmcli device wifi connect "${ssid}" ifname $c hidden yes
elif [ ${ans}=="n" ] || [ ${ans}=="N" ]
then
nmcli device wifi connect "${ssid}" ifname $c | 2&>1 >/dev/null
else
echo "Invalid option, please try again."
wifidct
fi
nmcli device wifi connect "${ssid}" ifname $c
break;;
*) echo "Invalid option."
;;
esac
done
elif [ $?!=0 ]
then
echo "Unexpected error encoutered, please try again. Probably your network interface doesn't exist."
echo -n "Enter your Wifi interface again: "
read c
ifconfig $c up
wifichk
fi
}
wifichk(){
if [ $?!=0 ]
then
echo "Unexpected error encoutered, please config wifi again."
wifidct
fi
}
ethernet(){
echo "Detecting your Ethernet interface..."
ethernetinf=($(ls /sys/class/net/ | grep ^e))
i=1
for j in ${ethernetinf[@]}; do
echo "${i}) ${j}"
i=$((i+1))
done
echo "Enter your Ethernet interface:"
read $ethernet
}
echo "------------------ H Y D R O O S ------------------"
echo "| Welcome to the HydroOS Installer! |"
echo "| What do you want me to do? |"
option=("Install" "Reboot" "Exit")
echo "-----------------------------------------------------"
select opt in ${option[*]};
do
case $opt in
"Install")
install
break;;
"Reboot") echo "Under maintainance..."
break;;
"Exit") echo "Exiting..."
break;;
*) echo "Invalid option, please try again.";;
esac
done