aboutsummaryrefslogtreecommitdiff
path: root/kiwi-build
diff refs
from: back
to: back
| flip
diff options
context:
space:
mode:
Diffstat (limited to 'kiwi-build')
-rwxr-xr-xkiwi-build29
1 files changed, 22 insertions, 7 deletions
diff --git a/kiwi-build b/kiwi-build
index 7ff247a..0479f42 100755
--- a/kiwi-build
+++ b/kiwi-build
@@ -16,7 +16,7 @@ usage() {
exit 255
}
-optTemp=$(getopt --options '+k:,f:,i,b:,o:,t:,p:,r:,d,h' --longoptions 'kiwi-description-dir:,kiwi-file:,isolated,kiwi-bundle-format:,output-dir:,image-type:,image-profile:,image-release:,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
@@ -29,7 +29,6 @@ kiwi_isolated=
# For compatibility with older scripts where these did not exist
kiwi_description_dir="./"
kiwi_file="Fedora.kiwi"
-kiwi_bundle_format=
kiwibuild_extra_args=
while true; do
@@ -37,7 +36,6 @@ while true; do
-i|--isolated) kiwi_isolated=1; shift ;;
-k|--kiwi-description-dir) kiwi_description_dir="$2" ; shift 2 ;;
-f|--kiwi-file) kiwi_file="$2" ; shift 2 ;;
- -b|--kiwi-bundle-format) kiwi_bundle_format="$2" ; shift 2 ;;
-o|--output-dir) output_dir="$2" ; shift 2 ;;
-t|--image-type) image_type="$2" ; shift 2 ;;
-p|--image-profile) image_profile="$2" ; shift 2 ;;
@@ -56,10 +54,8 @@ if [ -z "$output_dir" ] || [ -z "$image_type" ] || [ -z "$image_profile" ] || [
usage
fi
-if [ -z "$kiwi_bundle_format" ]; then
- # Set the bundle format after we know the profile
- kiwi_bundle_format=$("${kiwibuild_scriptdir}/scripts/fedora-kiwi-bundle-format-generator" "${kiwi_file}" "${image_profile}")
-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
@@ -67,6 +63,18 @@ if [ "$image_type" = "iso" ]; then
kiwibuild_extra_args="${kiwibuild_extra_args:+${kiwibuild_extra_args}} ${kiwibuild_iso_extra_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)"
+ if [ "$selinux_enforcing" = "1" ]; then
+ setenforce 0
+ fi
+fi
set +e
if [ ! ${kiwi_isolated} ]; then
@@ -77,6 +85,13 @@ fi
kiwi_status=$?
set -e
+if [ ! ${kiwi_isolated} ] && [ -e "/sys/fs/selinux/enforce" ]; then
+ # Re-enable SELinux enforcement now that image build is done
+ if [ "$selinux_enforcing" = "1" ]; then
+ setenforce 1
+ 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