aboutsummaryrefslogtreecommitdiffstats
path: root/arch_install-UEFI.sh
blob: 7e608b945951a9d6589d8da560ba8ed0fa746fc0 (plain)
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
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
165
166
167
168
169
170
171
172
173
174
175
176
177
178
179
180
181
182
183
184
185
186
187
188
189
190
191
192
193
194
195
196
197
198
199
200
201
202
203
204
205
206
207
208
209
210
211
212
213
214
215
216
217
218
219
220
221
222
223
224
225
226
227
228
#!/bin/bash

answr=""
drvnm=""
rts=""
swps=""
rtpwd=""
rtrtpwd="walk"
usrpwd=""
usrusrpwd="fade"

clear
echo "#============ WELCOME ============#"
echo "#                                 #"
echo "#        Welcome to Joe's         #"
echo "#           ARCH LINUX            #"
echo "#      UEFI INSTALL SCRIPT        #"
echo "#                                 #"
echo "#  (press [return] to begin...)   #"
echo "#                                 #"
echo "#=================================#"
read

# ================================================================================================ #
# ======================================== ERRORS CHECK ========================================== #
# ================================================================================================ #

if [ ! -r /sys/firmware/efi/efivars ]; then
				clear
				echo "X=X=X=X=X=X=X ERROR X=X=X=X=X=X=X=X"
				echo "X                                 X"
				echo "X    It seems that boot mode      X"
				echo "X      is not set to UEFI         X"
				echo "X    therefore Joe's script is    X"
				echo "X        forced to abort          X"
				echo "X                                 X"
				echo "X=X=X=X=X=X=X=X=X=X=X=X=X=X=X=X=X=X"
				sleep 6
				echo && echo
				echo "Thank you for using Joe's Arch Linux UEFI install scritpt."
				sleep 1
				echo "Aborting..."
				sleep 3
				clear
				exit
fi
clear
echo "Verifying that your are connected to the Internet, please wait..."
wget -q --spider https://google.com
if [ ! $? -eq 0 ]; then
				clear
				echo "X=X=X=X=X=X=X ERROR X=X=X=X=X=X=X=X"
				echo "X                                 X"
				echo "X       It seems that your        X"
				echo "X         terminal is not         X"
				echo "X    connected to the Internet    X"
				echo "X    therefore Joe's script is    X"
				echo "X        forced to abort          X"
				echo "X                                 X"
				echo "X=X=X=X=X=X=X=X=X=X=X=X=X=X=X=X=X=X"
				sleep 6
				echo && echo
				echo "Thank you for using Joe's Arch Linux UEFI install script."
				sleep 1
				echo "Aborting..."
				sleep 3
				clear
				exit
else
				echo "Success!"
				echo
				echo "Press [retrun] key to continue"
				read
fi

# ================================================================================================ #
# ========================================= DISK SETUP =========================================== #
# ================================================================================================ #

while [[ $answr != y && $answr != Y && $answr != yes && $answr != Yes && $answr != YES ]]; do
				clear
				echo "#========= I. DISK SETUP =========#"
				echo "#                                 #"
				echo "#      Please choose wisely       #"
				echo "#      1. Drive to be used        #"
				echo "#                                 #"
				echo "#=================================#"
				while [[ $drvnm == "" ]]; do
								echo && echo
								echo "Please enter letter of the drive on which Arch Linux should be installed:"
								echo "/dev/sd_"
								echo -n "~> "
								read -n 1 drvnm
				done
				clear
				echo "#========= I. DISK SETUP =========#"
				echo "#                                 #"
				echo "#      Please choose wisely       #"
				echo "#      2. swap partion size       #"
				echo "#                                 #"
				echo "#=================================#"
				while [[ $swps == "" ]]; do
								echo && echo
								echo "Please enter your swap partition disired size:"
								echo "_G"
								echo -n "~> "
								read swps
				done
				clear
				echo "#========= I. DISK SETUP =========#"
				echo "#                                 #"
				echo "#      Please choose wisely       #"
				echo "#      3. root partion size       #"
				echo "#                                 #"
				echo "#=================================#"
				while [[ $rts == "" ]]; do
								echo && echo
								echo "Please enter your root partition disired size:"
								echo "__G"
								echo -n "~> "
								read rts
				done

				drv="/dev/sd$drvnm"
				btsze="128M"
				rtsze=$rts"G"
				swpsze=$swps"G"

				clear
				echo "#=========================== CONFIRM THIS IS EXACT ==============================#" 
				echo "#                                                                                #"
				echo "#                            DRIVE TO USE: $drv                              #"
				echo "#                                                                                #"
				echo "#  /boot/efi > BOOT partiton size > $btsze      / > ROOT partition size > $rtsze      #"
				echo "#  SWAP partiton size > $swpsze        /home > HOME partition size > all that remains #"
				echo "#                                                                                #"
				echo "#================================================================================#" 
				echo && echo
				echo "Is that correct? [y/N]"
				echo -n "~> "
				read answr
				if [[ $answr != y && $answr != Y && $answr != yes && $answr != Yes && $answr != YES ]]; then
								echo "Retrying..."
								echo
								echo "Press [retrun] key to continue"
								read
				fi
done

# ================================================================================================ #
# ========================================= USERS SETUP ========================================== #
# ================================================================================================ #

answr="n"

while [[ $rtrtpwd != $rtpwd || $rtpwd == "" ]]; do
				clear
				echo "#======= II. USERS SETUP =========#"
				echo "#                                 #"
				echo "#        1. root password         #"
				echo "#                                 #"
				echo "#=================================#"
				echo && echo
				echo "Enter your disired root password (can't be empty):"
				echo -n "~> "
				read -s rtpwd
				echo && echo
				echo "Confirm root password:"
				echo -n "~> "
				read -s rtrtpwd
				if [[ $rtrtpwd != $rtpwd ]]; then
								echo && echo
								echo "Password mismatch, retrying..."
								sleep 2
				fi
				if [[ $rtpwd == "" ]]; then
								echo && echo
								echo "Password is empty, retrying..."
								sleep 2
				fi
done

clear
echo "#======= II. USERS SETUP =========#"
echo "#                                 #"
echo "#          2. user add            #"
echo "#                                 #"
echo "#=================================#"
echo && echo
echo "Would you like to add a user to the system? [y/N]"
echo -n "~> " 
read answr
if [[ $answr == y || $answr == Y || $answr == yes || $answr == Yes || $answr == YES ]]; then
				echo && echo
				echo "Enter your desired username:"
				echo -n "~> "
				read usr
				echo && echo
				while [[ $usrusrpwd != $usrpwd || $usrpwd == "" ]]; do
								echo "Enter your disired password for $usr (can't be empty):"
								echo -n "~> "
								read -s usrpwd
								echo && echo
								echo "Confirm user password:"
								echo -n "~> "
								read -s usrusrpwd
								if [[ $usrusrpwd != $usrpwd ]]; then
												echo && echo
												echo "Password mismatch, retrying..."
												sleep 2
								fi
								if [[ $usrpwd == "" ]]; then
												echo && echo
												echo "Password is empty, retrying..."
												sleep 2
								fi
				done
fi



#timedatectl set-ntp true

# ================================================================================================ #
# ===================================== PARTITIONING DISK ======================================== #
# ================================================================================================ #

#echo "2048, $btsze, , *" | sfdisk $drv