[alpine-install-on-disk] switch to doas
This commit is contained in:
parent
0e43bcca1e
commit
1b6a599bcf
1 changed files with 19 additions and 19 deletions
|
@ -55,25 +55,25 @@ dd if=/dev/zero of=${DISK} bs=1M count=2
|
|||
|
||||
case "$BOOT_VIA" in
|
||||
bios)
|
||||
sudo sfdisk "$DISK" <<EOF
|
||||
doas sfdisk "$DISK" <<EOF
|
||||
label: dos
|
||||
,,L
|
||||
EOF
|
||||
# For creation, if an existing filesystem is on the partitions
|
||||
sudo mkfs.ext4 -F ${partition1}
|
||||
sudo mount -t ext4 ${partition1} $rootfs_tmpdir
|
||||
doas mkfs.ext4 -F ${partition1}
|
||||
doas mount -t ext4 ${partition1} $rootfs_tmpdir
|
||||
;;
|
||||
efi)
|
||||
sudo sfdisk "$DISK" <<EOF
|
||||
doas sfdisk "$DISK" <<EOF
|
||||
label: gpt
|
||||
,500MiB,U
|
||||
,,L
|
||||
EOF
|
||||
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"
|
||||
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"
|
||||
;;
|
||||
*)
|
||||
echo "Unknown disk format, $BOOT_VIA" >&2
|
||||
|
@ -82,24 +82,24 @@ EOF
|
|||
esac
|
||||
|
||||
|
||||
# keep right permissions, use sudo
|
||||
sudo tar xf $IMAGE -C $rootfs_tmpdir
|
||||
# keep right permissions, use doas
|
||||
doas 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
|
||||
sudo mount --bind /${dir} ${rootfs_tmpdir}/${dir}
|
||||
doas mount --bind /${dir} ${rootfs_tmpdir}/${dir}
|
||||
done
|
||||
|
||||
# Add SSH keys
|
||||
run_root mkdir -p root/.ssh
|
||||
sudo cp $SSH_KEYS $rootfs_tmpdir/root/.ssh/authorized_keys
|
||||
doas 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.
|
||||
sudo cp "$RESOLVCONF" $rootfs_tmpdir/etc/resolv.conf
|
||||
doas cp "$RESOLVCONF" $rootfs_tmpdir/etc/resolv.conf
|
||||
|
||||
# Generate fstab which is later included in the initramfs
|
||||
|
||||
|
@ -123,7 +123,7 @@ run_root rc-update add sysctl
|
|||
run_root rc-update add modules
|
||||
run_root sed -i 's/root:!::0:::::/root:*::0:::::/' /etc/shadow
|
||||
|
||||
sudo tee "$rootfs_tmpdir/etc/network/interfaces" <<EOF
|
||||
doas tee "$rootfs_tmpdir/etc/network/interfaces" <<EOF
|
||||
auto lo
|
||||
iface lo inet loopback
|
||||
|
||||
|
@ -133,7 +133,7 @@ iface eth0 inet6 manual
|
|||
|
||||
EOF
|
||||
|
||||
sudo tee "$rootfs_tmpdir/etc/hostname" <<EOF
|
||||
doas tee "$rootfs_tmpdir/etc/hostname" <<EOF
|
||||
alpine-unconfigured
|
||||
EOF
|
||||
|
||||
|
@ -159,7 +159,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/
|
||||
sudo umount ${rootfs_tmpdir}/boot
|
||||
doas umount ${rootfs_tmpdir}/boot
|
||||
;;
|
||||
esac
|
||||
|
||||
|
@ -169,9 +169,9 @@ run_root cat /etc/fstab
|
|||
# Cleanup
|
||||
run_root rm -f /etc/resolv.conf
|
||||
for dir in dev proc sys; do
|
||||
sudo umount ${rootfs_tmpdir}/${dir}
|
||||
doas umount ${rootfs_tmpdir}/${dir}
|
||||
done
|
||||
sudo umount $rootfs_tmpdir
|
||||
doas umount $rootfs_tmpdir
|
||||
|
||||
sync
|
||||
rmdir ${rootfs_tmpdir}
|
||||
|
|
Loading…
Reference in a new issue