summaryrefslogtreecommitdiff
path: root/scripts
diff options
context:
space:
mode:
authorMaxim Devaev <[email protected]>2022-04-21 16:32:18 +0300
committerMaxim Devaev <[email protected]>2022-04-21 16:32:18 +0300
commited8d2af9994b94cd60a44ba3f95547f2c210b036 (patch)
treeda5ff0ef159cc7bfcefa4bfe243c14d092c1fb73 /scripts
parenta88757ca7c7cb8b09024ec659176dcca4c31f619 (diff)
pikvm/pikvm#604: support partition LABEL in bootconfig
Diffstat (limited to 'scripts')
-rwxr-xr-xscripts/kvmd-bootconfig20
1 files changed, 16 insertions, 4 deletions
diff --git a/scripts/kvmd-bootconfig b/scripts/kvmd-bootconfig
index 670307ef..16ccd593 100755
--- a/scripts/kvmd-bootconfig
+++ b/scripts/kvmd-bootconfig
@@ -62,10 +62,22 @@ if [ -n "$FIRSTBOOT$FIRST_BOOT" ]; then
kvmd-gencert --do-the-thing --vnc
if grep -q 'X-kvmd\.otgmsd' /etc/fstab; then
- umount /dev/mmcblk0p3
- parted /dev/mmcblk0 -a optimal -s resizepart 3 100%
- yes | mkfs.ext4 -F -m 0 /dev/mmcblk0p3
- mount /dev/mmcblk0p3
+ part=`grep 'X-kvmd\.otgmsd' /etc/fstab | awk '{print $1}'`
+ splitted=(${part//=/ })
+ if [ ${splitted[0]} == "LABEL" ]; then
+ label=${splitted[1]}
+ part=`blkid -c /dev/null -L $label`
+ else
+ label=PIMSD
+ fi
+ unset splitted
+ disk=/dev/`lsblk -no pkname $part`
+ npart=`cat /sys/class/block/${part//\/dev\//}/partition`
+ umount $part
+ parted $disk -a optimal -s resizepart $npart 100%
+ yes | mkfs.ext4 -L $label -F -m 0 $part
+ mount $part
+ unset disk part npart label
fi
# fc-cache is required for installed X server