image-specs/rpi3-resizerootfs
Christian Schlüter e918d6d0b6
Fix resizerootfs string manipulation
Works with several usb devices plugged in on first boot.
2018-07-17 08:32:30 +02:00

25 lines
317 B
Bash
Executable File

#!/bin/sh
roottmp=$(lsblk -l -o NAME,MOUNTPOINT | grep '/$')
rootpart=/dev/${roottmp%% */}
rootdev=${rootpart%2}
rootdev=${rootdev%p}
flock $rootdev sfdisk -f $rootdev -N 2 <<EOF
,+
EOF
sleep 5
udevadm settle
sleep 5
flock $rootdev partprobe $rootdev
mount -o remount,rw $rootpart
resize2fs $rootpart
exit 0