void-bash-installer/modules/40-basesystem/install

87 lines
4.4 KiB
Plaintext
Raw Normal View History

2021-03-11 14:04:04 +01:00
module start "basesystem" "Install Basesystem"
source "${var}"
source "${vars}/disk"
chown root:root /
chmod 755 /
mkdir -p "${dest}"/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"; } > "${dest}"/etc/xbps.d/10-ignore-firmware.conf
{ echo "en_DK.UTF-8 UTF-8";
echo "en_US.UTF-8 UTF-8"; } > "${dest}"/etc/default/libc-locales
2021-03-13 10:50:50 +01:00
2021-03-11 14:04:04 +01:00
echo "LANG=en_US.UTF-8" > "${dest}"/etc/locale.conf
2021-03-12 16:28:20 +01:00
echo "KEYMAP=${cfg[lang_console]}" > "${dest}"/etc/vconsole.conf
echo "${cfg[lang]}.UTF-8 UTF-8" >> "${dest}"/etc/default/libc-locales
echo "LANG=${cfg[lang]}.UTF-8" > "${dest}"/etc/locale-user.conf
2021-03-12 20:24:09 +01:00
2021-03-12 23:24:46 +01:00
cp -a "${dest}"/etc/profile.d/locale.sh "${dest}"/etc/profile.d/zz-locale-user.sh
sed -i 's/locale.conf/locale-user.conf/' "${dest}"/etc/profile.d/zz-locale-user.sh
sed -i '/^if/i [ "$(id -u)" -eq 0 ] && return' "${dest}"/etc/profile.d/zz-locale-user.sh
2021-03-11 14:04:04 +01:00
{ echo "tmpfs /tmp tmpfs defaults,nosuid,nodev 0 0";
echo "/dev/mapper/voidvg.${diskid}-root / btrfs defaults,subvol=void-rootfs 0 0";
echo "/dev/mapper/voidvg.${diskid}-root /home btrfs defaults,subvol=home 0 0";
echo "/dev/mapper/voidvg.${diskid}-swap swap swap defaults 0 0"; } > "${dest}"/etc/fstab
[[ "${cfg[fde_key_store]}" == "once" ]] && echo "UUID=${cfg[bootuuid]} /boot btrfs defaults 0 0" >> "${dest}"/etc/fstab
mkdir -p "${dest}"/etc/sudoers.d
{ echo 'Defaults timestamp_timeout=15';
echo 'Defaults !tty_tickets';
echo 'Defaults umask = 022';
echo 'Defaults passprompt="[sudo] Password: "';
echo '%wheel ALL=(ALL) ALL';
echo 'Defaults editor = /usr/bin/nvim';
echo 'Defaults env_keep += "EDITOR"'; } > "${dest}"/etc/sudoers.d/10-common
mkdir -p "${dest}"/etc/udev/rules.d/
echo 'ENV{ID_FS_USAGE}=="filesystem|other|crypto", ENV{UDISKS_FILESYSTEM_SHARED}="1"' > "${dest}"/etc/udev/rules.d/mount-media.rules
echo 'ACTION=="add|change", KERNEL=="sd[a-z]|mmcblk[0-9]*", ATTR{queue/rotational}=="0", ATTR{queue/scheduler}="mq-deadline"' > "${dest}"/etc/udev/rules.d/60-ioschedulers.rules
mkdir -p "${dest}"/etc/bash/bashrc.d/
2021-03-13 10:50:50 +01:00
{ echo "[ \"\$(id -u)\" -eq 0 ] && return";
echo 'alias xu="sudo xi -Su"';
2021-03-11 14:04:04 +01:00
echo 'alias xr="sudo xbps-install -R"';
echo 'alias xs="xbps-query -Rs"';
echo 'alias xk="sudo vkpurge rm all"';
echo 'echo "xu = sudo xbps-install -Su zum updaten"';
echo 'echo "xi = sudo xbps-install -S zum installieren"';
echo 'echo "xr = sudo xbps-install -R zum deinstallieren"';
2021-03-12 20:14:56 +01:00
echo 'echo "xs = xbps-query -Rs zum suchen"';
2021-03-11 14:04:04 +01:00
echo 'echo "xk = sudo vkpurge rm all zum kernel entfernen"'; } > "${dest}"/etc/bash/bashrc.d/xbps-aliase.sh
echo "${cfg[hostname]}" > "${dest}/etc/hostname"
ln -sf "/usr/share/zoneinfo/${cfg[timezone]}" "${dest}/etc/localtime"
sed -i "s/#HOSTNAME=\"void-live\"/HOSTNAME=${cfg[hostname]}/g" "${dest}/etc/rc.conf"
sed -i "s/Europe\/Madrid/${cfg[timezone]//\//\\/}/" "${dest}/etc/rc.conf"
sed -i "/HARDWARECLOCK/s/^#//g" "${dest}/etc/rc.conf"
sed -i "/FONT=/s/^#//g" "${dest}/etc/rc.conf"
if [[ ! ${cfg[fde_key_store]} == "none" ]]; then
2021-03-13 11:46:15 +01:00
if [[ "${cfg[diskpw]}" == "oem" ]]; then
2021-03-13 11:57:26 +01:00
echo "read -p \"Do you want to change Passwords? y/n \" answer" > "${dest}"/etc/runit/core-services/99-changepwdisk.sh
2021-03-13 12:05:58 +01:00
echo "if [ \"\${answer}\" = \"y\" ]; then" >> "${dest}"/etc/runit/core-services/99-changepwdisk.sh
2021-03-13 11:46:15 +01:00
echo "echo \"Change PW for disk:\"" >> "${dest}"/etc/runit/core-services/99-changepwdisk.sh
echo "cryptsetup luksChangeKey /dev/disk/by-uuid/${cfg[partuuid]}" >> "${dest}"/etc/runit/core-services/99-changepwdisk.sh
echo "rm -rf /etc/runit/core-services/99-changepwdisk.sh" >> "${dest}"/etc/runit/core-services/99-changepwdisk.sh
echo "fi" >> "${dest}"/etc/runit/core-services/99-changepwdisk.sh
fi
2021-03-13 11:46:15 +01:00
if [[ "${users[pw1]}" == "oem" ]]; then
2021-03-13 11:57:26 +01:00
echo "read -p \"Do you want to change Passwords? y/n \" answer" > "${dest}"/etc/runit/core-services/99-changepwuser.sh
2021-03-13 12:05:58 +01:00
echo "if [ \"\${answer}\" = \"y\" ]; then" >> "${dest}"/etc/runit/core-services/99-changepwuser.sh
2021-03-13 11:46:15 +01:00
echo "echo \"Change PW for ${users[name1]}?\"" >> "${dest}"/etc/runit/core-services/99-changepwuser.sh
echo "passwd ${users[name1]}" >> "${dest}"/etc/runit/core-services/99-changepwuser.sh
echo "rm -rf /etc/runit/core-services/99-changepwuser.sh" >> "${dest}"/etc/runit/core-services/99-changepwuser.sh
echo "fi" >> "${dest}"/etc/runit/core-services/99-changepwuser.sh
fi
fi
2021-03-12 16:28:20 +01:00
module end