Forked from cgwalters/gist:5741d640f4c2af811f47c043de392c32
Created
December 13, 2019 21:33
-
-
Save hexfusion/94862c0e60b8d3da3b528fa5ec8f1eac to your computer and use it in GitHub Desktop.
Overriding content in an old RHCOS AMI for testing
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
First, given a build like: https://releases-art-rhcos.svc.ci.openshift.org/art/storage/releases/rhcos-4.3/43.81.201911081536.0/x86_64/meta.json | |
Download the qemu image: | |
``` | |
$ curl -L https://releases-art-rhcos.svc.ci.openshift.org/art/storage/releases/rhcos-4.3/43.81.201911081536.0/x86_64/rhcos-43.81.201911081536.0-qemu.x86_64.qcow2.gz | gunzip > rhcos-43.81.201911081536.0-qemu.x86_64.qcow2 | |
``` | |
Download new RPM or other content you want, in this case let's assume it's a new hyperkube we want to drop in `/usr/bin`: | |
`$ curl -L http://example/openshift-hyperkube-4.3.0-201912131246.git.0.09a9468.el8.x86_64.rpm | rpm2cpio | cpio -div` | |
Run libguestfs: | |
``` | |
$ guestfish -a rhcos-43.81.201911081536.0-qemu.x86_64.qcow2 | |
``` | |
Inside libguestfs: | |
``` | |
# run | |
# mount /dev/sda4 / | |
# copy-in ./usr/bin/hyperkube /ostree/deploy/rhcos/deploy/<checksum>/usr/bin | |
# selinux-relabel /ostree/deploy/rhcos/deploy/<checksum>/etc/selinux/targeted/contexts/files/file_contexts /ostree/deploy/rhcos/deploy/<checksum>/usr/bin/hyperkube | |
# sync | |
# exit | |
``` | |
Bless it as an AWS image via coreos-assembler: | |
``` | |
$ /usr/lib/coreos-assembler/gf-oemid rhcos-43.81.201911081536.0-qemu.x86_64.qcow2 aws | |
``` | |
Upload it. | |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment