File: 10-rhel-cloud-image

package info (click to toggle)
python-diskimage-builder 3.37.0-2
  • links: PTS, VCS
  • area: main
  • in suites: trixie
  • size: 5,572 kB
  • sloc: sh: 7,380; python: 6,444; makefile: 37
file content (46 lines) | stat: -rwxr-xr-x 1,388 bytes parent folder | download | duplicates (3)
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
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
#!/bin/bash

if [ ${DIB_DEBUG_TRACE:-0} -gt 0 ]; then
    set -x
fi
set -eu
set -o pipefail

[ -n "$ARCH" ]
[ -n "$TARGET_ROOT" ]

if [[ "amd64 x86_64" =~ "$ARCH" ]]; then
    ARCH="x86_64"
elif [[ "$ARCH" =~ (arm64|aarch64) ]]; then
    ARCH="aarch64"
elif [[ "ppc64le" =~ "$ARCH" ]]; then
    # We don't need to do anything here other than avoid the else clause
    :
else
    echo 'rhel root element only supports x86_64, aarch64 and ppc64le values for $ARCH'
    exit 1
fi

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
    BASE_IMAGE_FILE=`basename $DIB_LOCAL_IMAGE`
    BASE_IMAGE_TAR=$BASE_IMAGE_FILE.tgz
else
    if [ -z "${BASE_IMAGE_FILE:-}" -o -z "${DIB_CLOUD_IMAGES:-}" ]; then
        echo "No source for a base image file configured."
        echo "See rhel element readme for details on how to obtain and use a base image."
        exit 1
    fi
    DIB_RELEASE=${DIB_RELEASE:-latest}
    BASE_IMAGE_TAR=$DIB_RELEASE-rhel-server-$ARCH-latest.tgz
    IMAGE_LOCATION=$DIB_CLOUD_IMAGES/$BASE_IMAGE_FILE
    CACHED_IMAGE=$DIB_IMAGE_CACHE/$BASE_IMAGE_FILE

fi

$TMP_HOOKS_PATH/bin/extract-image $BASE_IMAGE_FILE $BASE_IMAGE_TAR $IMAGE_LOCATION $CACHED_IMAGE