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" "htop"
"fzf" "fzf"
"sudo" "sudo"
)
#"pipewire" #"pipewire"
#"pipewire-pulse" #"pipewire-pulse"
#"pipewire-jack" #"pipewire-jack"
@ -239,7 +240,7 @@ basic_packages=(
#"bluez" #"bluez"
#"bluez-utils" #"bluez-utils"
#"usbutils" # for lsusb #"usbutils" # for lsusb
) #)
all_packages=( all_packages=(
${kernel_packages[@]} ${kernel_packages[@]}
${fs_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 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 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 arch-chroot /mnt systemd-firstboot \
sed -i 's/^#de_DE\.UTF-8/de_DE\.UTF-8/' /etc/locale.gen
locale-gen
systemd-firstboot \
--locale="en_US.UTF-8" \ --locale="en_US.UTF-8" \
--keymap="de-latin1" \ --keymap="de-latin1" \
--timezone="Europe/Berlin" \ --timezone="Europe/Berlin" \
--hostname="${hostname}" \ --hostname="${hostname}" \
--setup-machine-id --setup-machine-id
echo "FONT=$font" > /etc/vconsole.conf echo "FONT=$font" > /mnt/etc/vconsole.conf
echo -e "127.0.0.1\tlocalhost" >> /etc/hosts echo -e "127.0.0.1\tlocalhost" >> /mnt/etc/hosts
echo -e "127.0.1.1\t$hostname" >> /etc/hosts echo -e "127.0.1.1\t$hostname" >> /mnt/etc/hosts
echo -e "\n::1\tlocalhost" >> /etc/hosts echo -e "\n::1\tlocalhost" >> /mnt/etc/hosts
timedatectl set-ntp 1 arch-chroot /mnt timedatectl set-ntp 1
echo -e "\n### Creating user" 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 for group in wheel network video audio input storage power; do
groupadd -rf "$group" arch-chroot /mnt groupadd -rf "$group"
gpasswd -a "$user" "$group" arch-chroot /mnt gpasswd -a "$user" "$group"
done done
echo "$user:$password" | chpasswd echo "$user:$password" | arch-chroot /mnt chpasswd
echo -e "\n### Disabling root login" echo -e "\n### Disabling root login"
passwd -dl root arch-chroot /mnt passwd -dl root
echo -e "\n### Setting permissions on the custom repo" 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" #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] [device]
wifi.backend=iwd wifi.backend=iwd
EOF EOF
systemctl enable NetworkManager.service arch-chroot /mnt systemctl enable NetworkManager.service
poweroff #exit nspawned environment
echo -e "\n### DONE - reboot and re-run 'chezmoi apply' to complete system setup" echo -e "\n### DONE - reboot and re-run 'chezmoi apply' to complete system setup"