Update alpine version, fix partition bug

This commit is contained in:
Nico Schottelius 2021-07-28 16:32:43 +02:00
parent 715dd03ab5
commit efb7a5f9fa

View file

@ -13,8 +13,8 @@ set -x
DISK=$1; shift
SSH_KEYS=$1; shift
MAJOR_VERSION=3.13
MINOR_VERSION=5
MAJOR_VERSION=3.14
MINOR_VERSION=0
IMAGE=alpine-minirootfs-$MAJOR_VERSION.$MINOR_VERSION-x86_64.tar.gz
RESOLVCONF=/etc/resolv.conf
@ -24,6 +24,19 @@ rootfs_tmpdir=$(mktemp -d)
rootfs_url="http://dl-cdn.alpinelinux.org/alpine/v$MAJOR_VERSION/releases/x86_64/$IMAGE"
case $DISK in
/dev/sd*)
partition=${DISK}1
;;
/dev/mmcblk*|/dev/nvme*)
partition=${DISK}p1
;;
*)
echo "Unsupported disk - edit this script" >&2
exit 1
;;
esac
run_root () {
sudo chroot $rootfs_tmpdir /usr/bin/env \
PATH=/sbin:/bin:/usr/sbin:/usr/bin \
@ -43,9 +56,9 @@ label: dos
EOF
# For creation, if an existing filesystem is on the partitions
sudo mkfs.ext4 -F ${DISK}1
sudo mkfs.ext4 -F ${partition}
sudo mount ${DISK}1 $rootfs_tmpdir
sudo mount ${partition} $rootfs_tmpdir
# keep right permissions, use sudo
sudo tar xf $IMAGE -C $rootfs_tmpdir