diff options
| author | Claus F. Strasburger <claus@strasburger.de> | 2017-01-23 13:44:03 +0100 |
|---|---|---|
| committer | XECDesign <XECDesign@users.noreply.github.com> | 2017-01-23 12:44:03 +0000 |
| commit | 667318116acda97b58734ae7512789a0f56db306 (patch) | |
| tree | 3491756abae80c48283fddc41ecb97e8bac0664a /export-image | |
| parent | bc8a74858e0446a2d74b34430a1b3c2ba161c655 (diff) | |
Added Docker support (#40)
* Added Docker support
- replaced necessity for devicemapper (through kpartx) by using parted and
losetup with offsets
- added Dockerfile
- added dependency for parted and grep
- added hints to README.md
- common: loop through unmounts, fix shellcheck warnings
* stage2: use debconf instead of console-setup patch. Fixes #41
Diffstat (limited to 'export-image')
| -rwxr-xr-x | export-image/prerun.sh | 18 |
1 files changed, 15 insertions, 3 deletions
diff --git a/export-image/prerun.sh b/export-image/prerun.sh index e1aa05d..a3581b3 100755 --- a/export-image/prerun.sh +++ b/export-image/prerun.sh @@ -34,9 +34,21 @@ p w EOF -LOOP_DEV=`kpartx -asv ${IMG_FILE} | grep -E -o -m1 'loop[[:digit:]]+' | head -n 1` -BOOT_DEV=/dev/mapper/${LOOP_DEV}p1 -ROOT_DEV=/dev/mapper/${LOOP_DEV}p2 +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) + +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) + +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}) +echo "/boot: offset $BOOT_OFFSET, length $BOOT_LENGTH" +echo "/: offset $ROOT_OFFSET, length $ROOT_LENGTH" mkdosfs -n boot -S 512 -s 16 -v $BOOT_DEV > /dev/null mkfs.ext4 -O ^huge_file $ROOT_DEV > /dev/null |
