From f8e82f2ee4f3afba6138613b1c54836c9c8b90b2 Mon Sep 17 00:00:00 2001 From: Sven Gothel Date: Fri, 9 Jul 2021 19:10:51 +0200 Subject: qcow2_handling: Use fixed PART_NO (at least a variable) --- scripts/qcow2_handling | 5 +++-- 1 file changed, 3 insertions(+), 2 deletions(-) diff --git a/scripts/qcow2_handling b/scripts/qcow2_handling index c81d4b2..bf9acb5 100644 --- a/scripts/qcow2_handling +++ b/scripts/qcow2_handling @@ -263,7 +263,8 @@ function resize_qcow2() { PARTED_OUT=`parted -s -m "$NBD_DEV" unit B print` #PART_NO=`echo "$PARTED_OUT" | grep ext[24] | awk -F: ' { print $1 } '` #PART_START=`echo "$PARTED_OUT" | grep ext[24] | awk -F: ' { print substr($2,1,length($2)-1) } '` - PART_START=`echo "$PARTED_OUT" | grep "^2:" | awk -F: ' { print substr($2,1,length($2)-1) } '` + PART_NO=2 + PART_START=`echo "$PARTED_OUT" | grep "^${PART_NO}:" | awk -F: ' { print substr($2,1,length($2)-1) } '` e2fsck -y -f $MAP_ROOT_DEV || true @@ -276,7 +277,7 @@ function resize_qcow2() { let PART_NEW_SIZE=$DATA_SIZE*$BLOCK_SIZE let PART_NEW_END=$PART_START+$PART_NEW_SIZE - ACT1=`parted -s "$NBD_DEV" rm 2` + ACT1=`parted -s "$NBD_DEV" rm ${PART_NO}` ACT2=`parted -s "$NBD_DEV" unit B mkpart primary $PART_START $PART_NEW_END` NEW_IMG_SIZE=`parted -s -m "$NBD_DEV" unit B print free | tail -1 | awk -F: ' { print substr($2,1,length($2)-1) } '` ROOT_PART_START=$PART_START -- cgit v1.2.3