-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathchrootPart.sh
More file actions
316 lines (289 loc) · 10.9 KB
/
chrootPart.sh
File metadata and controls
316 lines (289 loc) · 10.9 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
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
294
295
296
297
298
299
300
301
302
303
304
305
306
307
308
309
310
311
312
313
314
315
316
#!/bin/bash
DISK="$1"
encryptFlag="$2"
WMAnswer="$3"
DesktopsAnswer="$4"
OneDesktopAnswer="$6"
Password='0'
answer='no'
oneDeskFlag='0' #Flag to trigger not asking to install more desktops if user decided to install just one.
psswd_check() {
while true; do
read -s -p "Enter password: " Password
echo
read -s -p "Confirm password: " Confirm
echo
if [ "$Password" == "$Confirm" ]; then
break
else
echo "Passwords do not match. Please try again."
fi
done
}
ln -sf /usr/share/zoneinfo/Chile/Continental /etc/localtime
hwclock --systohc
#Adding parallel downloads to new chroot environemnt
sed -i 's/^#ParallelDownloads = 5/ParallelDownloads = 5/' /etc/pacman.conf
pacman -Syyu
#Ntp conf and locale conf
systemctl enable ntpd.service
echo "LANG=en_US.UTF-8" >> /etc/locale.conf
locale-gen
#Network configuration part#
read -r -p "Please insert your desire hostname name: " Hostname
echo
echo "$Hostname" >> /etc/hostname
echo "127.0.0.1 localhost" >> /etc/hosts
echo "::1 localhost" >> /etc/hosts
echo "127.0.1.1 $Hostname.localdomain.$Hostname" >> /etc/hosts
systemctl enable NetworkManager.service
#Setting root password
echo "You will need to create your root password now."
echo
psswd_check
echo "$Password" | passwd --stdin
read -r -p "Do you want to create another user besides root ? write yes or no: " answer
echo
if [[ "${answer,,}" =~ ^(y|yes)$ ]]
then
read -r -p "Please write your new user username: " User
echo
read -r -p "do you want to have your new user in wheel group to have sudo ussage? write yes or no: " wheel
echo
if [[ "${wheel,,}" =~ ^(y|yes)$ ]]
then
useradd -m "$User"
usermod -aG wheel "$User"
# sed -i 's/^#\s*%wheel\sALL=(ALL)\sALL/%wheel ALL=(ALL) ALL/' /etc/sudoers
sed -i 's/^# %wheel ALL=(ALL:ALL) ALL/%wheel ALL=(ALL:ALL) ALL/' /etc/sudoers
echo "You will need to create your "$User" password now."
psswd_check
echo "$Password" | passwd --stdin "$User"
fi
else
echo "okey, another user will not be made"
User='0' #This help in the last if block to check if a user was made or not
fi
#initcpio only for unencrypted devices. It avoids making it twice in the opposite case
if [[ "${encryptFlag,,}" =~ ^(n|no)$ ]]
then
mkinitcpio -P
fi
# GRUB INSTALLATION AND CONFIGURATION
BiosOrUefi=$(cat /sys/firmware/efi/fw_platform_size)
if [[ "${encryptFlag,,}" =~ ^(n|no)$ ]]
then
if [ "$BiosOrUefi" = '64' ]
then
grub-install --target=x86_64-efi --efi-directory=/boot --bootloader-id=GRUB
elif [ "$BiosOrUefi" = '32' ]
then
grub-install --target=x86_64-efi --efi-directory=/boot --bootloader-id=GRUB
else
grub-install "$DISK"
fi
grub-mkconfig -o /boot/grub/grub.cfg
fi
#Generating locale conf
echo "en_US.UTF-8 UTF-8" >> /etc/locale.gen
echo "en_US ISO-8859-1" >> /etc/locale.gen
locale-gen
if [[ "${WMAnswer,,}" =~ ^(y|yes)$ ]]
then
### Installing dwm window manager
read -r -p "Do you want to install DWM for window manager support ? write yes or no: " DwmAnswer
echo
else
DwmAnswer='no'
fi
if [[ "${DwmAnswer,,}" =~ ^(y|yes)$ && "$User" = '0' ]]
then
pacman -S rofi lf xorg xorg-xinit base base-devel ntp feh picom calcurse task fzf nerd-fonts gnu-free-fonts ttf-font-awesome noto-fonts-emoji ttf-iosevka-nerd xdg-desktop-portal xdg-desktop-portal-gtk --noconfirm
cd
mkdir programs && cd programs
git clone https://github.com/CarlosR759/dwm-rice
git clone https://github.com/CarlosR759/dmenu-rice
git clone https://github.com/CarlosR759/dwmBlocks-rice
cd ~/programs/dwm-rice
make clean install
cd ~/programs/dmenu-rice
make clean install
cd ~/programs/dwmBlocks-rice
make clean install
mkdir ~/.config
cd ~/.config
git clone https://github.com/CarlosR759/mydotfiles .
cp /etc/X11/xinit/xinitrc ~/.xinitrc
sed -i 's/^"$twm" &//' /home/root/.xinitrc
sed -i 's/^"$xclock" -geometry 50x50-1+1 &//' /home/root/.xinitrc
sed -i 's/^"$xterm" -geometry 80x50+494+51 &//' /home/root/.xinitrc
sed -i 's/^"$xterm" -geometry 80x20+494-0 &//' /home/root/.xinitrc
sed -i 's/^exec "$xterm" -geometry 80x66+0+0 -name login//' /home/root/.xinitrc
cd
wget -O ~/.bashrc https://raw.githubusercontent.com/CarlosR759/bashrc/main/bashrc
git clone https://github.com/CarlosR759/wallpapers
echo "feh --bg-scale ~/wallpapers/container_ship.png" >> /home/root/.xinitrc
echo "picom -b &" >> /home/root/.xinitrc
echo "dwmblocks &" >> /home/root/.xinitrc
echo "dwm 2> ~/.dwm.log" >> /home/root/.xinitrc
elif [[ "${DwmAnswer,,}" =~ ^(y|yes)$ && "$User" != '0' ]]
then
pacman -S rofi lf xorg xorg-xinit base base-devel ntp feh picom calcurse task fzf nerd-fonts gnu-free-fonts ttf-font-awesome noto-fonts-emoji ttf-iosevka-nerd --noconfirm
cd /home/"$User"
mkdir programs && cd programs
git clone https://github.com/CarlosR759/dwm-rice
git clone https://github.com/CarlosR759/dmenu-rice
git clone https://github.com/CarlosR759/dwmBlocks-rice
cd /home/"$User"/programs/dwm-rice
make clean install
cd /home/"$User"/programs/dmenu-rice
make clean install
cd /home/"$User"/programs/dwmBlocks-rice
make clean install
mkdir /home/"$User"/.config
cd /home/"$User"/.config
git clone https://github.com/CarlosR759/mydotfiles .
cp /etc/X11/xinit/xinitrc /home/"$User"/.xinitrc
sed -i 's/^"$twm" &//' /home/"$User"/.xinitrc
sed -i 's/^"$xclock" -geometry 50x50-1+1 &//' /home/"$User"/.xinitrc
sed -i 's/^"$xterm" -geometry 80x50+494+51 &//' /home/"$User"/.xinitrc
sed -i 's/^"$xterm" -geometry 80x20+494-0 &//' /home/"$User"/.xinitrc
sed -i 's/^exec "$xterm" -geometry 80x66+0+0 -name login//' /home/"$User"/.xinitrc
cd /home/"$User"
wget -O ~/.bashrc https://raw.githubusercontent.com/CarlosR759/bashrc/main/bashrc
git clone https://github.com/CarlosR759/wallpapers
echo "feh --bg-scale ~/wallpapers/container_ship.png" >> /home/"$User"/.xinitrc
echo "picom -b &" >> /home/"$User"/.xinitrc
echo "dwmblocks &" >> /home/"$User"/.xinitrc
echo "dwm 2> ~/.dwm.log" >> /home/"$User"/.xinitrc
fi
if [[ "${WMAnswer,,}" =~ ^(y|yes)$ ]]
then
### Installing Hyprland window manager
read -r -p "Do you want to install Hyprland window manager ? write yes or no: " hyprAnswer
echo
else
hyprAnswer='no'
fi
if [[ "${hyprAnswer,,}" =~ ^(y|yes)$ && "$User" != '0' ]]
then
pacman -S hyprland hyprpaper hyprpicker hyprlock xdg-desktop-portal-hyprland hyprpolkitagent hyprsunset base base-devel mesa libglvnd rofi lf calcurse flameshot fzf nerd-fonts gnu-free-fonts ttf-font-awesome noto-fonts-emoji ttf-iosevka-nerd --noconfirm
mkdir -p /home/"$User"/.config/
cd /home/"$User"/.config/
git clone https://github.com/CarlosR759/mydotfiles .
mkdir /home/"$User"/.config/hypr/
cd /home/"$User"/.config/hypr/
git clone https://github.com/CarlosR759/HyprConfs .
cd /home/"$User"/
git clone https://github.com/CarlosR759/wallpapers
cd /home/"$User"/
wget -O /home/"$User"/.bashrc https://raw.githubusercontent.com/CarlosR759/bashrc/main/bashrc
#Installing my eww bar
pacman -S rustup gtk-layer-shell libdbusmenu-gtk3 libdbusmenu-glib gtk3 --noconfirm
git clone https://github.com/elkowar/eww
cd eww
cargo build --release --no-default-features --features=wayland
cd target/release
chmod +x ./eww
cp ./eww /usr/local/bin/
mkdir /home/"$User"/.config/eww/
cd /home/"$User"/.config/eww/
git clone https://github.com/CarlosR759/PotPlantCozzySysBar .
elif [[ "${hyprAnswer,,}" =~ ^(y|yes)$ && "$User" == '0' ]]
then
#If you are installing this as root, please create an user okey ? Hyprland doesn't recomend launch it as root at all.
pacman -S hyprland hyprpaper hyprpicker hyprlock xdg-desktop-portal-hyprland hyprpolkitagent hyprsunset base base-devel mesa libglvnd rofi lf calcurse flameshot fzf nerd-fonts gnu-free-fonts ttf-font-awesome noto-fonts-emoji ttf-iosevka-nerd --noconfirm
mkdir -p /home/root/.config/
cd /home/root/.config/
git clone https://github.com/CarlosR759/mydotfiles .
mkdir /home/root/.config/hypr/
cd /home/root/.config/hypr/
git clone https://github.com/CarlosR759/HyprConfs .
cd /home/root/
git clone https://github.com/CarlosR759/wallpapers
cd /home/"$User"/
wget -O /home/root/.bashrc https://raw.githubusercontent.com/CarlosR759/bashrc/main/bashrc
#Installing my eww bar
pacman -S rustup gtk-layer-shell libdbusmenu-gtk3 libdbusmenu-glib gtk3 --noconfirm
git clone https://github.com/elkowar/eww
cd eww
cargo build --release --no-default-features --features=wayland
cd target/release
chmod +x ./eww
cp ./eww /usr/local/bin/
mkdir /home/"$User"/.config/eww/
cd /home/"$User"/.config/eww/
git clone https://github.com/CarlosR759/PotPlantCozzySysBar .
fi
#Desktops installation section
if [[ "${DesktopsAnswer,,}" =~ ^(y|yes)$ ]]
then
read -r -p "Do you want to install KDE desktop ? Write yes or no: " KdeAnswer
echo
if [[ "${KdeAnswer,,}" =~ ^(y|yes)$ ]]
then
pacman -S plasma --noconfirm
systemctl enable sddm.service
if [[ "${OneDesktopAnswer,,}" =~ ^(y|yes)$ ]]
then
oneDeskFlag='1'
fi
fi
if [[ "$oneDeskFlag" == '0' ]]
then
read -r -p "Do you want to install Gnome desktop ? Write yes or no: " GnomeAnswer
echo
fi
if [[ "${GnomeAnswer,,}" =~ ^(y|yes)$ && "$oneDeskFlag" == '0' ]]
then
pacman -S gnome --noconfirm
systemctl enable gdm.service
if [[ "${OneDesktopAnswer,,}" =~ ^(y|yes)$ ]]
then
oneDeskFlag='1'
fi
fi
if [[ "$oneDeskFlag" == '0' ]]
then
read -r -p "Do you want to install Cosmic desktop ? Write yes or no: " CosmicAnswer
echo
fi
if [[ "${CosmicAnswer,,}" =~ ^(y|yes)$ && "$oneDeskFlag" == '0' ]]
then
pacman -S cosmic --noconfirm
systemctl enable cosmic-greeter.service
if [[ "${OneDesktopAnswer,,}" =~ ^(y|yes)$ ]]
then
oneDeskFlag='1'
fi
fi
if [[ "$oneDeskFlag" == '0' ]]
then
read -r -p "Do you want to install Xfce desktop ? Write yes or no: " XfceAnswer
echo
fi
if [[ "${XfceAnswer,,}" =~ ^(y|yes)$ && "$oneDeskFlag" == '0' ]]
then
pacman -S xfce4 --noconfirm
systemctl enable lightdm.service
if [[ "${OneDesktopAnswer,,}" =~ ^(y|yes)$ ]]
then
oneDeskFlag='1'
fi
fi
if [[ "$oneDeskFlag" == '0' ]]
then
read -r -p "Do you want to install mate desktop ? Write yes or no: " MateAnswer
echo
fi
if [[ "${MateAnswer,,}" =~ ^(y|yes)$ && "$oneDeskFlag" == '0' ]]
then
pacman -S mate --noconfirm
systemctl enable lightdm.service
fi
fi
systemctl enable ufw
ufw default deny incoming
ufw default allow outgoing
rm -rf /chrootPart.sh
exit