Skip to content

Commit

Permalink
cmd-build: don't use anaconda
Browse files Browse the repository at this point in the history
Also switch to BLS.
  • Loading branch information
Andrew Jeddeloh committed Jun 14, 2019
1 parent 0b5d859 commit 88faf4d
Show file tree
Hide file tree
Showing 3 changed files with 17 additions and 17 deletions.
10 changes: 9 additions & 1 deletion src/cmd-build
Original file line number Diff line number Diff line change
Expand Up @@ -230,9 +230,17 @@ img_base=tmp/${imageprefix}-base.qcow2
# forgive me for this sin
checksum_location=$(find /usr/lib/coreos-assembler-anaconda/ -name '*CHECKSUM' | head -1)

build_image() {
local size
size="$(python3 -c 'import sys, yaml; print(yaml.load(sys.stdin)["size"])' < "$configdir/image.yaml")G"
qemu-img create -f qcow2 "$workdir/diskimage.qcow2" "$size"
runvm /usr/lib/coreos-assembler/create_disk.sh /dev/vda "$tmprepo" "${ref-:${commit}}" /usr/lib/coreos-assembler/grub.cfg
mv "$workdir/diskimage.qcow2" "$img_base"
}

if [ -n "${build_qemu}" ]; then
img_qemu=${imageprefix}-qemu.qcow2
run_virtinstall "${tmprepo}" "${ref}" "${PWD}"/"${img_base}" --variant=cloud
build_image
/usr/lib/coreos-assembler/gf-platformid "$(pwd)"/"${img_base}" "$(pwd)"/"${img_qemu}" qemu
fi

Expand Down
9 changes: 8 additions & 1 deletion src/cmdlib.sh
Original file line number Diff line number Diff line change
Expand Up @@ -367,6 +367,12 @@ EOF
arch_args='-bios /usr/share/AAVMF/AAVMF_CODE.fd'
fi

# if a disk image exists, attach it too
extradisk=()
if [ -f "${workdir}/diskimage.qcow2" ]; then
extradisk=("-drive" "if=virtio,id=target,format=qcow2,file=${workdir}/diskimage.qcow2")
fi

#shellcheck disable=SC2086
${QEMU_KVM} ${arch_args:-} \
-nodefaults -nographic -m 2048 -no-reboot -cpu host \
Expand All @@ -381,7 +387,8 @@ EOF
-drive if=none,id=drive-scsi0-0-0-1,discard=unmap,file="${workdir}/cache/cache.qcow2" \
-device scsi-hd,bus=scsi0.0,channel=0,scsi-id=0,lun=1,drive=drive-scsi0-0-0-1,id=scsi0-0-0-1 \
-virtfs local,id=workdir,path="${workdir}",security_model=none,mount_tag=workdir \
"${srcvirtfs[@]}" -serial stdio -append "root=/dev/sda console=${VM_TERMINAL} selinux=1 enforcing=0 autorelabel=1"
"${srcvirtfs[@]}" -serial stdio -append "root=/dev/sda console=${VM_TERMINAL} selinux=1 enforcing=0 autorelabel=1" \
"${extradisk[@]}"

if [ ! -f "${workdir}"/tmp/rc ]; then
fatal "Couldn't find rc file, something went terribly wrong!"
Expand Down
15 changes: 0 additions & 15 deletions src/gf-platformid
Original file line number Diff line number Diff line change
Expand Up @@ -38,22 +38,7 @@ chmod u+w "${tmp_dest}"
coreos_gf_run_mount "${tmp_dest}"

# Inject PLATFORM label in all relevant places:
# * grub config
# * BLS config (for subsequent config regeneration)
# First, the grub config.
if [ "$(coreos_gf exists '/boot/efi')" == 'true' ]; then
grubcfg_path=$(coreos_gf glob-expand /boot/efi/EFI/*/grub.cfg)
else
grubcfg_path=/boot/loader/grub.cfg
fi
coreos_gf download "${grubcfg_path}" "${tmpd}"/grub.cfg
# Remove any platformid currently there
sed -i -e 's, ignition.platform.id=[a-zA-Z0-9]*,,g' "${tmpd}"/grub.cfg
# Insert our new platformid
# Match linux16, linux and linuxefi since only linux is available on aarch64
# and linuxefi is available in grub2.cfg for UEFI
sed -i -e 's,^\(linux\(16\|efi\)\? .*\),\1 ignition.platform.id='"${platformid}"',' "${tmpd}"/grub.cfg
coreos_gf upload "${tmpd}"/grub.cfg "${grubcfg_path}"
# Now the BLS version
blscfg_path=$(coreos_gf glob-expand /boot/loader/entries/ostree-*.conf)
coreos_gf download "${blscfg_path}" "${tmpd}"/bls.conf
Expand Down

0 comments on commit 88faf4d

Please sign in to comment.