void-bash-installer/modules/40-basesystem/install
2021-04-18 11:50:18 +02:00

113 lines
4.4 KiB
Plaintext

module start "basesystem" "Install Basesystem"
diskid="${cfg[diskid]//-/_}"
chown root:root /
chmod 755 /
DESTDIR=
vmkdir() {
mkdir -p /"$1"
}
vinstall() {
src=$1; tgt=$3; rights=$2
cp -fr "${src}" /"${tgt}"
chmod -R "${rights}" /"${tgt}"
}
vbin() {
cp -rf "$1" /usr/bin/
chmod 0755 /usr/bin/"$(basename $1)"
}
vbin "${FILESDIR}/bin/joinvpn"
vbin "${FILESDIR}/bin/void-update"
vbin "${FILESDIR}/bin/void-backup"
vbin "${FILESDIR}/bin/void-snapshot"
vbin "${FILESDIR}/bin/void-createbackupcontainer"
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
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" 744 etc/xbps.d
vinstall "${FILESDIR}/xbps/20-repo-rotce.de-pakete.conf" 744 etc/xbps.d
vmkdir etc/default/grub-btrfs
vinstall "${FILESDIR}/grub-btrfs/void.conf" 755 etc/default/grub-btrfs
vmkdir etc/NetworkManager/conf.d
vinstall "${FILESDIR}/nm/unmanaged-wg.conf" 744 etc/NetworkManager/conf.d
vinstall "${FILESDIR}/xorg/10-keyboard.conf" 744 usr/share/X11/xorg.conf.d
vmkdir etc/fonts/conf.d
ln -s /usr/share/fontconfig/conf.avail/70-no-bitmaps.conf "${DESTDIR}/etc/fonts/conf.d/70-no-bitmaps.conf"
mkdir -p /etc/xbps.d/
{ 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
{ echo "en_DK.UTF-8 UTF-8";
echo "${cfg[lang]}.UTF-8 UTF-8";
echo "en_US.UTF-8 UTF-8"; } > /etc/default/libc-locales
echo "LANG=en_US.UTF-8" > /etc/locale.conf
echo "KEYMAP=${cfg[lang_console]}" > /etc/vconsole.conf
echo "LANG=${cfg[lang]}.UTF-8" > /etc/locale-user.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 "tmpfs /tmp tmpfs defaults,nosuid,nodev 0 0";
echo "/dev/mapper/voidvg.${diskid}-root / btrfs defaults,subvol=rootfs 0 0";
echo "/dev/mapper/voidvg.${diskid}-root /home btrfs defaults,subvol=homefs 0 0";
echo "/dev/mapper/voidvg.${diskid}-swap swap swap defaults 0 0";
echo "/dev/mapper/voidvg.${diskid}-root /var/lib/backup/quelle/rootfs btrfs defaults 0 0"; } > /etc/fstab
if [[ "${cfg[fde_key_store]}" == "once" ]]; then
{ echo "UUID=${cfg[bootuuid]} /boot btrfs defaults,subvol=bootfs 0 0";
echo "UUID=${cfg[bootuuid]} /var/lib/backup/quelle/bootfs btrfs defaults 0 0"; } >> /etc/fstab
fi
echo "${cfg[hostname]}" > /etc/hostname
ln -sf "/usr/share/zoneinfo/${cfg[timezone]}" /etc/localtime
sed -i "s/#HOSTNAME=\"void-live\"/HOSTNAME=${cfg[hostname]}/g" /etc/rc.conf
sed -i "s/Europe\/Madrid/${cfg[timezone]//\//\\/}/" /etc/rc.conf
sed -i "/HARDWARECLOCK/s/^#//g" /etc/rc.conf
sed -i "/FONT=/s/^#//g" /etc/rc.conf
if [[ ! ${cfg[fde_key_store]} == "none" ]]; then
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
echo "read -p \"Change PW for ${users[name1]}? 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 ${users[name1]}; 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
fi
module end