kiwi-build: Add support for setting the kiwi description directory

Generally, the kiwi descriptions are in the same directory, but
when this script is being called out-of-tree, it needs to be told
where they are.
This commit is contained in:
Neal Gompa 2023-12-18 18:59:25 -05:00
parent f5632edf2b
commit 80a1081de6

View File

@ -8,16 +8,17 @@ set -eu -o pipefail
kiwibuildsh="$(basename "$0")" kiwibuildsh="$(basename "$0")"
usage() { usage() {
echo >&2 "usage: $kiwibuildsh --output-dir=DIR --image-type=TYPE --image-profile=PROFILE [--debug]" echo >&2 "usage: $kiwibuildsh [--kiwi-description-dir=DIR] --output-dir=DIR --image-type=TYPE --image-profile=PROFILE [--debug]"
echo >&2 " eg: $kiwibuildsh --output-dir=/var/tmp/work --image-type=oem --image-profile=cloud --debug" echo >&2 " eg: $kiwibuildsh --kiwi-description-dir=/var/tmp/desc --output-dir=/var/tmp/work --image-type=oem --image-profile=cloud --debug"
echo >&2 " eg: $kiwibuildsh --output-dir=/var/tmp/work --image-type=oem --image-profile=cloud" echo >&2 " eg: $kiwibuildsh --output-dir=/var/tmp/work --image-type=oem --image-profile=cloud"
exit 255 exit 255
} }
optTemp=$(getopt --options '+o:,t:,p:,d,h' --longoptions 'output-dir:,image-type:,image-profile:,debug,help' --name "$kiwibuildsh" -- "$@") optTemp=$(getopt --options '+k:,o:,t:,p:,d,h' --longoptions 'kiwi-description-dir:,output-dir:,image-type:,image-profile:,debug,help' --name "$kiwibuildsh" -- "$@")
eval set -- "$optTemp" eval set -- "$optTemp"
unset optTemp unset optTemp
kiwi_description_dir="./"
output_dir= output_dir=
image_type= image_type=
image_profile= image_profile=
@ -25,6 +26,7 @@ debug=
while true; do while true; do
case "$1" in case "$1" in
-k|--kiwi-description-dir) kiwi_description_dir="$2" ; shift 2 ;;
-o|--output-dir) output_dir="$2" ; shift 2 ;; -o|--output-dir) output_dir="$2" ; shift 2 ;;
-t|--image-type) image_type="$2" ; shift 2 ;; -t|--image-type) image_type="$2" ; shift 2 ;;
-p|--image-profile) image_profile="$2" ; shift 2 ;; -p|--image-profile) image_profile="$2" ; shift 2 ;;
@ -47,12 +49,10 @@ if [ -e "/sys/fs/selinux/enforce" ]; then
fi fi
fi fi
pushd kiwi-desc
set +e set +e
kiwi-ng ${debug} --type="${image_type}" --profile="${image_profile}" --color-output system build --description "./" --target-dir "${output_dir}" kiwi-ng ${debug} --type="${image_type}" --profile="${image_profile}" --color-output system build --description "${kiwi_description_dir}" --target-dir "${output_dir}"
kiwi_status=$? kiwi_status=$?
set -e set -e
popd
if [ -e "/sys/fs/selinux/enforce" ]; then if [ -e "/sys/fs/selinux/enforce" ]; then
# Re-enable SELinux enforcement now that image build is done # Re-enable SELinux enforcement now that image build is done