simplify grub & sudoers sed expressions

This commit is contained in:
i-c-u-p 2022-04-25 09:54:37 +00:00
parent c56fbb9878
commit 7797b19331
No known key found for this signature in database
GPG key ID: ABB80C12170FC0D1

View file

@ -324,7 +324,7 @@ EOF
# Setting up LUKS2 encryption in grub. # Setting up LUKS2 encryption in grub.
print "Setting up grub config." print "Setting up grub config."
UUID=$(blkid -s UUID -o value $CRYPTROOT) UUID=$(blkid -s UUID -o value $CRYPTROOT)
sed -i "s,^GRUB_CMDLINE_LINUX=\"\",GRUB_CMDLINE_LINUX=\"rd.luks.name=$UUID=cryptroot root=$BTRFS\",g" /mnt/etc/default/grub sed -i "s,^GRUB_CMDLINE_LINUX=\",&rd.luks.name=$UUID=cryptroot root=$BTRFS\",g" /mnt/etc/default/grub
# Configuring the system. # Configuring the system.
arch-chroot /mnt /bin/bash -e <<EOF arch-chroot /mnt /bin/bash -e <<EOF
@ -373,7 +373,7 @@ echo "root:$rootpass" | arch-chroot /mnt chpasswd
if [ -n "$username" ]; then if [ -n "$username" ]; then
print "Adding the user $username to the system with root privilege." print "Adding the user $username to the system with root privilege."
arch-chroot /mnt useradd -m -G wheel -s /bin/bash "$username" arch-chroot /mnt useradd -m -G wheel -s /bin/bash "$username"
sed -i 's/# %wheel ALL=(ALL) ALL/%wheel ALL=(ALL) ALL/' /mnt/etc/sudoers sed -i '%wheel ALL=(ALL) ALL/s/^# //' /mnt/etc/sudoers
print "Setting user password for $username." print "Setting user password for $username."
echo "$username:$userpass" | arch-chroot /mnt chpasswd echo "$username:$userpass" | arch-chroot /mnt chpasswd
fi fi