summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorJames Ruan <ruanbeihong@gmail.com>2017-08-31 18:22:33 +0800
committerXECDesign <XECDesign@users.noreply.github.com>2017-08-31 11:22:33 +0100
commitc0513c547adf7bb85d91ccea97453d7d91ce0c60 (patch)
tree31dd70f239a8b0000c6ef1e3165a3b808ef947f9
parentdc0fb57fb943300902e908bc707a8829f9c1e582 (diff)
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
-rw-r--r--Dockerfile2
-rw-r--r--depends1
-rwxr-xr-xexport-image/03-set-partuuid/00-run.sh2
3 files changed, 3 insertions, 2 deletions
diff --git a/Dockerfile b/Dockerfile
index 2085b7c..d37d6a9 100644
--- a/Dockerfile
+++ b/Dockerfile
@@ -4,7 +4,7 @@ RUN apt-get -y update && \
apt-get -y install \
git vim parted \
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/*
COPY . /pi-gen/
diff --git a/depends b/depends
index b9d0d44..d516533 100644
--- a/depends
+++ b/depends
@@ -12,3 +12,4 @@ grep
rsync
xz:xz-utils
curl
+xxd
diff --git a/export-image/03-set-partuuid/00-run.sh b/export-image/03-set-partuuid/00-run.sh
index dccc55e..4b18405 100755
--- a/export-image/03-set-partuuid/00-run.sh
+++ b/export-image/03-set-partuuid/00-run.sh
@@ -2,7 +2,7 @@
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"
ROOT_PARTUUID="${IMGID}-02"