File: 10-local-image-extract

package info (click to toggle)
python-diskimage-builder 3.39.0-1
  • links: PTS, VCS
  • area: main
  • in suites: experimental
  • size: 5,704 kB
  • sloc: sh: 7,474; python: 6,454; makefile: 37
file content (26 lines) | stat: -rwxr-xr-x 680 bytes parent folder | download | duplicates (2)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
#!/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