-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathsetBaseUEFI.sh
executable file
·202 lines (171 loc) · 7.23 KB
/
setBaseUEFI.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
#!/bin/bash
cat << "EOF"
██████ ██ ██ ████ ██
░█░░░░██ ░██ ░██ ░██░ ░░
░█ ░██ ██████ ██████ █████ ░██ ░██ █████ ██████ ██
░██████ ░░░░░░██ ██░░░░ ██░░░██ █████░██ ░██ ██░░░██░░░██░ ░██
░█░░░░ ██ ███████ ░░█████ ░███████░░░░░ ░██ ░██░███████ ░██ ░██
░█ ░██ ██░░░░██ ░░░░░██░██░░░░ ░██ ░██░██░░░░ ░██ ░██
░███████ ░░████████ ██████ ░░██████ ░░███████ ░░██████ ░██ ░██
░░░░░░░ ░░░░░░░░ ░░░░░░ ░░░░░░ ░░░░░░░ ░░░░░░ ░░ ░░
EOF
# ------------------------------------------------------
# Load library from modules directory
# ------------------------------------------------------
source $(dirname "$0")/modules/library.sh
clear
cat << "EOF"
██ ██ ██ ██
░██ ░██ ░██ ░██
░██ ███████ ██████ ██████ ██████ ░██ ░██
░██░░██░░░██ ██░░░░ ░░░██░ ░░░░░░██ ░██ ░██
░██ ░██ ░██░░█████ ░██ ███████ ░██ ░██
░██ ░██ ░██ ░░░░░██ ░██ ██░░░░██ ░██ ░██
░██ ███ ░██ ██████ ░░██ ░░████████ ███ ███
░░ ░░░ ░░ ░░░░░░ ░░ ░░░░░░░░ ░░░ ░░░
EOF
# ------------------------------------------------------
# Call function to Confirm Start
# ------------------------------------------------------
confirm_start
# ------------------------------------------------------
# Install required packages if not installed
# ------------------------------------------------------
echo ""
echo "-> Install required packages"
packagesPacman=(
"grub"
"efibootmgr"
"zsh"
"networkmanager"
"network-manager-applet"
"sudo"
"openssh"
"iw"
"terminus-font"
"iwd"
"sudo"
"rsync"
"blueman"
)
# -----------------------------------------
# Install pacman packages
# -----------------------------------------
_installPackagesPacman "${packagesPacman[@]}";
# -----------------------------------------
# Enable essential services
# -----------------------------------------
systemctl enable bluetooth
systemctl enable NetworkManager
systemctl enable sshd
systemctl enable fstrim.timer
systemctl enable systemd-hibernate.service
# -----------------------------------------
# Set the timezone to Africa/Lagos
# -----------------------------------------
ln -sf /usr/share/zoneinfo/Africa/Lagos /etc/localtime
hwclock --systohc
# -----------------------------------------
# Uncomment locale settings for en_US.UTF-8 and en_NG UTF-8
# -----------------------------------------
sed -i '171s/.//' /etc/locale.gen
sed -i '163s/.//' /etc/locale.gen
locale-gen
# -----------------------------------------
# Set system locale to en_NG
# -----------------------------------------
echo "
LANG=en_NG
LC_ADDRESS=en_NG
LC_IDENTIFICATION=en_NG
LC_MEASUREMENT=en_NG
LC_MONETARY=en_NG
LC_NAME=en_NG
LC_NUMERIC=en_NG
LC_PAPER=en_NG
LC_TELEPHONE=en_NG
LC_TIME=en_NG" > /etc/locale.conf
# -----------------------------------------
# Set keymap to us-acentos
# -----------------------------------------
echo "KEYMAP=us-acentos" >> /etc/vconsole.conf
# -----------------------------------------
# Set hostname to ArchLinux
# -----------------------------------------
echo "ArchLinux" > /etc/hostname
# -----------------------------------------
# Configure /etc/hosts file
# -----------------------------------------
echo "127.0.0.1 localhost" >> /etc/hosts
echo "::1 localhost" >> /etc/hosts
echo "127.0.1.1 ArchLinux.localdomain localhost" >> /etc/hosts
# -----------------------------------------
# Regenerate initramfs
# -----------------------------------------
mkinitcpio -P
# -----------------------------------------
# Set the root password
# -----------------------------------------
while true; do
passwd root
if [ $? -eq 0 ]; then
break
else
echo "Error setting root password. Please try again."
fi
done
# -----------------------------------------
# Install and configure GRUB
# -----------------------------------------
grub-install --target=x86_64-efi --efi-directory=/boot/efi --bootloader-id=GRUB
grub-mkconfig -o /boot/grub/grub.cfg
# -----------------------------------------
# Create a new user and add to necessary groups
# -----------------------------------------
# Function to prompt and set username
# -----------------------------------------
set_username() {
read -p "Enter your username: " username
export username
}
# -----------------------------------------
# Prompt user for username
# -----------------------------------------
set_username
# -----------------------------------------
# Create a new user and add to necessary groups
# -----------------------------------------
useradd -m -G sys,log,network,floppy,scanner,power,rfkill,users,video,storage,optical,lp,audio,wheel,adm,uucp -s /bin/zsh "$username"
# -----------------------------------------
# Set the password for the new user
# -----------------------------------------
while true; do
passwd "$username"
if [ $? -eq 0 ]; then
break
else
echo "Error setting $username's password. Please try again."
fi
done
# -----------------------------------------
# Add the new user to additional groups
# -----------------------------------------
usermod -aG wheel,storage,power "$username"
# -----------------------------------------
# Add the new user to sudoers list
# -----------------------------------------
echo "$username ALL=(ALL) ALL" | sudo tee -a /etc/sudoers.d/10-$username > /dev/null
# -----------------------------------------
# Done
# -----------------------------------------
cat << "EOF"
███████
░██░░░░██
░██ ░██ ██████ ███████ █████
░██ ░██ ██░░░░██░░██░░░██ ██░░░██
░██ ░██░██ ░██ ░██ ░██░███████
░██ ██ ░██ ░██ ░██ ░██░██░░░░
░███████ ░░██████ ███ ░██░░██████
░░░░░░░ ░░░░░░ ░░░ ░░ ░░░░░░
EOF
echo "NEXT: kde.sh or No to end and install your own choice of Desktop"