-
Notifications
You must be signed in to change notification settings - Fork 0
/
chrootbuild
117 lines (79 loc) · 3.19 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
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
#!/bin/bash
STARL() {
clear
/bin/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
/bin/echo -e '\n\n' "\e[1;32mRE-ENTER THE FOLLOWING PARTITIONS FOR CHROOT ENVIRONMENT!...
\e[0m"
lsblk
echo -e '\n'
read -p "RE-Enter EFI partition for creating fstab (eg: sda1,vda1,nvme0n1p1) : " GEN_EFI
echo -e '\n'
read -p "RE-Enter the Root partition (eg: sda2,vda2, nvme0n1p2) : " RTVLME
echo -e '\n'
read -p "RE-Enter the Home partition (eg: sda3,vda3, nvme0n1p3) : " HOMEPRT
}
AUTOCON(){
/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
mkdir -p /etc/xbps.d
touch /etc/xbps.d/repo.conf
echo repository=https://mirrors.dotsrc.org/voidlinux/current > /etc/xbps.d/repo.conf
xbps-install -Syu -u xbps && xbps-install -Syu
xbps-install -Syu base-system vim git curl terminus-font zsh zsh-syntax-highlighting zsh-autosuggestions NetworkManager
xbps-remove base-voidstrap -y
/bin/echo -e '\n\n' "\e[1;32mINSTALLING CPU UCODE.........\e[0m"
echo -e '\n'
model=$(lscpu | grep 'Model name')
case "$model" in
*Intel*) xbps-install -Syu void-repo-nonfree && xbps-install -Syu intel-ucode ;;
*AMD*) xbps-install -Syu linux-firmware-amd ;;
esac
echo $HOSTNAME > /etc/hostname
echo "LANG=en_US.UTF-8" > /etc/locale.conf
echo "en_US.UTF-8 UTF-8" >> /etc/default/libc-locales
echo 'FONT="ter-g18b"' >> /etc/rc.conf
echo 'FONT_MAP="8859-2"' >> /etc/rc.conf
xbps-reconfigure -f glibc-locales
UUID_EFI=$(blkid -o value -s UUID /dev/$GEN_EFI)
UUID_ROOT=$(blkid -o value -s UUID /dev/$RTVLME)
UUID_HOME=$(blkid -o value -s UUID /dev/$HOMEPRT)
echo "UUID=${UUID_EFI} /boot/efi vfat defaults 0 0" >> /etc/fstab
echo "UUID=${UUID_ROOT} / ext4 defaults 0 0" >> /etc/fstab
echo "UUID=${UUID_HOME} /home ext4 defaults 0 0" >> /etc/fstab
echo "/swapfile none swap defaults 0 0" >> /etc/fstab
}
FIN_ACT(){
/bin/echo -e '\n\n' "\e[1;33mEnter root password\e[0m"
echo -e '\n'
passwd
useradd --create-home --groups wheel,users,audio,video,storage,cdrom,input,network --shell /bin/zsh $USERNAME
/bin/echo -e '\n\n' "\e[1;33mEnter user password\e[0m"
echo -e '\n'
passwd $USERNAME
echo "root ALL=(ALL) ALL
%wheel ALL=(ALL) ALL
%wheel ALL=(ALL) NOPASSWD: /usr/bin/halt, /usr/bin/poweroff, /usr/bin/reboot, \
/usr/bin/shutdown, /usr/bin/zzz, /usr/bin/ZZZ
@includedir /etc/sudoers.d" > /etc/sudoers
xbps-install grub-x86_64-efi -y
grub-install --target=x86_64-efi --efi-directory=/boot/efi --bootloader-id="Void"
xbps-reconfigure -fa
ln -s /etc/sv/dbus /etc/runit/runsvdir/default/
ln -s /etc/sv/NetworkManager /etc/runit/runsvdir/default/
exit
}
#call_func
STARL
AUTOCON
FIN_ACT