export-image: when work in a non-English locale environment the PARTUUID will silently fail, resulting to an unbootable image file. (#96)

* use dd and xxd to get disk identifier

* add xxd as dependency
This commit is contained in:
James Ruan 2017-08-31 18:22:33 +08:00 committed by XECDesign
parent dc0fb57fb9
commit c0513c547a
3 changed files with 3 additions and 2 deletions

View File

@ -4,7 +4,7 @@ RUN apt-get -y update && \
apt-get -y install \ apt-get -y install \
git vim parted \ git vim parted \
quilt realpath qemu-user-static debootstrap zerofree pxz zip dosfstools \ quilt realpath qemu-user-static debootstrap zerofree pxz zip dosfstools \
bsdtar libcap2-bin rsync grep udev xz-utils curl \ bsdtar libcap2-bin rsync grep udev xz-utils curl xxd \
&& rm -rf /var/lib/apt/lists/* && rm -rf /var/lib/apt/lists/*
COPY . /pi-gen/ COPY . /pi-gen/

View File

@ -12,3 +12,4 @@ grep
rsync rsync
xz:xz-utils xz:xz-utils
curl curl
xxd

View File

@ -2,7 +2,7 @@
IMG_FILE="${STAGE_WORK_DIR}/${IMG_DATE}-${IMG_NAME}${IMG_SUFFIX}.img" IMG_FILE="${STAGE_WORK_DIR}/${IMG_DATE}-${IMG_NAME}${IMG_SUFFIX}.img"
IMGID="$(fdisk -l ${IMG_FILE} | sed -n 's/Disk identifier: 0x\([^ ]*\)/\1/p')" IMGID="$(dd if=${IMG_FILE} skip=440 bs=1 count=4 2>/dev/null | xxd -e | cut -f 2 -d' ')"
BOOT_PARTUUID="${IMGID}-01" BOOT_PARTUUID="${IMGID}-01"
ROOT_PARTUUID="${IMGID}-02" ROOT_PARTUUID="${IMGID}-02"