diff options
author | Sven Gothel <[email protected]> | 2021-07-09 19:10:51 +0200 |
---|---|---|
committer | Sven Gothel <[email protected]> | 2021-07-09 19:10:51 +0200 |
commit | f8e82f2ee4f3afba6138613b1c54836c9c8b90b2 (patch) | |
tree | d27254d9ea0a54c5b8b5e598c7a076272b9e660d /scripts | |
parent | 10dfacb2e414bb4067616876a507fdc01b44d143 (diff) |
qcow2_handling: Use fixed PART_NO (at least a variable)
Diffstat (limited to 'scripts')
-rw-r--r-- | scripts/qcow2_handling | 5 |
1 files 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 |