Skip to content

Commit

Permalink
build: Add /boot/.coreos-assembler-buildid to target
Browse files Browse the repository at this point in the history
It will be very useful in the future to be able to more rigorously
know the build that a given machine *started* from.  For example,
small tweaks like `chattr +i /sysroot` are things that won't
happen for in-place updates.

If we decide to introduce a mechanism (e.g. systemd
unit) that performs those changes even for old in-place installs,
it could be useful to know exactly what the starting state was.

I chose `/boot` since it's a relatively fixed location which
people generally won't wipe and replace without also erasing
everything else.
  • Loading branch information
cgwalters committed Sep 20, 2019
1 parent 1fe8e03 commit d726202
Show file tree
Hide file tree
Showing 2 changed files with 5 additions and 3 deletions.
2 changes: 1 addition & 1 deletion src/cmd-buildextend-metal
Original file line number Diff line number Diff line change
Expand Up @@ -173,7 +173,7 @@ 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\""
runvm -drive "if=virtio,id=target,format=${image_format},file=${path}.tmp" -- /usr/lib/coreos-assembler/create_disk.sh /dev/vda "${img}" "$ostree_repo" "${ref_arg}" "${ostree_remote}" /usr/lib/coreos-assembler/grub.cfg "$name" "${save_var_subdirs}" "\"$kargs\""
mv "${path}.tmp" "$path"
echo "{}" > tmp/vm-iso-checksum.json
else
Expand Down
6 changes: 4 additions & 2 deletions src/create_disk.sh
Original file line number Diff line number Diff line change
Expand Up @@ -10,8 +10,8 @@
# an issue and we can discuss configuration needs.
set -euo pipefail

if [ "$#" -ne 8 ]; then
echo 'create_disk <device> <ostree-repo> <ostree-ref> <ostree-remote> <grub-script> <os-name> <save-var-subdirs> <space separated kargs>'
if [ "$#" -ne 9 ]; then
echo 'create_disk <device> <buildid> <ostree-repo> <ostree-ref> <ostree-remote> <grub-script> <os-name> <save-var-subdirs> <space separated kargs>'
exit 1
fi

Expand All @@ -20,6 +20,7 @@ export PATH=$PATH:/sbin:/usr/sbin
arch="$(uname -m)"

disk="$1" && shift
buildid="$1" && shift
ostree="$1" && shift
ref="$1" && shift
remote_name="$1" && shift
Expand Down Expand Up @@ -58,6 +59,7 @@ mkdir rootfs/boot
chcon $(matchpathcon -n /boot) rootfs/boot
mount "${disk}1" rootfs/boot
chcon $(matchpathcon -n /boot) rootfs/boot
echo "${buildid}" > rootfs/boot/.coreos-assembler-buildid
mkdir rootfs/boot/efi
# FAT doesn't support SELinux labeling, it uses "genfscon", so we
# don't need to give it a label manually.
Expand Down

0 comments on commit d726202

Please sign in to comment.