-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathv2
More file actions
96 lines (78 loc) · 2.48 KB
/
Copy pathv2
File metadata and controls
96 lines (78 loc) · 2.48 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
#!/bin/bash
# === CHROOT CONFIG ===
#set -euo pipefail
MAPPER="cryptroot"
echo "[+] Configuring base system..."
echo -e "\n\e[1;36mRUNNING IN CHROOT ENVIRONMENT...\e[0m\n"
read -p "Hostname : " HOSTNAME
read -p "Username : " USER
clear
echo -e "\n\e[1;32mRE-ENTER PARTITION FOR CHROOT ENVIRONMENT\e[0m\n"
lsblk
echo ""
read -p "Encrypted Root (e.g., sda2) : " ECRVLM
read -p "Create fallback swapfile? [y/N]: " SWAPFILE_YN
read -p "Swapfile size in GB (if enabled): " SWAPSIZE
clear
# Display timezone options and read input
printf '
Africa/Abidjan
Africa/Casablanca
America/Adak
UTC
'
read -p "Enter Timezone: " TZ
# Mirror
echo 'repository=https://mirrors.dotsrc.org/voidlinux/current' > /etc/xbps.d/00-repository-main.conf
echo "$HOSTNAME" > /etc/hostname
ln -sf /usr/share/zoneinfo/$TZ /etc/localtime
echo "LANG=en_US.UTF-8" > /etc/locale.conf
echo "en_US.UTF-8 UTF-8" >> /etc/default/libc-locales
xbps-install -S
xbps-install -u xbps
xbps-install -yu
xbps-install -y base-system linux-lts linux-lts-headers grub-x86_64-efi efibootmgr cryptsetup dracut lvm2 eudev glibc-locales xtools procps-ng iwd dhcpcd zsh
xbps-reconfigure -f glibc-locales
echo "[+] Set root password:"
passwd root
useradd -mG wheel -s /bin/zsh $USER
echo "[+] Set password for $USER:"
passwd "$USER"
echo '%wheel ALL=(ALL) ALL' >> /etc/sudoers
ln -s /etc/sv/iwd /var/service
ln -s /etc/sv/dhcpcd /var/service
# ZRAM setup
echo "Enabling ZRAM..."
xbps-install -y zramen
mkdir -p /etc/zramen
cat <<EOF > /etc/zramen/config.toml
[[zram0]]
size = "ram/2"
algorithm = "zstd"
priority = 100
EOF
ln -s /etc/sv/zramen /var/service
# Swap file
if [[ "$SWAPFILE_YN" =~ ^[Yy]$ ]]; then
echo "Creating fallback swapfile..."
fallocate -l ${SWAPSIZE}G /swapfile
chmod 600 /swapfile
mkswap /swapfile
echo "/swapfile none swap defaults,pri=10 0 0" >> /etc/fstab
fi
# FDE
UUID_ROOT=$(blkid -o value -s UUID /dev/$ECRVLM)
echo "cryptroot UUID=$UUID_ROOT none luks" > /etc/crypttab
echo 'add_dracutmodules+=" crypt "' > /etc/dracut.conf.d/crypt.conf
echo 'GRUB_CMDLINE_LINUX="rd.luks.name='"$UUID_ROOT"'=cryptroot root=/dev/mapper/cryptroot"' >> /etc/default/grub
echo "GRUB_ENABLE_CRYPTODISK=y" >> /etc/default/grub
xgenfstab -U / > /etc/fstab
dracut --force
grub-install --target=x86_64-efi --efi-directory=/boot/efi --bootloader-id=void
grub-mkconfig -o /boot/grub/grub.cfg
xbps-reconfigure -fa
# === CLEANUP ===
umount -R /mnt
cryptsetup close "$MAPPER"
echo -e "\n\033[1;32m[✔] Void Linux FDE installed. Reboot and go dark.\033[0m"
exit