-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy path3-post-setup.sh
87 lines (75 loc) · 3.99 KB
/
3-post-setup.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
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
#!/bin/bash
source /arch-base/.env
echo "-------------------------------------------------"
echo "Configuring initramfs "
echo "-------------------------------------------------"
sed -i 's/^MODULES=()/MODULES=(btrfs crc32c-intel)/' /etc/mkinitcpio.conf
sed -i 's/^FILES=()/FILES=(\/crypto_keyfile.bin)/' /etc/mkinitcpio.conf
sed -i 's/block filesystems keyboard fsck/block encrypt filesystems keyboard/' /etc/mkinitcpio.conf
mkinitcpio -p linux
echo "-------------------------------------------------"
echo "Setting up Arch Linux Netboot "
echo "-------------------------------------------------"
wget https://archlinux.org/static/netboot/ipxe-arch.16e24bec1a7c.efi
mkdir /boot/efi/EFI/arch_netboot
mv ipxe*.*.efi /boot/efi/EFI/arch_netboot/arch_netboot.efi
efibootmgr --create --disk ${EFI_PARTITION} --part 1 --loader /EFI/arch_netboot/arch_netboot.efi --label "Arch Linux Netboot" --verbose
echo "-------------------------------------------------"
echo "Configuring Grub "
echo "-------------------------------------------------"
ROOT_PARTITION_UUID=$(blkid -o value -s UUID ${ROOT_PARTITION})
echo "ROOT_PARTITION_UUID=${ROOT_PARTITION_UUID}" >> /arch-base/.env
sed -i "s|quiet|cryptdevice=UUID=${ROOT_PARTITION_UUID}:${CRYPTROOT_NAME} root=${CRYPTROOT_PATH} lsm=landlock,lockdown,yama,apparmor,bpf audit=1|g" /etc/default/grub
sed -i 's/^#GRUB_ENABLE_CRYPTODISK/GRUB_ENABLE_CRYPTODISK/' /etc/default/grub
grub-install --target=x86_64-efi --efi-directory=/boot/efi --bootloader-id=GRUB
grub-mkconfig -o /boot/grub/grub.cfg
cp /boot/efi/EFI/GRUB/grubx64.efi /boot/efi/EFI/GRUB/grubx64.efi.bak
git clone https://github.com/ccontavalli/grub-shusher.git ~/grub-shusher
cd ~/grub-shusher/;make;./grub-kernel /boot/efi/EFI/GRUB/grubx64.efi;cd ~
rm -rf grub-shusher/
echo "-------------------------------------------------"
echo "Setting up crypttab "
echo "-------------------------------------------------"
echo "${CRYPTROOT_NAME} UUID=${ROOT_PARTITION_UUID} /crypto_keyfile.bin luks" >> /etc/crypttab
echo "-------------------------------------------------"
echo "Setting up ZRAM "
echo "-------------------------------------------------"
sed -i 's/# MAX_SIZE=8192/MAX_SIZE=1024/g' /etc/default/zramd
echo "-------------------------------------------------"
echo "Enabling apparmor write cache "
echo "-------------------------------------------------"
sed -i 's/^#write-cache/write-cache/' /etc/apparmor/parser.conf
echo "-------------------------------------------------"
echo "Enabling services to start at boot "
echo "-------------------------------------------------"
systemctl enable NetworkManager
systemctl enable sshd
systemctl enable avahi-daemon
systemctl enable reflector.timer
systemctl enable fstrim.timer
systemctl enable firewalld
systemctl enable acpid
#systemctl enable cronie
systemctl enable zramd
systemctl enable snapper-timeline.timer
systemctl enable snapper-cleanup.timer
systemctl enable snapper-boot.timer
systemctl enable grub-btrfs.path
systemctl enable apparmor
systemctl enable auditd
echo "-------------------------------------------------"
echo "Copying arch-base repo to user directory "
echo "-------------------------------------------------"
cp -r /arch-base/ /home/${USERNAME}/
chown -R ${USERNAME}:${USERNAME} /home/${USERNAME}/arch-base/
echo "-------------------------------------------------"
echo "Resetting user (${USERNAME}) sudo permissions "
echo "-------------------------------------------------"
echo "${USERNAME} ALL=(ALL) ALL" > "/etc/sudoers.d/${USERNAME}"
#echo "-------------------------------------------------"
#echo "Setting user (${USERNAME}) default shell to ZSH "
#echo "-------------------------------------------------"
#usermod --shell /bin/zsh ${USERNAME}
echo "-------------------------------------------------"
echo "Setup Complete "
echo "-------------------------------------------------"