diff --git a/src/cmd-buildextend-metal b/src/cmd-buildextend-metal index 3e5ad56d62..1bd1fdfd34 100755 --- a/src/cmd-buildextend-metal +++ b/src/cmd-buildextend-metal @@ -161,9 +161,6 @@ if [ "$arch" == "s390x" ]; then fi kargs="$kargs $tty ignition.platform.id=$image_type" -ostree_remote="$(python3 -c 'import sys, yaml; print(yaml.safe_load(sys.stdin).get("ostree-remote", "NONE"))' < "$configdir/image.yaml")" -save_var_subdirs="$(python3 -c 'import sys, yaml; print(yaml.safe_load(sys.stdin).get("save-var-subdirs-for-selabel-workaround", "NONE"))' < "$configdir/image.yaml")" - if [ -z "${use_anaconda}" ]; then qemu-img create -f ${image_format} "${path}.tmp" "$size" # In the anaconda path, run_virtinstall dereferences in the ref_is_temp @@ -173,8 +170,11 @@ if [ -z "${use_anaconda}" ]; then ref_arg=${commit} fi - runvm -drive "if=virtio,id=target,format=${image_format},file=${path}.tmp" -- /usr/lib/coreos-assembler/create_disk.sh /dev/vda "$ostree_repo" "${ref_arg}" "${ostree_remote}" /usr/lib/coreos-assembler/grub.cfg "$name" "${save_var_subdirs}" "\"$kargs\"" + # Transcode to JSON so it's easier to parse from shell script + python3 -c 'import sys, yaml, json; json.dump(yaml.safe_load(sys.stdin), sys.stdout)' < "${configdir}/image.yaml" > tmp/image.json + runvm -drive "if=virtio,id=target,format=${image_format},file=${path}.tmp" -- /usr/lib/coreos-assembler/create_disk.sh "$ostree_repo" "${ref_arg}" "$name" "\"$kargs\"" mv "${path}.tmp" "$path" + rm tmp/image.json echo "{}" > tmp/vm-iso-checksum.json else [ "${image_type}" == qemu ] diff --git a/src/cmdlib.sh b/src/cmdlib.sh index ce5302a6b5..244ab56daa 100755 --- a/src/cmdlib.sh +++ b/src/cmdlib.sh @@ -402,6 +402,7 @@ runvm() { set -xeuo pipefail export PATH=/usr/sbin:$PATH workdir=${workdir} +builddir=$(pwd) # use the builder user's id, otherwise some operations like # chmod will set ownership to root, not builder diff --git a/src/create_disk.sh b/src/create_disk.sh index 9270bb50f4..fa7ac23a51 100755 --- a/src/create_disk.sh +++ b/src/create_disk.sh @@ -10,8 +10,8 @@ # an issue and we can discuss configuration needs. set -euo pipefail -if [ "$#" -ne 8 ]; then - echo 'create_disk ' +if [ "$#" -ne 4 ]; then + echo 'create_disk ' exit 1 fi @@ -19,15 +19,16 @@ export PATH=$PATH:/sbin:/usr/sbin arch="$(uname -m)" -disk="$1" && shift +disk=/dev/vda + ostree="$1" && shift ref="$1" && shift -remote_name="$1" && shift -grub_script="$1" && shift os_name="$1" && shift -save_var_subdirs="$1" && shift extrakargs="$1" && shift +remote_name=$(jq -r '.["ostree-remote"]' < tmp/image.json) +save_var_subdirs=$(jq -r '.["save-var-subdirs"]' < tmp/image.json) + set -x # Partition and create fs's. The 0...4...a...1 uuid is a sentinal used by coreos-gpt-setup @@ -90,7 +91,7 @@ ostree admin deploy "${deploy_ref}" --sysroot rootfs --os "$os_name" $kargsargs # See the equivalent code in gf-anaconda-cleanup # /var hack: we'd like to remove all of /var, but SELinux issues prevent that. # see https://github.com/coreos/ignition-dracut/pull/79#issuecomment-488446949 -if [ "${save_var_subdirs}" != NONE ]; then +if [ "${save_var_subdirs}" != "null" ]; then vardir=rootfs/ostree/deploy/${os_name}/var mkdir -p ${vardir}/{home,log/journal,lib/systemd} # And /home is the only one that doesn't have a filename transition today @@ -124,7 +125,7 @@ normal EOF # copy the grub config and any other files we might need - cp $grub_script rootfs/boot/grub2/grub.cfg + cp /usr/lib/coreos-assembler/grub.cfg rootfs/boot/grub2/grub.cfg else # current zipl expects 'title' to be first line, and no blank lines in BLS file # see https://github.com/ibm-s390-tools/s390-tools/issues/64 diff --git a/src/supermin-init-prelude.sh b/src/supermin-init-prelude.sh index e98b8dddab..17b8da5506 100644 --- a/src/supermin-init-prelude.sh +++ b/src/supermin-init-prelude.sh @@ -45,4 +45,4 @@ update-alternatives --install /etc/alternatives/iptables iptables /usr/sbin/ipta update-alternatives --install /etc/alternatives/ip6tables ip6tables /usr/sbin/ip6tables-legacy 1 # https://github.com/koalaman/shellcheck/wiki/SC2164 -cd "${workdir}" || exit +cd "${builddir}" || exit