forked from jeffscode/saist
-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathaist
293 lines (229 loc) · 8.21 KB
/
aist
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
229
230
231
232
233
234
235
236
237
238
239
240
241
242
243
244
245
246
247
248
249
250
251
252
253
254
255
256
257
258
259
260
261
262
263
264
265
266
267
268
269
270
271
272
273
274
275
276
277
278
279
280
281
282
283
284
285
286
287
288
289
290
291
292
293
#!/bin/bash
#----------------------------------------------- Aist Script June 6 2017
# set -x
#
# NOTE: Edit /usr/bin/pacstrap line 339 to add
# "--needed" option to pacman to expedite testing
#
#----------------------------------------------------------------------
## Color Variables NEED MANUALLY EDITED TO SUIT INSTALL.##
# Black '\033[0;30m'
# Blue '\033[0;34m' # Light Blue '\033[1;34m'
# Brown/Orange '\033[0;33m'
# Cyan '\033[0;36m' # Light Cyan '\033[1;36m'
# Dark Gray '\033[1;30m' # Light Gray '\033[0;37m'
# Green '\033[0;32m' # Light Green '\033[1;32m'
# Purple '\033[0;35m' # Light Purple '\033[1;35m'
# Red '\033[0;31m' # Light Red '\033[1;31m'
# White '\033[1;37m' # Yellow '\033[1;33m'
# Cancel Color '\033[0m'
MT='\033[1;37m' # For Main Text # White
CH='\033[1;33m' # For Chroot Text # Yellow
CC='\033[0m' # To Cancel Text Color
#----------------------------------------------------------------------
## Set Up User And Passwords NEED MANUALLY EDITED TO SUIT INSTALL.##
URN=jeff # Username
URP=tess # User Password
RTP=root # Root Password
#----------------------------------------------------------------------
## STORAGE VARIABLES NEED MANUALLY EDITED TO SUIT INSTALL.##
# set the hdd or hdd. uncomment first comment on line to activate #
HDD=sda
# HDD=sdb
# HDD=sdc
# HDD=sdd
# HDD=sde
# set root partition. uncomment line to activate #
ROOTP=/dev/sda1
# ROOTP=/dev/sda2
# ROOTP=/dev/sda3
# ROOTP=/dev/sda4
# ROOTP=/dev/sda5
# set home partition. uncomment line to activate #
# HOMEP=/dev/sda1
# HOMEP=/dev/sda2
HOMEP=/dev/sda3
# HOMEP=/dev/sda4
# HOMEP=/dev/sda5
# set swap partition. uncomment line to activate #
# SWAP=/dev/sda1
SWAP=/dev/sda2
# SWAP=/dev/sda3
# SWAP=/dev/sda4
# SWAP=/dev/sda5
##################################################################################
########## ALL VARIABLES ABOVE NEED MANUAL EDITING TO SUITE INSALL ###############
##################################################################################
echo -e "${MT}#------------------------------------------------------------------#
## Aist ##
### ###
#### Arch Install Script Template ####
##### Read, edit and add to it for your preferences #####
#### Please provide your edits for inclusion at: ####
### http://www.xxxxx.com ###
## Lets keep this kiss, there are existing partitioning tools ##
#------------------------------------------------------------------#${CC}"
echo
echo -e "${CH} Chroot section = yellow font. ${CC}"
echo
echo
echo
#----------------------------------------------------------------------
## asksure is an "ask to proceed" fuction used in all functions ##
asksure() {
echo
echo -n -e "${MT} Proceed (Y/N) ? ${CC}"
while read -r -n 1 -s answer; do
if [[ $answer = [YyNn] ]] ; then
[[ $answer = [Yy] ]] && retval=0 && echo -e " ${CC}Answered ${MT}Yes${CC}, Proceeding ${CC} "
[[ $answer = [Nn] ]] && retval=0 && echo -e " ${CC}Answered ${MT}No${CC}, Exiting Installer ${CC} " && echo && exit
break
fi
done
return $retval
}
#----------------------------------------------------------------------
umounts(){
## unmount just in case ##
umount $HOMEP &> /dev/null
umount $ROOTP &> /dev/null
swapoff $SWAP &> /dev/null
echo "root is mounted on $ROOTP"
echo "home is mounted on $HOMEP"
echo "swap is mounted on $SWAP"
echo "username is $URN"
echo "user password is $URP"
echo "root password is $RTP"
echo
echo -e "${MT} The partitions you set up will be formatted. ${CC}"
echo -e "${MT} All data will be lost. Last chance to stop. ${CC}"
asksure
}
#----------------------------------------------------------------------
formats(){
## SET PARTITIONS TO BE FORMATTED HERE ##
yes | mkfs.ext4 $ROOTP
yes | mkfs.ext4 $HOMEP
}
#----------------------------------------------------------------------
mounts(){
## set mount points and swap ##
echo
mount $ROOTP /mnt
mkdir -p /mnt/home
mount $HOMEP /mnt/home
swapon $SWAP
lsblk | grep $HDD
echo
echo -e "${MT} Partitions shown mounted have been formatted, ready for installation. ${CC}"
asksure
echo
}
#----------------------------------------------------------------------
setrepos(){
## set repos ##
echo
yes y |pacman -Sy --needed reflector > /dev/null
reflector --latest 5 --sort rate --save /etc/pacman.d/mirrorlist
echo
cat /etc/pacman.d/mirrorlist
echo
echo -e "${MT} Updated the local mirrorlist. ${CC}"
echo -e "${MT} These will be integrated into new install. ${CC}"
asksure
echo
}
#----------------------------------------------------------------------
install(){
## install packages ##
echo
echo
echo -e "${MT} Installing the packages. This will take a while. ${CC}"
echo
pacstrap /mnt base grub #base-devel wget
genfstab -L /mnt > /mnt/etc/fstab
echo
echo -e "${MT} Installed packages and set up /etc/fstab. ${CC}"
asksure
echo
}
#----------------------------------------------------------------------
## Chroot ##
chroot-heredoc(){
## INFO TO USER ##
## COMMANDS ##
echo -e "${CH} Chrooting into new filesystem to configure ${CC}"
arch-chroot /mnt << INchrootOUT /bin/bash
echo 'command: arch-chroot /mnt << ICChrootOUT /bin/bash'
echo -e "${CH} Setting Timezone ${CC}"
ln -sf /usr/share/zoneinfo/America/Los_Angeles /etc/localtime
hwclock --systohc
echo 'command: ln -sf /usr/share/zoneinfo/America/Los_Angeles /etc/localtime'
echo 'command: hwclock --systohc'
echo -e "${CH} Setting Locale ${CC}"
echo "en_US.UTF-8 UTF-8" >> /etc/locale.gen
locale-gen
echo 'command: echo en_US.UTF-8 UTF-8" >> /etc/locale.gen'
echo 'command: locale-gen'
echo -e "${CH} Setting Language ${CC}"
echo "LANG=en_US.UTF-8" >> /etc/locale.conf
echo 'command: echo "LANG=en_US.UTF-8" >> /etc/locale.conf'
echo -e "${CH} Setting up Keyboard ${CC}"
echo "KEYMAP=us" >> /etc/vconsole.conf
echo 'command: echo "KEYMAP=us" >> /etc/vconsole.conf'
echo -e "${CH} Setting Hostname ${CC}"
echo "archtest" > /etc/hostname
echo "127.0.1.1 archtest.localdomain archtest" >> /etc/hosts
echo 'command: echo "archtest" > /etc/hostname'
echo 'command: echo "127.0.1.1 archtest.localdomain archtest" >> /etc/hosts'
echo -e "${CH} Setting up Network ${CC}"
systemctl enable dhcpcd
echo 'command: systemctl enable dhcpcd'
echo -e "${CH} Setting up Bootloader ${CC}"
grub-install --target=i386-pc /dev/sda
grub-mkconfig -o /boot/grub/grub.cfg
echo -e "${CH} Setting up User ${CC}"
useradd -m -g users -G wheel -s /bin/bash $URN
echo 'command: useradd -m -g users -G wheel -s /bin/bash $URN'
echo -e "${CH} Seting Passwords ${CC}"
yes $RTP | passwd root
yes $URP | passwd $URN
echo -e "${CH} Chrooting out of new filesystem. ${CC}"
echo
INchrootOUT
}
#----------------------------------------------------------------------
## Just A Message ##
completedchr(){
echo -e "${MT} Completed chroot configuration. ${CC}"
asksure
echo
}
#----------------------------------------------------------------------
## Unmount Partitions ##
unmounts(){
umount $HOMEP
umount $ROOTP
swapoff $SWAP
echo
}
#----------------------------------------------------------------------
## Run Functions, Optionally Log Them ##
umounts # 2> umount.log
formats # 2> format.log
mounts # 2> mounts.log
setrepos # 2> setrepos.log
install # 2> install.log
chroot-heredoc # 2> chrdoc.log
completedchr # 2> completedchr
unmounts # 2> tee unmounts.log
#----------------------------------------------------------------------
## Show Partitions Unmounted And Message ##
lsblk | grep $HDD
echo
echo -e "${MT} Installation completed. ${CC}"
echo -e "${MT} Above to verify partitions unmounted. ${CC}"
echo
#----------------------------------------------------------------------
# set +x
exit