[alpin installer] switch back to sudo

This commit is contained in:
Nico Schottelius 2023-07-18 14:17:12 +02:00
parent 21f95dad13
commit c6d03c7735
1 changed files with 21 additions and 21 deletions

View File

@ -55,27 +55,27 @@ dd if=/dev/zero of=${DISK} bs=1M count=2
case "$BOOT_VIA" in
bios)
doas sfdisk "$DISK" <<EOF
sudo sfdisk "$DISK" <<EOF
label: dos
,,L
EOF
doas hdparm -z $DISK
sudo hdparm -z $DISK
# For creation, if an existing filesystem is on the partitions
doas mkfs.ext4 -F ${partition1}
doas mount -t ext4 ${partition1} $rootfs_tmpdir
sudo mkfs.ext4 -F ${partition1}
sudo mount -t ext4 ${partition1} $rootfs_tmpdir
;;
efi)
doas sfdisk "$DISK" <<EOF
sudo sfdisk "$DISK" <<EOF
label: gpt
,500MiB,U
,,L
EOF
doas hdparm -z $DISK
doas mkfs.vfat ${partition1}
doas mkfs.ext4 -F ${partition2}
doas mount -t ext4 ${partition2} "$rootfs_tmpdir"
doas mkdir "${rootfs_tmpdir}/boot"
doas mount -t vfat ${partition1} "${rootfs_tmpdir}/boot"
sudo hdparm -z $DISK
sudo mkfs.vfat ${partition1}
sudo mkfs.ext4 -F ${partition2}
sudo mount -t ext4 ${partition2} "$rootfs_tmpdir"
sudo mkdir "${rootfs_tmpdir}/boot"
sudo mount -t vfat ${partition1} "${rootfs_tmpdir}/boot"
;;
*)
echo "Unknown disk format, $BOOT_VIA" >&2
@ -84,24 +84,24 @@ EOF
esac
# keep right permissions, use doas
doas tar xf $IMAGE -C $rootfs_tmpdir
# keep right permissions, use sudo
sudo tar xf $IMAGE -C $rootfs_tmpdir
# These are required by grub-install
# And also for generating grub config that contains rootfstype
for dir in dev proc sys; do
doas mount --bind /${dir} ${rootfs_tmpdir}/${dir}
sudo mount --bind /${dir} ${rootfs_tmpdir}/${dir}
done
# Add SSH keys
run_root mkdir -p root/.ssh
doas cp $SSH_KEYS $rootfs_tmpdir/root/.ssh/authorized_keys
sudo cp $SSH_KEYS $rootfs_tmpdir/root/.ssh/authorized_keys
run_root chown root:root /root/.ssh/authorized_keys
run_root chmod 0600 /root/.ssh/authorized_keys
run_root chmod 0700 /root/.ssh
# Import local resolv.conf.
doas cp "$RESOLVCONF" $rootfs_tmpdir/etc/resolv.conf
sudo cp "$RESOLVCONF" $rootfs_tmpdir/etc/resolv.conf
# Generate fstab which is later included in the initramfs
@ -125,7 +125,7 @@ run_root rc-update add sysctl
run_root rc-update add modules
run_root sed -i 's/root:!::0:::::/root:*::0:::::/' /etc/shadow
doas tee "$rootfs_tmpdir/etc/network/interfaces" <<EOF
sudo tee "$rootfs_tmpdir/etc/network/interfaces" <<EOF
auto lo
iface lo inet loopback
@ -135,7 +135,7 @@ iface eth0 inet6 manual
EOF
doas tee "$rootfs_tmpdir/etc/hostname" <<EOF
sudo tee "$rootfs_tmpdir/etc/hostname" <<EOF
alpine-unconfigured
EOF
@ -161,7 +161,7 @@ case "$BOOT_VIA" in
run_root mkdir /boot/EFI/boot
run_root cp /boot/EFI/alpine/grubx64.efi /boot/EFI/boot/bootx64.efi
run_root cp /boot/grub/grub.cfg /boot/EFI/boot/
doas umount ${rootfs_tmpdir}/boot
sudo umount ${rootfs_tmpdir}/boot
;;
esac
@ -171,9 +171,9 @@ run_root cat /etc/fstab
# Cleanup
run_root rm -f /etc/resolv.conf
for dir in dev proc sys; do
doas umount ${rootfs_tmpdir}/${dir}
sudo umount ${rootfs_tmpdir}/${dir}
done
doas umount $rootfs_tmpdir
sudo umount $rootfs_tmpdir
sync
rmdir ${rootfs_tmpdir}