-
Notifications
You must be signed in to change notification settings - Fork 0
/
ezarch-chroot.sh
executable file
·52 lines (44 loc) · 1.6 KB
/
ezarch-chroot.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
#!/bin/bash
set -e
DEV=$1
if ! [[ "$DEV" =~ ^/dev/* ]]
then
printf "Invalid device provided.\nIn case you're wondering, run './ezarch.sh' to allow this script to continue.\n"
exit 1
fi
# Install the GRUB bootloader
# This is the part that allows you to boot into the system.
pacman --noconfirm -Sy grub efibootmgr
if [ -e /sys/firmware/efi/efivars ]
then
grub-install --target=x86_64-efi --force $DEV
else
grub-install --target=i386-pc --force $DEV
fi
grub-mkconfig -o /boot/grub/grub.cfg
# Ask for and set up the root password.
# Please pick something secure, or you'll get kids fucking around in your computer.
echo "Please enter your root password: "
read -s ROOTPASS
echo "root:$ROOTPASS" | chpasswd
# Ask and setup the username and password of the regular user.
# This user will have sudo privileges, so please set up a secure password if you don't want kids fucking around in your computer.
read -p "Enter the username of your user: " USERNAME
useradd -m $USERNAME
usermod -aG wheel $USERNAME
echo "Please enter your user password: "
read -s USERPASS
echo "$USERNAME:$USERPASS" | chpasswd
# Enable wheel privileges for doas
# They don't get configured with the installation of the package.
printf "permit persist :wheel\npermit nopass root\n" > /etc/doas.conf
# Delete GRUB after setup
# GRUB packages are not needed after setup, so they will be deleted to save space.
pacman --noconfirm -R grub efibootmgr
# Enable network services
# These services will allow you to connect to the internet.
systemctl enable NetworkManager
# Remove the chroot file
# This also saves space.
rm -rf /ezarch-chroot.sh
exit