vinstaller/etc/base

149 lines
6.5 KiB
Plaintext
Raw Normal View History

2022-02-07 02:34:12 +01:00
packages() {
2022-05-04 20:21:50 +02:00
addpkg base-system sudo void-repo-multilib 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 pciutils iproute2 iputils iperf unzip usbutils wget binutils
2022-02-08 19:53:21 +01:00
ignorepkg nvi
2022-02-09 14:00:29 +01:00
if [ "${EFI}" == "1" ]; then
2022-02-09 15:23:23 +01:00
addpkg ckbcomp xkeyboard-config
2022-02-09 14:00:29 +01:00
fi
2022-02-07 02:34:12 +01:00
}
config() {
2022-02-07 03:32:29 +01:00
chown root:root /
chmod 755 /
echo ${HOSTNAME} > /etc/hostname
2022-02-08 18:08:12 +01:00
ln -sf "/usr/share/zoneinfo/${TIMEZONE}" /etc/localtime
2022-02-07 16:35:25 +01:00
sed -i "s/#HOSTNAME=\"void-live\"/HOSTNAME=${HOSTNAME}/g" /etc/rc.conf
2022-02-08 18:08:12 +01:00
sed -i "s/Europe\/Madrid/${TIMEZONE//\//\\/}/" /etc/rc.conf
2022-02-07 16:35:25 +01:00
sed -i "/HARDWARECLOCK/s/^#//g" /etc/rc.conf
sed -i "/FONT=/s/^#//g" /etc/rc.conf
2022-02-07 03:32:29 +01:00
echo "LANG=en_US.UTF-8" > /etc/locale.conf
echo "en_US.UTF-8 UTF-8" >> /etc/default/libc-locales
2022-02-09 10:41:57 +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
2022-02-09 01:49:01 +01:00
2022-02-09 10:41:57 +01:00
if ! [ "${KEY_LANG}" == "en" ]; then
echo "KEYMAP=${L2}" > /etc/vconsole.conf
fi
2022-02-08 18:57:09 +01:00
2022-02-07 03:32:29 +01:00
xbps-reconfigure -f glibc-locales
2022-02-07 20:23:24 +01:00
2022-02-08 19:53:21 +01:00
enable_service acpid cronie socklog-unix nanoklogd uuidd agetty-tty1 agetty-tty2 agetty-tty3 agetty-tty4 isc-ntpd udevd
2022-02-09 00:14:54 +01:00
disable_service agetty-tty6 agetty-tty5
2022-02-09 11:16:52 +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
2022-02-08 00:00:29 +01:00
/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
2022-02-07 03:42:38 +01:00
/dev/mapper/vg_${TARGETNAME_UNDERSCORE}-swap swap swap defaults 0 0
2022-02-08 18:57:09 +01:00
/dev/mapper/vg_${TARGETNAME_UNDERSCORE}-root /var/lib/backup/quelle/rootfs btrfs defaults 0 0
2022-02-07 03:42:38 +01:00
EOF
2022-08-05 15:37:48 +02:00
if [ "${ENCRYPTION_STYLE}" == "e" ]; then
uuid=$(blkid -o value -s UUID "${BOOTDEV}")
echo "UUID=${uuid} /boot btrfs defaults,subvol=bootfs 0 0" >> /etc/fstab
fi
2022-02-07 03:42:38 +01:00
if [ "$EFI" == "1" ]; then
2022-09-12 11:43:04 +02:00
uuid=$(blkid -o value -s UUID ${TARGET_PHY_ID}${part}1)
2022-02-07 20:30:08 +01:00
echo "UUID=${uuid} /boot/efi vfat defaults 0 0" >> /etc/fstab
2022-02-11 01:06:23 +01:00
echo "efivarfs /sys/firmware/efi/efivars efivarfs defaults,nosuid,nodev,noexec 0 0" >> /etc/fstab
2022-08-05 15:09:05 +02:00
fi
2022-02-07 04:39:26 +01:00
if [ "$ENCRYPTION_STYLE" == "a" ] || [ "$ENCRYPTION_STYLE" == "d" ]; then
dd bs=1 count=64 if=/dev/urandom of=/boot/volume.key
2022-09-12 11:43:04 +02:00
echo -n "${PASS}" | cryptsetup luksAddKey $TARGET_PHY_ID${part}${TARGET_PART} /boot/volume.key
2022-02-07 04:39:26 +01:00
chmod 000 /boot/volume.key
chmod -R g-rwx,o-rwx /boot
2022-02-07 23:07:46 +01:00
if [ "$ENCRYPTION_STYLE" == "a" ]; then
2022-09-12 11:43:04 +02:00
echo "luks_${TARGETNAME_UNDERSCORE} $TARGET_PHY_ID${part}${TARGET_PART} /boot/volume.key luks" >> /etc/crypttab
2022-02-07 23:07:46 +01:00
echo "install_items+=\" /boot/volume.key /etc/crypttab \"" > /etc/dracut.conf.d/10-crypt.conf
fi
2022-02-07 04:39:26 +01:00
fi
2022-02-07 16:35:25 +01:00
2022-08-05 15:37:48 +02:00
#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
2022-09-12 11:43:04 +02:00
# echo " while ! cryptsetup luksChangeKey /dev/disk/by-id/${TARGET_PHY_ID}${part}${TARGET_PART}; do" >> /etc/runit/core-services/99-changepwdisk.sh
2022-08-05 15:37:48 +02:00
# 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
2022-02-07 23:49:59 +01:00
2022-02-08 21:59:26 +01:00
useradd -G wheel,socklog,audio,video,floppy,cdrom,optical,input,users -U -m -s /usr/bin/bash -c "${USERNAME}" "${USERNAME}"
2022-02-09 11:16:52 +01:00
grep -q lpadmin /etc/group && usermod -a -G lpadmin "${USERNAME}"
2022-02-08 18:08:12 +01:00
echo -e "${PASS}\n${PASS}" | passwd "${USERNAME}"
2022-02-07 23:49:59 +01:00
2022-02-07 05:57:51 +01:00
passwd -dl root
2022-02-08 21:59:26 +01:00
chsh -s /usr/bin/bash root
2022-02-07 04:39:26 +01:00
2022-02-08 18:08:12 +01:00
echo "echo \"User pw is '${PASS}'\"" > /etc/runit/core-services/99-changepwuser.sh
2022-02-07 21:25:16 +01:00
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
2022-02-07 16:35:25 +01:00
echo "if [ \"\${answer}\" = \"y\" ]; then" >> /etc/runit/core-services/99-changepwuser.sh
2022-02-07 21:25:16 +01:00
echo " while ! passwd ${USERNAME}; do" >> /etc/runit/core-services/99-changepwuser.sh
2022-02-07 16:35:25 +01:00
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
2022-02-08 19:59:23 +01:00
touch /etc/xbps.d/10-ignore-firmware.conf
2022-02-08 18:57:09 +01:00
{ echo "#ignorepkg=linux-firmware-amd";
echo "#ignorepkg=linux-firmware-intel";
echo "#ignorepkg=linux-firmware-nvidia";
echo "#ignorepkg=linux-firmware-broadcom";
2022-02-08 19:59:23 +01:00
echo "#ignorepkg=wifi-firmware"; } >> /etc/xbps.d/10-ignore-firmware.conf
2022-02-08 18:57:09 +01:00
chmod 755 /etc/xbps.d/10-ignore-firmware.conf
2022-02-09 15:53:53 +01:00
vmkdir var/spool/cron
2022-02-08 18:57:09 +01:00
echo '0 * * * * /usr/bin/void-snapshot cron #void.system' > /var/spool/cron/root
2022-02-07 16:35:25 +01:00
2022-02-08 20:41:09 +01:00
vbin "${FILESDIR}/bin/joinvpn"
vbin "${FILESDIR}/bin/void-update"
vbin "${FILESDIR}/bin/void-backup"
vbin "${FILESDIR}/bin/void-snapshot"
vbin "${FILESDIR}/bin/void-createbackupcontainer"
vbin "${FILESDIR}/bin/pinentry-chooser"
2022-03-06 21:59:06 +01:00
vbin "${FILESDIR}/bin/change_luks_pw"
vbin "${FILESDIR}/bin/helpme"
2022-02-08 20:41:09 +01:00
vmkdir etc/sudoers.d
vinstall "${FILESDIR}/sudoers/10-common" 700 etc/sudoers.d
vmkdir etc/bash/bashrc.d
vinstall "${FILESDIR}/bash/xbps-aliase.sh" 755 etc/bash/bashrc.d
vinstall "${FILESDIR}/bash/editor.sh" 755 etc/bash/bashrc.d
vmkdir usr/lib/udev/rules.d
vinstall "${FILESDIR}/udev/99-mount-media.rules" 744 usr/lib/udev/rules.d
vinstall "${FILESDIR}/udev/99-ioschedulers.rules" 744 usr/lib/udev/rules.d
vmkdir etc/btrbk
vinstall "${FILESDIR}/btrbk/btrbk.conf.void" 744 etc/btrbk
vmkdir etc/xbps.d
vinstall "${FILESDIR}/xbps/50-no-extract.conf" 755 etc/xbps.d
vinstall "${FILESDIR}/xbps/20-repo-rotce.de-pakete.conf" 755 etc/xbps.d
vmkdir etc/default/grub-btrfs
vinstall "${FILESDIR}/grub-btrfs/void.conf" 755 etc/default/grub-btrfs
vmkdir etc/NetworkManager/conf.d
vmkdir etc/NetworkManager/dispatcher.d
vinstall "${FILESDIR}/nm/unmanaged-wg.conf" 644 etc/NetworkManager/conf.d
vinstall "${FILESDIR}/nm/unmanaged-tun.conf" 644 etc/NetworkManager/conf.d
vinstall "${FILESDIR}/nm/30-wg0" 744 etc/NetworkManager/dispatcher.d
vmkdir etc/profile.d
vinstall "${FILESDIR}/profile/append-path.sh" 644 etc/profile.d zz-append-path.sh
vmkdir usr/share/X11/xorg.conf.d
vinstall "${FILESDIR}/xorg/10-keyboard.conf" 644 usr/share/X11/xorg.conf.d
vmkdir etc/skel
vinstall "${FILESDIR}/gnupg/gpg-agent.conf" 700 etc/skel
2022-02-07 23:30:58 +01:00
}