refactor: Rename archchroot function to chrt and update user/password setup commands to use the new function.

This commit is contained in:
Zeev Diukman 2026-01-18 09:20:40 +02:00
parent 6c65eddb69
commit 731a6183b9

12
z.sh
View file

@ -7,7 +7,7 @@ selected_disk="/dev/vda"
seed_device="/dev/vda1" seed_device="/dev/vda1"
sprout_device="/dev/vda2" sprout_device="/dev/vda2"
efi_device="/dev/vda3" efi_device="/dev/vda3"
archchroot() { chrt() {
[[ "$1" == "--" ]] && shift [[ "$1" == "--" ]] && shift
local cmd="$*" local cmd="$*"
arch-chroot /mnt /usr/bin/bash -c "$cmd" arch-chroot /mnt /usr/bin/bash -c "$cmd"
@ -159,8 +159,8 @@ fi
pacstrap -K /mnt ${packages[@]} pacstrap -K /mnt ${packages[@]}
mount -m "$efi_device" /mnt/efi mount -m "$efi_device" /mnt/efi
genfstab -U /mnt > /mnt/etc/fstab genfstab -U /mnt > /mnt/etc/fstab
# set root and user passwords
echo "root:root" | arch-chroot /mnt chpasswd chrt -- chpasswd "root:root"
arch-chroot /mnt useradd -m -G wheel -s /usr/bin/bash zeev chrt -- useradd -m -G wheel -s /usr/bin/bash zeev
echo "zeev:zeev" | arch-chroot /mnt chpasswd chrt -- chpasswd "zeev:zeev"
archchroot -- "echo 'zeev ALL=(ALL:ALL) ALL' > /etc/sudoers.d/zeev" chrt -- echo 'zeev ALL=(ALL:ALL) ALL' > /etc/sudoers.d/zeev