@@ -10,7 +10,7 @@ Options:
1010 --config: JSON-formatted image.yaml
1111 --help: show this help
1212 --mpp: the path to the OSBuild mpp.yaml file
13- --filepath : where to write the created image file
13+ --outdir : where to write the created files
1414 --platform: the platform to generate an artifact for
1515
1616You probably don't want to run this script by hand. This script is
3939 --config) config=" ${1} " ; shift ;;
4040 --help) usage; exit ;;
4141 --mpp) mppyaml=" ${1} " ; shift ;;
42- --filepath ) filepath =" ${1} " ; shift ;;
42+ --outdir ) outdir =" ${1} " ; shift ;;
4343 --platform) platform=" ${1} " ; shift ;;
4444 * ) echo " ${flag} is not understood." ; usage; exit 10;;
4545 esac ;
4646done
4747
48- # Get the base filename of the desired file output path
49- filename=$( basename " $filepath " )
50-
5148ostree_container=$( getconfig " ostree-container" )
5249osname=$( getconfig " osname" )
5350deploy_via_container=$( getconfig_def " deploy-via-container" " " )
7067# Since it doesn't exist create loop-control
7168[ ! -e /dev/loop-control ] && mknod /dev/loop-control c 10 237
7269
73- # Put the store and the output dir on the cache. At the end we'll mv
74- # out the created artifact from the output dir to the place it's supposed
75- # to go.
76- outdir=cache/osbuild/out
70+ # Put the store on the cache filesystem since in the case we are
71+ # running unprivileged in COSA we won't be able to create files
72+ # with SELinux labels that the host's policy doesn't know about.
7773storedir=cache/osbuild/store
7874
75+ # Musical chairs for now with the outdir because osbuild does
76+ # cp -a and that will fail to preserve ownership when copying
77+ # from the cache qcow2 (where files are owned by root) to the
78+ # virtiofs mount. Eventually we can use idmapped virtiofs mount
79+ # inside the supermin VM and we won't need this.
80+ # https://gitlab.com/virtio-fs/virtiofsd/-/merge_requests/245
81+ orig_outdir=$outdir
82+ outdir=cache/osbuild/out
83+
7984processed_json=$( mktemp -t osbuild-XXXX.json)
8085
8186# Run `podman images` here to initialize a few directories inside the
@@ -90,7 +95,6 @@ osbuild-mpp \
9095 -D arch=\" " $( arch) " \" \
9196 -D ostree_ref=\" " ${ostree_ref} " \" \
9297 -D ostree_repo=\" " ${ostree_repo} " \" \
93- -D filename=\" " ${filename} " \" \
9498 -D ociarchive=\" " ${ostree_container} " \" \
9599 -D osname=\" " ${osname} " \" \
96100 -D container_imgref=\" " ${container_imgref} " \" \
@@ -112,16 +116,5 @@ osbuild \
112116 --checkpoint raw-image \
113117 --export " $platform " " ${processed_json} "
114118
115-
116- # Copy it out to the specified location. Use mv here so we remove it
117- # from the cache qcow2 so we don't cache it.
118- mv " ${outdir} /${platform} /${filename} " " ${filepath} "
119-
120- # In case of IBM Secure Execution there are more artifacts
121- if [ " ${platform} " == ' qemu-secex' ]; then
122- dir=$( dirname " ${filepath} " )
123- mv " ${outdir} /${platform} /bootfs_hash" " ${dir} "
124- mv " ${outdir} /${platform} /rootfs_hash" " ${dir} "
125- fi
126-
119+ mv " ${outdir} " /* " ${orig_outdir} /"
127120rm -f " ${processed_json} "
0 commit comments