diff --git a/localbuild.sh b/localbuild.sh index 26cc4d6c..8e642b40 100755 --- a/localbuild.sh +++ b/localbuild.sh @@ -239,11 +239,12 @@ function resize() { sudo truncate -s ${SIZE}M "${OUTPUT_FILE}" echo -e "d\n\nn\n\n\n\n\nn\nw" | sudo fdisk "${OUTPUT_FILE}" >/dev/null 2>&1 - local LOOPX + local LOOPX LOOPXPY LOOPX=$(sudo losetup -f) sudo losetup -P "${LOOPX}" "${OUTPUT_FILE}" - sudo e2fsck -fp "$(find "${LOOPX}p"* -maxdepth 0 2>/dev/null | sort -n | tail -1)" - sudo resize2fs "$(find "${LOOPX}p"* -maxdepth 0 2>/dev/null | sort -n | tail -1)" + LOOPXPY="$(find "${LOOPX}p"* -maxdepth 0 2>/dev/null | sort -n | tail -1)" + sudo e2fsck -fp "${LOOPXPY:-${LOOPX}p3}" + sudo resize2fs "${LOOPXPY:-${LOOPX}p3}" sudo losetup -d "${LOOPX}" } diff --git a/scripts/func.sh b/scripts/func.sh index 205628c1..72dc97fe 100755 --- a/scripts/func.sh +++ b/scripts/func.sh @@ -314,11 +314,12 @@ function resizeImg() { sudo truncate -s ${SIZE}M "${OUTPUT_FILE}" echo -e "d\n\nn\n\n\n\n\nn\nw" | sudo fdisk "${OUTPUT_FILE}" >/dev/null 2>&1 - local LOOPX + local LOOPX LOOPXPY LOOPX=$(sudo losetup -f) sudo losetup -P "${LOOPX}" "${OUTPUT_FILE}" - sudo e2fsck -fp "$(find "${LOOPX}p"* -maxdepth 0 2>/dev/null | sort -n | tail -1)" - sudo resize2fs "$(find "${LOOPX}p"* -maxdepth 0 2>/dev/null | sort -n | tail -1)" + LOOPXPY="$(find "${LOOPX}p"* -maxdepth 0 2>/dev/null | sort -n | tail -1)" + sudo e2fsck -fp "${LOOPXPY:-${LOOPX}p3}" + sudo resize2fs "${LOOPXPY:-${LOOPX}p3}" sudo losetup -d "${LOOPX}" }