diff options
| author | 2024-11-16 20:18:31 -0500 | |
|---|---|---|
| committer | 2024-11-16 20:18:31 -0500 | |
| commit | 2c5cf67014f3c755c2f1b42794f804388a64e35c (patch) | |
| tree | 897fbe1fefe470914607d5731ddcf29a2a3225f2 /kiwi-build | |
| parent | 400c842f0a85a87d767f736f153d607d07cf1311 (diff) | |
| download | kiwi-descriptions-2c5cf67014f3c755c2f1b42794f804388a64e35c.tar.gz kiwi-descriptions-2c5cf67014f3c755c2f1b42794f804388a64e35c.zip | |
kiwi-build: Update to mimic production builds more closely
Production builds in Fedora have a couple extra features:
* ISOs have custom overrides to set the correct volume/app IDs
* Image filenames are structured to follow roughly NVRA format
Now we support these features with extra helper scripts. If a
"image release" value is passed in, then we fully mimic the
production image build process.
This will be particularly useful for making respins of Fedora images
with updates applied.
Diffstat (limited to 'kiwi-build')
| -rwxr-xr-x | kiwi-build | 30 |
1 files changed, 25 insertions, 5 deletions
@@ -6,27 +6,30 @@ set -eu -o pipefail kiwibuildsh="$(basename "$0")" +kiwibuild_scriptdir="$(dirname "$0")" usage() { - echo >&2 "usage: $kiwibuildsh [--kiwi-description-dir=DIR] [--kiwi-file=FILE] [--isolated] --output-dir=DIR --image-type=TYPE --image-profile=PROFILE [--debug]" - echo >&2 " eg: $kiwibuildsh --kiwi-description-dir=/var/tmp/desc --kiwi-file=config.kiwi --output-dir=/var/tmp/work --image-type=oem --image-profile=Cloud-Base-Generic --debug" + echo >&2 "usage: $kiwibuildsh [--kiwi-description-dir=DIR] [--kiwi-file=FILE] [--isolated] --output-dir=DIR --image-type=TYPE --image-profile=PROFILE [--image-release=RELEASEID] [--debug]" + echo >&2 " eg: $kiwibuildsh --kiwi-description-dir=/var/tmp/desc --kiwi-file=config.kiwi --output-dir=/var/tmp/work --image-type=oem --image-profile=Cloud-Base-Generic --image-release=0 --debug" echo >&2 " eg: $kiwibuildsh --output-dir=/var/tmp/work --image-type=oem --image-profile=Cloud-Base-Generic" echo >&2 " eg: $kiwibuildsh --isolated --output-dir=/var/tmp/work --image-type=oem --image-profile=Cloud-Base-Generic" exit 255 } -optTemp=$(getopt --options '+k:,f:,i,o:,t:,p:,d,h' --longoptions 'kiwi-description-dir:,kiwi-file:,isolated,output-dir:,image-type:,image-profile:,debug,help' --name "$kiwibuildsh" -- "$@") +optTemp=$(getopt --options '+k:,f:,i,o:,t:,p:,r:,d,h' --longoptions 'kiwi-description-dir:,kiwi-file:,isolated,output-dir:,image-type:,image-profile:,image-release:,debug,help' --name "$kiwibuildsh" -- "$@") eval set -- "$optTemp" unset optTemp output_dir= image_type= image_profile= +image_release= debug= kiwi_isolated= # For compatibility with older scripts where these did not exist kiwi_description_dir="./" kiwi_file="Fedora.kiwi" +kiwibuild_extra_args= while true; do case "$1" in @@ -36,6 +39,7 @@ while true; do -o|--output-dir) output_dir="$2" ; shift 2 ;; -t|--image-type) image_type="$2" ; shift 2 ;; -p|--image-profile) image_profile="$2" ; shift 2 ;; + -r|--image-release) image_release="$2" ; shift 2 ;; -d|--debug) debug="--debug" ; shift ;; -h|--help) usage ;; --) shift ; break ;; @@ -47,6 +51,19 @@ if [ -z "$output_dir" ] || [ -z "$image_type" ] || [ -z "$image_profile" ] || [ usage fi +# Set the bundle format after we know the profile +kiwi_bundle_format=$("${kiwibuild_scriptdir}/scripts/fedora-kiwi-bundle-format-generator" "${kiwi_file}" "${image_profile}") + +if [ "$image_type" = "iso" ]; then + # Add parameters for embedded ISO IDs + kiwibuild_extra_args=$("${kiwibuild_scriptdir}/scripts/fedora-live-iso-label-generator" "${kiwi_file}" "${image_profile}" --output-kiwi-args) +fi + +if [ "$image_type" = "oci" ]; then + # Extend for OCI images + kiwi_bundle_format="${kiwi_bundle_format}.%T" +fi + if [ ! ${kiwi_isolated} ] && [ -e "/sys/fs/selinux/enforce" ]; then # Disable SELinux enforcement during the image build if it's enforcing selinux_enforcing="$(cat /sys/fs/selinux/enforce)" @@ -57,9 +74,9 @@ fi set +e if [ ! ${kiwi_isolated} ]; then -kiwi-ng ${debug} --type="${image_type}" --profile="${image_profile}" --kiwi-file="${kiwi_file}" --color-output system build --description "${kiwi_description_dir}" --target-dir "${output_dir}" +kiwi-ng ${debug} --type="${image_type}" --profile="${image_profile}" --kiwi-file="${kiwi_file}" --color-output system build --description "${kiwi_description_dir}" --target-dir "${output_dir}-build" ${kiwibuild_extra_args} else -kiwi-ng ${debug} --type="${image_type}" --profile="${image_profile}" --kiwi-file="${kiwi_file}" --color-output system boxbuild --box universal --sshfs-sharing -- --description "${kiwi_description_dir}" --target-dir "${output_dir}" +kiwi-ng ${debug} --type="${image_type}" --profile="${image_profile}" --kiwi-file="${kiwi_file}" --color-output system boxbuild --box universal --sshfs-sharing -- --description "${kiwi_description_dir}" --target-dir "${output_dir}-build" ${kiwibuild_extra_args} fi kiwi_status=$? set -e @@ -71,4 +88,7 @@ if [ ! ${kiwi_isolated} ] && [ -e "/sys/fs/selinux/enforce" ]; then fi fi +if [ "${kiwi_status}" = "0" ] && [ -n "$image_release" ]; then + kiwi-ng ${debug} result bundle --bundle-format="${kiwi_bundle_format}" --target-dir "${output_dir}-build" --bundle-dir "${output_dir}" --id="${image_release}" +fi exit $kiwi_status |