Revert from nspawned env

This commit is contained in:
Tobias Strobel 2022-09-11 20:05:44 +02:00
parent e0384b9d27
commit 86da245a12

View file

@ -223,6 +223,7 @@ basic_packages=(
"htop"
"fzf"
"sudo"
)
#"pipewire"
#"pipewire-pulse"
#"pipewire-jack"
@ -239,7 +240,7 @@ basic_packages=(
#"bluez"
#"bluez-utils"
#"usbutils" # for lsusb
)
#)
all_packages=(
${kernel_packages[@]}
${fs_packages[@]}
@ -254,45 +255,42 @@ genfstab -L -p /mnt >> /mnt/etc/fstab
sed -i "s+LABEL=swap+/dev/mapper/swap+" /mnt/etc/fstab
echo "cryptswap /dev/disk/by-partlabel/cryptswap /dev/urandom swap,cipher=aes-xts-plain64,size=256" >> /mnt/etc/crypttab
systemd-nspawn -bD /mnt
sed -i 's/^#en_US\.UTF-8/en_US\.UTF-8/' /mnt/etc/locale.gen
sed -i 's/^#de_DE\.UTF-8/de_DE\.UTF-8/' /mnt/etc/locale.gen
arch-chroot /mnt locale-gen
sed -i 's/^#en_US\.UTF-8/en_US\.UTF-8/' /etc/locale.gen
sed -i 's/^#de_DE\.UTF-8/de_DE\.UTF-8/' /etc/locale.gen
locale-gen
systemd-firstboot \
arch-chroot /mnt systemd-firstboot \
--locale="en_US.UTF-8" \
--keymap="de-latin1" \
--timezone="Europe/Berlin" \
--hostname="${hostname}" \
--setup-machine-id
echo "FONT=$font" > /etc/vconsole.conf
echo -e "127.0.0.1\tlocalhost" >> /etc/hosts
echo -e "127.0.1.1\t$hostname" >> /etc/hosts
echo -e "\n::1\tlocalhost" >> /etc/hosts
timedatectl set-ntp 1
echo "FONT=$font" > /mnt/etc/vconsole.conf
echo -e "127.0.0.1\tlocalhost" >> /mnt/etc/hosts
echo -e "127.0.1.1\t$hostname" >> /mnt/etc/hosts
echo -e "\n::1\tlocalhost" >> /mnt/etc/hosts
arch-chroot /mnt timedatectl set-ntp 1
echo -e "\n### Creating user"
useradd -m "$user"
arch-chroot /mnt useradd -m "$user"
for group in wheel network video audio input storage power; do
groupadd -rf "$group"
gpasswd -a "$user" "$group"
arch-chroot /mnt groupadd -rf "$group"
arch-chroot /mnt gpasswd -a "$user" "$group"
done
echo "$user:$password" | chpasswd
echo "$user:$password" | arch-chroot /mnt chpasswd
echo -e "\n### Disabling root login"
passwd -dl root
arch-chroot /mnt passwd -dl root
echo -e "\n### Setting permissions on the custom repo"
chown -R "$user:$user" "/var/cache/pacman/${user}-local/"
arch-chroot /mnt chown -R "$user:$user" "/var/cache/pacman/${user}-local/"
#echo -e "\n### Cloning dotfiles and running initial setup"
#sudo -u $user sh -c 'chezmoi init --apply https://code.strobeto.de/strobeltobias/dotfiles.git && chezmoi state delete-bucket --bucket=scriptState'
#arch-chroot /mnt sudo -u $user sh -c 'chezmoi init --apply https://code.strobeto.de/strobeltobias/dotfiles.git && chezmoi state delete-bucket --bucket=scriptState'
cat > /etc/NetworkManager/conf.d/wifi_backend.conf <<EOF
cat > /mnt/etc/NetworkManager/conf.d/wifi_backend.conf <<EOF
[device]
wifi.backend=iwd
EOF
systemctl enable NetworkManager.service
poweroff #exit nspawned environment
arch-chroot /mnt systemctl enable NetworkManager.service
echo -e "\n### DONE - reboot and re-run 'chezmoi apply' to complete system setup"