Skip to content

Commit

Permalink
tests/manual: nettest: make inspecting disk image more dynamic
Browse files Browse the repository at this point in the history
The boot filesystem was moved to partition 3 recently. Let's
update the code to be a little more dynamic about finding the
boot paritition so we can be forward and backward compatible.

For more context see:

- coreos/fedora-coreos-tracker#669
- coreos/coreos-assembler#1820
  • Loading branch information
dustymabe committed Dec 3, 2020
1 parent b118a31 commit 774dca1
Showing 1 changed file with 11 additions and 4 deletions.
15 changes: 11 additions & 4 deletions tests/manual/coreos-network-testing.sh
Original file line number Diff line number Diff line change
Expand Up @@ -476,19 +476,26 @@ main() {
ssh-keygen -N '' -C '' -f $sshkeyfile &>/dev/null
sshpubkey=$(cat $sshpubkeyfile)

# Find out which partition is the boot partition
partition=$(guestfish --ro -a $qcow <<EOF
run
findfs-label boot
exit
EOF
)

# Grab kernel/initramfs from the disk
files=$(virt-ls -a $qcow -m /dev/sda1 -R /ostree/)
files=$(virt-ls -a $qcow -m $partition -R /ostree/)
for f in $files; do
if [[ "${f}" =~ hmac$ ]]; then
# ignore .vmlinuz-5.5.9-200.fc31.x86_64.hmac
true
elif [[ "${f}" =~ img$ ]]; then
# grab initramfs in the form initramfs-5.5.9-200.fc31.x86_64.img
virt-cat -a $qcow -m /dev/sda1 "/ostree/${f}" > $initramfs
virt-cat -a $qcow -m $partition "/ostree/${f}" > $initramfs
elif [[ "${f}" =~ '/vmlinuz' ]]; then
# grab kernel in the form vmlinuz-5.5.9-200.fc31.x86_64
virt-cat -a $qcow -m /dev/sda1 "/ostree/${f}" > $kernel
virt-cat -a $qcow -m $partition "/ostree/${f}" > $kernel
fi
done

Expand Down Expand Up @@ -518,7 +525,7 @@ main() {
# Grab kernel arguments from the disk and use them
# - strip `options ` from the front of the line
# - strip `$ignition_firstboot`
common_args=$(virt-cat -a $qcow -m /dev/sda1 "/loader.1/entries/${bls_file}" | \
common_args=$(virt-cat -a $qcow -m $partition "/loader.1/entries/${bls_file}" | \
grep -P '^options' | \
sed -e 's/options //' | \
sed -e 's/$ignition_firstboot//')
Expand Down

0 comments on commit 774dca1

Please sign in to comment.