vinstaller/etc/base

45 lines
1.6 KiB
Plaintext
Raw Normal View History

2022-02-07 02:34:12 +01:00
packages() {
addpkg base-system lvm2 cryptsetup htop tmux wireguard-tools
}
config() {
2022-02-07 03:32:29 +01:00
chown root:root /
chmod 755 /
passwd root
echo ${HOSTNAME} > /etc/hostname
echo "LANG=en_US.UTF-8" > /etc/locale.conf
echo "en_US.UTF-8 UTF-8" >> /etc/default/libc-locales
2022-02-07 03:42:38 +01:00
if ! [ "$LANGUAGE" == "en" ]; then
2022-02-07 03:32:29 +01:00
echo "${L1}.UTF-8 UTF-8" >> /etc/default/libc-locales
fi
xbps-reconfigure -f glibc-locales
echo "GRUB_ENABLE_CRYPTODISK=y" >> /etc/default/grub
2022-02-07 03:42:38 +01:00
2022-02-07 04:39:26 +01:00
cat <<EOF > /etc/fstab
2022-02-07 03:42:38 +01:00
tmpfs /tmp tmpfs defaults,nosuid,nodev 0 0
/dev/mapper/vg_${TARGETNAME_UNDERSCORE}-root / btrfs defaults,subvol=root 0 0
/dev/mapper/vg_${TARGETNAME_UNDERSCORE}-root /home btrfs defaults,subvol=home 0 0
/dev/mapper/vg_${TARGETNAME_UNDERSCORE}-swap swap swap defaults 0 0
EOF
if [ "$EFI" == "1" ]; then
2022-02-07 04:39:26 +01:00
echo "${TARGET_PHY_WWN}-part1 /boot/efi vfat defaults 0 0" >> /etc/fstab
2022-02-07 03:42:38 +01:00
fi
uuid=$(blkid -o value -s UUID ${TARGET_PHY_WWN}-part${TARGET_PART})
2022-02-07 04:39:26 +01:00
sed -i "/^GRUB_CMDLINE_LINUX_DEFAULT/s/=\"/=\"rd.luks.uuid=${uuid} /" /etc/default/grub
sed -i "/^GRUB_CMDLINE_LINUX_DEFAULT/s/=\"/=\"rd.lvm.vg=vg_${TARGETNAME_UNDERSCORE} /" /etc/default/grub
if [ "$ENCRYPTION_STYLE" == "a" ] || [ "$ENCRYPTION_STYLE" == "d" ]; then
dd bs=1 count=64 if=/dev/urandom of=/boot/volume.key
cryptsetup luksAddKey $TARGET_PHY_WWN-part${TARGET_PART} /boot/volume.key
chmod 000 /boot/volume.key
chmod -R g-rwx,o-rwx /boot
echo "luks_${TARGETNAME_UNDERSCORE} $TARGET_PHY_WWN-part${TARGET_PART} /boot/volume.key luks" >> /etc/crypttab
echo "install_items+=\" /boot/volume.key /etc/crypttab \"" > /etc/dracut.conf.d/10-crypt.conf
fi
grub-install $TARGET_PHY_WWN
xbps-reconfigure -fa
2022-02-07 02:34:12 +01:00
}