102 lines
4.7 KiB
Plaintext
102 lines
4.7 KiB
Plaintext
packages() {
|
|
addpkg base-system sudo void-repo-multilib-nonfree void-repo-nonfree lvm2 cronie socklog-void ntp xtools wireguard-tools gnupg progress pwgen net-tools ncdu nmap mtr bind-utils iotop hdparm smartmontools htop git neovim btrbk croc grub-btrfs nano mbuffer cryptsetup psmisc pinentry-tty
|
|
ignorepkg nvi
|
|
}
|
|
|
|
config() {
|
|
chown root:root /
|
|
chmod 755 /
|
|
echo ${HOSTNAME} > /etc/hostname
|
|
ln -sf "/usr/share/zoneinfo/${TIMEZONE}" /etc/localtime
|
|
sed -i "s/#HOSTNAME=\"void-live\"/HOSTNAME=${HOSTNAME}/g" /etc/rc.conf
|
|
sed -i "s/Europe\/Madrid/${TIMEZONE//\//\\/}/" /etc/rc.conf
|
|
sed -i "/HARDWARECLOCK/s/^#//g" /etc/rc.conf
|
|
sed -i "/FONT=/s/^#//g" /etc/rc.conf
|
|
|
|
echo "LANG=en_US.UTF-8" > /etc/locale.conf
|
|
echo "en_US.UTF-8 UTF-8" >> /etc/default/libc-locales
|
|
if ! [ "$LANGUAGE" == "en" ]; then
|
|
echo "${L1}.UTF-8 UTF-8" >> /etc/default/libc-locales
|
|
fi
|
|
echo "KEYMAP=${L2}" > /etc/vconsole.conf
|
|
|
|
xbps-reconfigure -f glibc-locales
|
|
|
|
enable_service acpid cronie socklog-unix nanoklogd uuidd agetty-tty1 agetty-tty2 agetty-tty3 agetty-tty4 isc-ntpd udevd
|
|
service_disable agetty-tty6 agetty-tty5
|
|
cat <<EOF > /etc/fstab
|
|
tmpfs /tmp tmpfs defaults,nosuid,nodev 0 0
|
|
/dev/mapper/vg_${TARGETNAME_UNDERSCORE}-root / btrfs defaults,subvol=rootfs 0 0
|
|
/dev/mapper/vg_${TARGETNAME_UNDERSCORE}-root /home btrfs defaults,subvol=homefs 0 0
|
|
/dev/mapper/vg_${TARGETNAME_UNDERSCORE}-swap swap swap defaults 0 0
|
|
/dev/mapper/vg_${TARGETNAME_UNDERSCORE}-root /var/lib/backup/quelle/rootfs btrfs defaults 0 0
|
|
EOF
|
|
|
|
|
|
if [ "$EFI" == "1" ]; then
|
|
uuid=$(blkid -o value -s UUID ${TARGET_PHY_ID}-part1)
|
|
echo "UUID=${uuid} /boot/efi vfat defaults 0 0" >> /etc/fstab
|
|
echo "efivarfs /sys/firmware/efi/efivars efivarfs defaults 0 0" >> /etc/fstab
|
|
else
|
|
if [ "${ENCRYPTION_STYLE}" == "e" ]; then
|
|
uuid=$(blkid -o value -s UUID ${TARGET_PHY_ID}-part1)
|
|
echo "UUID=${uuid} /boot btrfs defaults,subvol=bootfs 0 0" >> /etc/fstab
|
|
fi
|
|
fi
|
|
|
|
|
|
|
|
|
|
if [ "$ENCRYPTION_STYLE" == "a" ] || [ "$ENCRYPTION_STYLE" == "d" ]; then
|
|
dd bs=1 count=64 if=/dev/urandom of=/boot/volume.key
|
|
echo -n "${PASS}" | cryptsetup luksAddKey $TARGET_PHY_ID-part${TARGET_PART} /boot/volume.key
|
|
chmod 000 /boot/volume.key
|
|
chmod -R g-rwx,o-rwx /boot
|
|
if [ "$ENCRYPTION_STYLE" == "a" ]; then
|
|
echo "luks_${TARGETNAME_UNDERSCORE} $TARGET_PHY_ID-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
|
|
fi
|
|
|
|
if [ "$ENC" == "1" ]; then
|
|
echo "echo \"Disk pw is '${PASS}'\"" > /etc/runit/core-services/99-changepwdisk.sh
|
|
echo "read -p \"Change PW for disk? y/n \" answer" >> /etc/runit/core-services/99-changepwdisk.sh
|
|
echo "if [ \"\${answer}\" = \"y\" ]; then" >> /etc/runit/core-services/99-changepwdisk.sh
|
|
echo " while ! cryptsetup luksChangeKey /dev/disk/by-uuid/${cfg[partuuid]}; do" >> /etc/runit/core-services/99-changepwdisk.sh
|
|
echo " echo \"Again, please\"" >> /etc/runit/core-services/99-changepwdisk.sh
|
|
echo " done" >> /etc/runit/core-services/99-changepwdisk.sh
|
|
echo " rm -rf /etc/runit/core-services/99-changepwdisk.sh" >> /etc/runit/core-services/99-changepwdisk.sh
|
|
echo "fi" >> /etc/runit/core-services/99-changepwdisk.sh
|
|
fi
|
|
|
|
useradd -G wheel -m -s /usr/bin/bash -c "${USERNAME}" "${USERNAME}"
|
|
echo -e "${PASS}\n${PASS}" | passwd "${USERNAME}"
|
|
|
|
passwd -dl root
|
|
|
|
echo "echo \"User pw is '${PASS}'\"" > /etc/runit/core-services/99-changepwuser.sh
|
|
echo "echo \"You should change it before login\"" > /etc/runit/core-services/99-changepwuser.sh
|
|
echo "read -p \"Change PW for ${USERNAME}? y/n \" answer" >> /etc/runit/core-services/99-changepwuser.sh
|
|
echo "if [ \"\${answer}\" = \"y\" ]; then" >> /etc/runit/core-services/99-changepwuser.sh
|
|
echo " while ! passwd ${USERNAME}; do" >> /etc/runit/core-services/99-changepwuser.sh
|
|
echo " echo \"Again, please\"" >> /etc/runit/core-services/99-changepwuser.sh
|
|
echo " done" >> /etc/runit/core-services/99-changepwuser.sh
|
|
echo " rm -rf /etc/runit/core-services/99-changepwuser.sh" >> /etc/runit/core-services/99-changepwuser.sh
|
|
echo "fi" >> /etc/runit/core-services/99-changepwuser.sh
|
|
|
|
touch /etc/xbps.d/10-ignore-firmware.conf
|
|
{ echo "#ignorepkg=linux-firmware-amd";
|
|
echo "#ignorepkg=linux-firmware-intel";
|
|
echo "#ignorepkg=linux-firmware-nvidia";
|
|
echo "#ignorepkg=linux-firmware-broadcom";
|
|
echo "#ignorepkg=wifi-firmware"; } >> /etc/xbps.d/10-ignore-firmware.conf
|
|
chmod 755 /etc/xbps.d/10-ignore-firmware.conf
|
|
|
|
cp -a /etc/profile.d/locale.sh /etc/profile.d/zz-locale-user.sh
|
|
sed -i 's/locale.conf/locale-user.conf/' /etc/profile.d/zz-locale-user.sh
|
|
sed -i '/^if/i [ "$(id -u)" -eq 0 ] && return' /etc/profile.d/zz-locale-user.sh
|
|
|
|
echo '0 * * * * /usr/bin/void-snapshot cron #void.system' > /var/spool/cron/root
|
|
|
|
}
|