
replace-partition ----------------- A standalone element which consumes a base image which was created with ``diskimage-builder`` and rebuilds it without making any packaging changes. This allows the image contents to be copied to a new block device layout. Use cases for this element include: * Rebuilding a whole-disk image with a different partition layout by setting ``DIB_BLOCK_DEVICE_CONFIG`` * Rebuilding a whole-disk image with the same partitions but with the sector size increased to 4096 bytes replace-partition-redhat ------------------------ A redhat family specific version of the ``replace-partition`` element. Change-Id: I7399c4bf6a4d6acfef43f871df0a40e2961ed44e
27 lines
680 B
Bash
Executable File
27 lines
680 B
Bash
Executable File
#!/bin/bash
|
|
|
|
if [ ${DIB_DEBUG_TRACE:-0} -gt 0 ]; then
|
|
set -x
|
|
fi
|
|
set -eu
|
|
set -o pipefail
|
|
|
|
[ -n "$TARGET_ROOT" ]
|
|
|
|
DIB_LOCAL_IMAGE=${DIB_LOCAL_IMAGE:-""}
|
|
|
|
if [ -n "$DIB_LOCAL_IMAGE" ]; then
|
|
IMAGE_LOCATION=$DIB_LOCAL_IMAGE
|
|
# No need to copy a local image into the cache directory, so just specify
|
|
# the cached path as the original path.
|
|
CACHED_IMAGE=$IMAGE_LOCATION
|
|
else
|
|
echo "DIB_LOCAL_IMAGE is required"
|
|
exit 1
|
|
fi
|
|
|
|
guestfish -v -x -i --blocksize=$DIB_SOURCE_BLOCK_SIZE -a $CACHED_IMAGE <<EOF
|
|
tar-out / - numericowner:true xattrs:true | sudo tar -C $TARGET_ROOT --numeric-owner --xattrs --xattrs-include='*' --xattrs-exclude='security.selinux' -xf -
|
|
EOF
|
|
|