Skip to content

Commit

Permalink
Serialize grub-script literally into image.json
Browse files Browse the repository at this point in the history
Prep for injecting `image.json` into the ostree commit.  To make
that meaningful, it has to be entirely independent of coreos-assembler.

This bit is crucial for being able to do image builds in a manner
independent of coreos-assembler's content, using solely the ostree
commit as input.
  • Loading branch information
cgwalters committed Apr 10, 2022
1 parent 134e36a commit 8b0a0d1
Show file tree
Hide file tree
Showing 3 changed files with 4 additions and 2 deletions.
3 changes: 3 additions & 0 deletions src/cosalib/cmdlib.py
Original file line number Diff line number Diff line change
Expand Up @@ -354,6 +354,9 @@ def generate_image_json(srcfile):
r = yaml.safe_load(open("/usr/lib/coreos-assembler/image-default.yaml"))
for k, v in flatten_image_yaml(srcfile).items():
r[k] = v
# Serialize our default GRUB config
with open("/usr/lib/coreos-assembler/grub.cfg") as f:
r['grub-script'] = f.read()
return r


Expand Down
2 changes: 1 addition & 1 deletion src/create_disk.sh
Original file line number Diff line number Diff line change
Expand Up @@ -364,7 +364,7 @@ install_grub_cfg() {
# 0700 to match the RPM permissions which I think are mainly in case someone has
# manually set a grub password
mkdir -p -m 0700 $rootfs/boot/grub2
cp -v $grub_script $rootfs/boot/grub2/grub.cfg
printf "%s" "$grub_script" > $rootfs/boot/grub2/grub.cfg
}

# Other arch-specific bootloader changes
Expand Down
1 change: 0 additions & 1 deletion src/image-default.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -4,7 +4,6 @@ bootfs: "ext4"
rootfs: "xfs"
# Add arguments here that will be passed to e.g. mkfs.xfs
rootfs-args: ""
grub-script: "/usr/lib/coreos-assembler/grub.cfg"

# Additional default kernel arguments injected into disk images
extra-kargs: []
Expand Down

0 comments on commit 8b0a0d1

Please sign in to comment.