Switch to using parted's machine parseable output (#270)
This commit is contained in:
parent
fb23b8ba92
commit
30a1528ae1
|
@ -37,16 +37,12 @@ p
|
|||
w
|
||||
EOF
|
||||
|
||||
PARTED_OUT=$(parted -s "${IMG_FILE}" unit b print)
|
||||
BOOT_OFFSET=$(echo "$PARTED_OUT" | grep -e '^ 1'| xargs echo -n \
|
||||
| cut -d" " -f 2 | tr -d B)
|
||||
BOOT_LENGTH=$(echo "$PARTED_OUT" | grep -e '^ 1'| xargs echo -n \
|
||||
| cut -d" " -f 4 | tr -d B)
|
||||
PARTED_OUT=$(parted -sm "${IMG_FILE}" unit b print)
|
||||
BOOT_OFFSET=$(echo "$PARTED_OUT" | grep -e '^1:' | cut -d':' -f 2 | tr -d B)
|
||||
BOOT_LENGTH=$(echo "$PARTED_OUT" | grep -e '^1:' | cut -d':' -f 4 | tr -d B)
|
||||
|
||||
ROOT_OFFSET=$(echo "$PARTED_OUT" | grep -e '^ 2'| xargs echo -n \
|
||||
| cut -d" " -f 2 | tr -d B)
|
||||
ROOT_LENGTH=$(echo "$PARTED_OUT" | grep -e '^ 2'| xargs echo -n \
|
||||
| cut -d" " -f 4 | tr -d B)
|
||||
ROOT_OFFSET=$(echo "$PARTED_OUT" | grep -e '^2:' | cut -d':' -f 2 | tr -d B)
|
||||
ROOT_LENGTH=$(echo "$PARTED_OUT" | grep -e '^2:' | cut -d':' -f 4 | tr -d B)
|
||||
|
||||
BOOT_DEV=$(losetup --show -f -o "${BOOT_OFFSET}" --sizelimit "${BOOT_LENGTH}" "${IMG_FILE}")
|
||||
ROOT_DEV=$(losetup --show -f -o "${ROOT_OFFSET}" --sizelimit "${ROOT_LENGTH}" "${IMG_FILE}")
|
||||
|
|
|
@ -9,16 +9,12 @@ cp "${WORK_DIR}/export-image/${IMG_FILENAME}${IMG_SUFFIX}.img" "${STAGE_WORK_DIR
|
|||
|
||||
rm -rf "${NOOBS_DIR}"
|
||||
|
||||
PARTED_OUT=$(parted -s "${IMG_FILE}" unit b print)
|
||||
BOOT_OFFSET=$(echo "$PARTED_OUT" | grep -e '^ 1'| xargs echo -n \
|
||||
| cut -d" " -f 2 | tr -d B)
|
||||
BOOT_LENGTH=$(echo "$PARTED_OUT" | grep -e '^ 1'| xargs echo -n \
|
||||
| cut -d" " -f 4 | tr -d B)
|
||||
PARTED_OUT=$(parted -sm "${IMG_FILE}" unit b print)
|
||||
BOOT_OFFSET=$(echo "$PARTED_OUT" | grep -e '^1:' | cut -d':' -f 2 | tr -d B)
|
||||
BOOT_LENGTH=$(echo "$PARTED_OUT" | grep -e '^1:' | cut -d':' -f 4 | tr -d B)
|
||||
|
||||
ROOT_OFFSET=$(echo "$PARTED_OUT" | grep -e '^ 2'| xargs echo -n \
|
||||
| cut -d" " -f 2 | tr -d B)
|
||||
ROOT_LENGTH=$(echo "$PARTED_OUT" | grep -e '^ 2'| xargs echo -n \
|
||||
| cut -d" " -f 4 | tr -d B)
|
||||
ROOT_OFFSET=$(echo "$PARTED_OUT" | grep -e '^2:' | cut -d':' -f 2 | tr -d B)
|
||||
ROOT_LENGTH=$(echo "$PARTED_OUT" | grep -e '^2:' | cut -d':' -f 4 | tr -d B)
|
||||
|
||||
BOOT_DEV=$(losetup --show -f -o "${BOOT_OFFSET}" --sizelimit "${BOOT_LENGTH}" "${IMG_FILE}")
|
||||
ROOT_DEV=$(losetup --show -f -o "${ROOT_OFFSET}" --sizelimit "${ROOT_LENGTH}" "${IMG_FILE}")
|
||||
|
|
Loading…
Reference in New Issue
Block a user