From 5bb1930a5a3a144cbe2cd390f621d1c893abc5dc Mon Sep 17 00:00:00 2001 From: Ing Date: Thu, 15 May 2025 14:23:59 +0800 Subject: [PATCH] =?UTF-8?q?=E4=BF=AE=E5=A4=8D=20resizeImg=20=E5=87=BD?= =?UTF-8?q?=E6=95=B0=E4=B8=AD=E7=9A=84=E9=80=BB=E8=BE=91=EF=BC=8C=E7=A1=AE?= =?UTF-8?q?=E4=BF=9D=E5=9C=A8=E5=A4=84=E7=90=86=E5=BE=AA=E7=8E=AF=E8=AE=BE?= =?UTF-8?q?=E5=A4=87=E6=97=B6=E4=BD=BF=E7=94=A8=E6=AD=A3=E7=A1=AE=E7=9A=84?= =?UTF-8?q?=E5=88=86=E5=8C=BA?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- localbuild.sh | 7 ++++--- scripts/func.sh | 7 ++++--- 2 files changed, 8 insertions(+), 6 deletions(-) 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}" }