Skip to content

Commit c9036fa

Browse files
committed
Serialize grub-script literally into image.json
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.
1 parent 37f6c2a commit c9036fa

File tree

3 files changed

+4
-2
lines changed

3 files changed

+4
-2
lines changed

src/cosalib/cmdlib.py

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -354,6 +354,9 @@ def generate_image_json(srcfile):
354354
r = yaml.safe_load(open("/usr/lib/coreos-assembler/image-default.yaml"))
355355
for k, v in flatten_image_yaml(srcfile).items():
356356
r[k] = v
357+
# Serialize our default GRUB config
358+
with open("/usr/lib/coreos-assembler/grub.cfg") as f:
359+
r['grub-script'] = f.read()
357360
return r
358361

359362

src/create_disk.sh

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -364,7 +364,7 @@ install_grub_cfg() {
364364
# 0700 to match the RPM permissions which I think are mainly in case someone has
365365
# manually set a grub password
366366
mkdir -p -m 0700 $rootfs/boot/grub2
367-
cp -v $grub_script $rootfs/boot/grub2/grub.cfg
367+
printf "%s" "$grub_script" > $rootfs/boot/grub2/grub.cfg
368368
}
369369

370370
# Other arch-specific bootloader changes

src/image-default.yaml

Lines changed: 0 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -4,7 +4,6 @@ bootfs: "ext4"
44
rootfs: "xfs"
55
# Add arguments here that will be passed to e.g. mkfs.xfs
66
rootfs-args: ""
7-
grub-script: "/usr/lib/coreos-assembler/grub.cfg"
87

98
# Additional default kernel arguments injected into disk images
109
extra-kargs: []

0 commit comments

Comments
 (0)