-
Notifications
You must be signed in to change notification settings - Fork 3
/
uefi-base-install.sh
executable file
·286 lines (277 loc) · 11.8 KB
/
uefi-base-install.sh
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
#!/usr/bin/env bash
echo -ne "
__________________________________________________________________________________________________________
| |
| ███ ███ █████ ██████ ██ ██████ |
| ████ ████ ██ ██ ██ ██ ██ |
| ██ ████ ██ ███████ ██ ███ ██ ██ |
| ██ ██ ██ ██ ██ ██ ██ ██ ██ |
| ██ ██ ██ ██ ██████ ██ ██████ |
| |
| █████ ██████ ██████ ██ ██ ██ ███ ██ ███████ ████████ █████ ██ ██ ███████ ██████ |
|██ ██ ██ ██ ██ ██ ██ ██ ████ ██ ██ ██ ██ ██ ██ ██ ██ ██ ██|
|███████ ██████ ██ ███████ ██ ██ ██ ██ ███████ ██ ███████ ██ ██ █████ ██████ |
|██ ██ ██ ██ ██ ██ ██ ██ ██ ██ ██ ██ ██ ██ ██ ██ ██ ██ ██ ██|
|██ ██ ██ ██ ██████ ██ ██ ██ ██ ████ ███████ ██ ██ ██ ███████ ███████ ███████ ██ ██|
| |
|---------------------------------------------------------------------------------------------------------|
| Install arch linux in few clicks. Even a 5 year kid can install arch now. |
|---------------------------------------------------------------------------------------------------------|
| Base Installation Of Arch Linux Begins Now |
| Check: https://github.com/whoisYoges/magic-arch-installer/ To Know More Details About This Installation |
|---------------------------------------------------------------------------------------------------------|
|_________________________________________________________________________________________________________|
"
sleep 3s
echo "Internet Connection is a must to begin."
echo "Updating Keyrings"
sleep 2s
pacman -Sy --needed --noconfirm archlinux-keyring
clear
echo "Ensuring if the system clock is accurate."
timedatectl set-ntp true
sleep 3s
clear
lsblk
echo "Enter the drive to install arch linux on it. (/dev/...)"
echo "Enter Drive (eg. /dev/sda or /dev/vda or /dev/nvme0n1 or something similar)"
read drive
sleep 2s
clear
lsblk
echo "Choose a familier disk utility tool to partition your drive!"
echo " 1. fdisk"
echo " 2. cfdisk"
echo " 3. gdisk"
echo " 4. parted"
read partitionutility
case "$partitionutility" in
1 | fdisk | Fdisk | FDISK)
partitionutility="fdisk"
;;
2 | cfdisk | Cfdisk | CFDISK)
partitionutility="cfdisk"
;;
3 | gdisk | Gdisk | GDISK)
partitionutility="gdisk"
;;
4 | parted | Parted | PARTED)
partitionutility="parted"
;;
*)
echo "Unknown or unsupported disk utility! Default = cfdisk."
partitionutility="cfdisk"
;;
esac
echo ""$partitionutility" is the selected disk utility tool for partition."
sleep 3s
clear
echo "Getting ready for creating partitions!"
echo "root and boot partitions are mandatory."
echo "home and swap partitions are optional but recommended!"
echo "Also, you can create a separate partition for timeshift backup (optional)!"
echo "Getting ready in 9 seconds"
sleep 9s
"$partitionutility" "$drive"
clear
lsblk
echo "choose your linux file system type for formatting drives"
echo " 1. ext4"
echo " 2. xfs"
echo " 3. btrfs"
echo " 4. f2fs"
echo " Boot partition will be formatted in fat32 file system type."
read filesystemtype
case "$filesystemtype" in
1 | ext4 | Ext4 | EXT4)
filesystemtype="ext4"
;;
2 | xfs | Xfs | XFS)
filesystemtype="xfs"
;;
3 | btrfs | Btrfs | BTRFS)
filesystemtype="btrfs"
;;
4 | f2fs | F2fs | F2FS)
filesystemtype="f2fs"
;;
*)
echo "Unknown or unsupported Filesystem. Default = ext4."
filesystemtype="ext4"
;;
esac
echo ""$filesystemtype" is the selected file system type."
sleep 3s
clear
echo "Getting ready for formatting drives."
sleep 3s
lsblk
echo "Enter the root partition (eg: /dev/sda1): "
read rootpartition
mkfs."$filesystemtype" "$rootpartition"
mount "$rootpartition" /mnt
clear
lsblk
read -p "Did you also create separate home partition? [y/n]: " answerhome
case "$answerhome" in
y | Y | yes | Yes | YES)
echo "Enter home partition (eg: /dev/sda2): "
read homepartition
mkfs."$filesystemtype" "$homepartition"
mkdir /mnt/home
mount "$homepartition" /mnt/home
;;
*)
echo "Skipping home partition!"
;;
esac
clear
lsblk
read -p "Did you also create swap partition? [y/n]: " answerswap
case "$answerswap" in
y | Y | yes | Yes | YES)
echo "Enter swap partition (eg: /dev/sda3): "
read swappartition
mkswap "$swappartition"
swapon "$swappartition"
;;
*)
echo "Skipping Swap partition!"
;;
esac
clear
lsblk
read -p "Enter the boot partition. (eg. /dev/sda4): " answerefi
mkfs.fat -F 32 "$answerefi"
clear
lsblk
sleep 3s
clear
clear
#Replace kernel and kernel-header file and with your requirements (eg linux-zen linux-zen-headers or linux linux-headers)
#Include intel-ucode/amd-ucode if you use intel/amd processor.
echo "Installing Base system with lts kernel!!!"
sleep 2s
pacstrap /mnt base base-devel linux-lts linux-lts-headers
clear
echo "generating fstab file"
genfstab -U /mnt >> /mnt/etc/fstab
sleep 2s
clear
sed '1,/^#part2$/d' uefi-base-install.sh > /mnt/post_base-install.sh
chmod +x /mnt/post_base-install.sh
arch-chroot /mnt ./post_base-install.sh
clear
echo "unmounting all the drives"
umount -R /mnt
sleep 2s
clear
echo -ne "
__________________________________________________________________________________________________________
| THANKS FOR USING |
|---------------------------------------------------------------------------------------------------------|
| ███ ███ █████ ██████ ██ ██████ |
| ████ ████ ██ ██ ██ ██ ██ |
| ██ ████ ██ ███████ ██ ███ ██ ██ |
| ██ ██ ██ ██ ██ ██ ██ ██ ██ |
| ██ ██ ██ ██ ██████ ██ ██████ |
| |
| █████ ██████ ██████ ██ ██ ██ ███ ██ ███████ ████████ █████ ██ ██ ███████ ██████ |
|██ ██ ██ ██ ██ ██ ██ ██ ████ ██ ██ ██ ██ ██ ██ ██ ██ ██ ██|
|███████ ██████ ██ ███████ ██ ██ ██ ██ ███████ ██ ███████ ██ ██ █████ ██████ |
|██ ██ ██ ██ ██ ██ ██ ██ ██ ██ ██ ██ ██ ██ ██ ██ ██ ██ ██ ██|
|██ ██ ██ ██ ██████ ██ ██ ██ ██ ████ ███████ ██ ██ ██ ███████ ███████ ███████ ██ ██|
| |
|---------------------------------------------------------------------------------------------------------|
| Install arch linux in few clicks. Even a 5 year kid can install arch now. |
|---------------------------------------------------------------------------------------------------------|
| Base Installation Of Arch Linux Is Completed Now |
|Check: https://github.com/whoisYoges/magic-arch-installer for Graphical User Interface (GUI) Installation|
|---------------------------------------------------------------------------------------------------------|
|_________________________________________________________________________________________________________|
"
echo "Base Installation Finished. REBOOTING IN 10 SECONDS!!!"
sleep 10s
reboot
#part2
clear
echo "Working inside new root system!!!"
echo "setting timezone"
#Replace Asia/Kathmandu with your timezone
ln -sf /usr/share/zoneinfo/Asia/Kathmandu /etc/localtime
hwclock --systohc
sleep 2s
clear
echo "generating locale"
echo "en_US.UTF-8 UTF-8" >> /etc/locale.gen
locale-gen
sleep 2s
clear
echo "setting LANG variable"
echo "LANG=en_US.UTF-8" > /etc/locale.conf
sleep 2s
clear
echo "setting console keyboard layout"
echo "KEYMAP=us" > /etc/vconsole.conf
sleep 2s
clear
echo "Set up your hostname!"
echo "Enter your computer name: "
read hostname
echo $hostname > /etc/hostname
echo "Checking hostname (/etc/hostname)"
cat /etc/hostname
sleep 3s
clear
echo "setting up hosts file"
echo "127.0.0.1 localhost" >> /etc/hosts
echo "::1 localhost" >> /etc/hosts
echo "127.0.1.1 $hostname" >> /etc/hosts
clear
echo "checking /etc/hosts file"
cat /etc/hosts
sleep 3s
clear
#if you are dualbooting, add os-prober with grub and efibootmgr
echo "Installing grub efibootmgr and networkmanager"
sleep 2s
pacman -Sy --needed --noconfirm grub efibootmgr networkmanager
clear
lsblk
echo "Enter the boot partition to install bootloader. (eg: /dev/sda4): "
read efipartition
efidirectory="/boot/efi/"
if [ ! -d "$efidirectory" ]; then
mkdir -p "$efidirectory"
fi
mount "$efipartition" "$efidirectory"
clear
lsblk
sleep 2s
echo "Installing grub bootloader in /boot/efi parttiton"
grub-install --target=x86_64-efi --efi-directory=/boot/efi --bootloader-id=GRUB --removable
grub-mkconfig -o /boot/grub/grub.cfg
sleep 2s
clear
echo "Enabling NetworkManager"
systemctl enable NetworkManager
sleep 2s
clear
echo "Enter password for root user:"
passwd
clear
echo "Adding regular user!"
echo "Enter username to add a regular user: "
read username
useradd -m -g users -G wheel,audio,video -s /bin/bash $username
echo "Enter password for "$username": "
passwd $username
clear
echo "NOTE: ALWAYS REMEMBER THIS USERNAME AND PASSWORD YOU PUT JUST NOW."
sleep 3s
#Adding sudo previliages to the user you created
echo "Giving sudo access to "$username"!"
echo "$username ALL=(ALL) ALL" >> /etc/sudoers.d/$username
clear
rm /post_base-install.sh
exit