mirror of
https://github.com/RROrg/rr.git
synced 2025-06-21 05:51:05 +08:00
修复 resizeImg 函数中的逻辑,确保在处理循环设备时使用正确的分区
This commit is contained in:
parent
22852b009a
commit
5bb1930a5a
@ -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}"
|
||||
}
|
||||
|
||||
|
@ -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}"
|
||||
}
|
||||
|
||||
|
Loading…
x
Reference in New Issue
Block a user