From b5d80cb8e2927cb55d8d5ecbaedc6d0069851a3f Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Jonas=20Ho=CC=88chst?= Date: Tue, 9 Nov 2021 12:13:56 +0100 Subject: [PATCH] Bugfix: PARTUUIDs got rewritten by parted As discussed in Issue #42, parted seems to replace partuuids in the partition table. The error is well-known but seems not to be fixed in parted. Thus parted is replaced by sfdisk, which is an fdisk variant, to be used in scripts. Closes #42. --- .github/workflows/tests.yml | 2 +- CHANGELOG.md | 4 ++++ Dockerfile | 2 +- README.md | 2 +- action.yml | 2 +- examples/Jetson.Pifile | 3 +++ stages/20-prepare.sh | 5 +---- 7 files changed, 12 insertions(+), 8 deletions(-) create mode 100644 examples/Jetson.Pifile diff --git a/.github/workflows/tests.yml b/.github/workflows/tests.yml index 2599b21..fa6ed72 100644 --- a/.github/workflows/tests.yml +++ b/.github/workflows/tests.yml @@ -17,7 +17,7 @@ jobs: submodules: recursive - name: Install dependencies - run: sudo apt-get update && sudo apt-get install -y binfmt-support file kpartx lsof p7zip-full parted qemu qemu-user-static unzip wget xz-utils units + run: sudo apt-get update && sudo apt-get install -y binfmt-support fdisk file kpartx lsof p7zip-full qemu qemu-user-static unzip wget xz-utils units shell: bash - name: Run pimod OpenWRT example diff --git a/CHANGELOG.md b/CHANGELOG.md index 71f8f8a..475f33d 100644 --- a/CHANGELOG.md +++ b/CHANGELOG.md @@ -6,6 +6,10 @@ and this project adheres to [Semantic Versioning](https://semver.org/spec/v2.0.0 ## [Unreleased] +## [0.4.3] - 2021-11-09 +### Fixed +- PARTUUIDs got rewritten by parted - replaced by sfdisk + ## [0.4.2] - 2021-11-04 ### Fixed - Limitedness of PUMP command diff --git a/Dockerfile b/Dockerfile index e0ca829..769d183 100644 --- a/Dockerfile +++ b/Dockerfile @@ -7,11 +7,11 @@ LABEL version="0.2.1" RUN apt-get update && \ apt-get install -y \ binfmt-support \ + fdisk \ file \ kpartx \ lsof \ p7zip-full \ - parted \ qemu \ qemu-user-static \ unzip \ diff --git a/README.md b/README.md index 11f62d0..8b4d549 100644 --- a/README.md +++ b/README.md @@ -47,7 +47,7 @@ Options: ### Debian ```bash -sudo apt-get install binfmt-support file kpartx lsof p7zip-full parted qemu qemu-user-static unzip wget xz-utils +sudo apt-get install binfmt-support fdisk file kpartx lsof p7zip-full qemu qemu-user-static unzip wget xz-utils sudo ./pimod.sh Pifile ``` diff --git a/action.yml b/action.yml index 98752e2..99b72ad 100644 --- a/action.yml +++ b/action.yml @@ -14,7 +14,7 @@ runs: steps: - run: sudo apt-get update shell: bash - - run: sudo apt-get install -y binfmt-support file kpartx parted qemu qemu-user-static unzip p7zip-full wget xz-utils units + - run: sudo apt-get install -y binfmt-support fdisk file kpartx qemu qemu-user-static unzip p7zip-full wget xz-utils units shell: bash - run: sudo ${{ github.action_path }}/pimod.sh ${{ inputs.pifile }} shell: bash diff --git a/examples/Jetson.Pifile b/examples/Jetson.Pifile new file mode 100644 index 0000000..5b14e20 --- /dev/null +++ b/examples/Jetson.Pifile @@ -0,0 +1,3 @@ +FROM https://developer.nvidia.com/jetson-nano-sd-card-image 1 + +PUMP 100M diff --git a/stages/20-prepare.sh b/stages/20-prepare.sh index 35a36cd..c28d79e 100644 --- a/stages/20-prepare.sh +++ b/stages/20-prepare.sh @@ -26,10 +26,7 @@ PUMP() { dd if=/dev/zero bs="${BS}" count="${COUNT}" >> "${DEST_IMG}" - # Fix the GPT if necessary and resize the partition afterwards. - # The fix is currently kind of hackish.. - echo -e "Fix\n" | parted ---pretend-input-tty "${DEST_IMG}" print - parted -s "${DEST_IMG}" resizepart "${IMG_ROOT}" "100%" + echo ", +" | sfdisk -N "${IMG_ROOT}" "${DEST_IMG}" local loop loop=$(mount_image "${DEST_IMG}")