-
Notifications
You must be signed in to change notification settings - Fork 0
/
chrootbuild
83 lines (75 loc) · 2.37 KB
/
chrootbuild
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
#!/bin/bash
# Clear the terminal
clear
# Prompt for information
echo -e '\n\n' "\e[1;36mRUNNING IN CHROOT ENVIRONMENT...\e[0m"
echo -e '\n'
read -p "ENTER HOSTNAME : " HOSTNAME
echo -e '\n'
read -p "ENTER USERNAME: " USERNAME
echo -e '\n'
read -p "Swapfile size (eg: 2,4,8) : " SWPFILE
clear
# Display timezone options and read input
printf '
Africa/Abidjan
Africa/Casablanca
America/Adak
America/Los_Angeles
Antarctica/Casey
Antarctica/Vostok
Asia/Kolkata
Asia/Tokyo
Atlantic/Bermuda
Atlantic/Reykjavik
Australia/Lord_Howe
Australia/Melbourne
Europe/Amsterdam
Europe/Istanbul
Indian/Kerguelen
Indian/Reunion
Pacific/Chuuk
Pacific/Wake
UTC
'
read -p "Enter Timezone: " TIMEZONE
# Setup swapfile and configure system settings
/bin/echo -e '\n\n' "\e[1;32mGENERATING SWAPFILE.........\e[0m"
echo -e '\n'
dd if=/dev/zero of=/swapfile bs=1G count=${SWPFILE} status=progress
chmod 600 /swapfile
mkswap /swapfile
swapon /swapfile
echo "/swapfile none swap defaults 0 0" >> /etc/fstab
ln -sf /usr/share/zoneinfo/$TIMEZONE /etc/localtime
hwclock --systohc
echo -e 'en_US.UTF-8 UTF-8\nen_US ISO-8859-1' >> /etc/locale.gen
locale-gen
echo 'LANG=en_US.UTF-8' >> /etc/locale.conf
echo $HOSTNAME >> /etc/hostname
# Set root password
/bin/echo -e '\n\n' "\e[1;33mENTER ROOT PASSWORD\e[0m"
echo -e '\n'
passwd
# Installing necessary packages and configuring system settings
sed -i 's/#ParallelDownloads = 5/ParallelDownloads = 5/' /etc/pacman.conf
pacman -Sy grub efibootmgr networkmanager terminus-font zsh zsh-syntax-highlighting zsh-autosuggestions --needed --noconfirm
echo "FONT=ter-g18b\nFONT_MAP=8859-2" >> /etc/vconsole.conf
clear
/bin/echo -e '\n\n' "\e[1;33mInstalling GRUB..\e[0m"
echo -e '\n'
grub-install --target=x86_64-efi --efi-directory=/boot/efi --bootloader-id=GRUB
grub-mkconfig -o /boot/grub/grub.cfg
systemctl enable NetworkManager
# Set user password
useradd -mG wheel -s /bin/zsh $USERNAME
clear
/bin/echo -e '\n\n' "\e[1;33mENTER USER PASSWORD\e[0m"
echo -e '\n'
passwd $USERNAME
# Configure sudoers file
echo "root ALL=(ALL) ALL
%wheel ALL=(ALL) ALL
@includedir /etc/sudoers.d" > /etc/sudoers
sleep 1
exit