forked from coreos/fedora-coreos-config
-
Notifications
You must be signed in to change notification settings - Fork 0
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
tests: verify using the target system's grub2-install to install
bootloader See coreos/coreos-assembler#3190 (comment)
- Loading branch information
1 parent
94dde18
commit 0bfab01
Showing
1 changed file
with
60 additions
and
0 deletions.
There are no files selected for viewing
This file contains 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
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,60 @@ | ||
#!/bin/bash | ||
|
||
# Verify to install BIOS/PReP bootloader using grub2-install from | ||
# the target system. | ||
# See: | ||
# - https://github.com/coreos/coreos-assembler/pull/3190 | ||
# - https://github.com/coreos/coreos-assembler/issues/3148 | ||
|
||
## kola: | ||
## # This test should pass everywhere if it passes anywhere. | ||
## platforms: qemu | ||
## # The test is not available for aarch64 and s390x, | ||
## # as aarch64 is UEFI only and s390x is not using grub2 | ||
## architectures: "!aarch64 s390x" | ||
set -xeuo pipefail | ||
|
||
. $KOLA_EXT_DATA/commonlib.sh | ||
|
||
boot_dev=/boot | ||
core= | ||
device= | ||
target= | ||
arch=$(arch) | ||
case ${arch} in | ||
x86_64) | ||
target=i386-pc | ||
core="${boot_dev}/grub2/${target}/core.img" | ||
device=$(findmnt -no SOURCE ${boot_dev} | sed 's/[0-9]$//g') | ||
|
||
[ -e ${core} ] || fatal "file ${core} doesn't exist" | ||
core_sum=$(sha256sum ${core} | awk '{print $1}') | ||
|
||
mount -o remount,rw ${boot_dev} | ||
grub2-install --target ${target} --boot-directory ${boot_dev} --modules mdraid1x ${device} | ||
;; | ||
|
||
ppc64le) | ||
target=powerpc-ieee1275 | ||
core="${boot_dev}/grub2/${target}/core.elf" | ||
device=$(findfs PARTLABEL=PowerPC-PReP-boot) | ||
|
||
[ -e ${core} ] || fatal "file ${core} doesn't exist" | ||
core_sum=$(sha256sum ${core} | awk '{print $1}') | ||
|
||
mount -o remount,rw ${boot_dev} | ||
grub2-install --target ${target} --boot-directory ${boot_dev} --no-nvram ${device} | ||
;; | ||
|
||
*) | ||
fatal "grub2-install testing is not supported on ${arch}" | ||
;; | ||
esac | ||
|
||
new_core_sum=$(sha256sum ${core} | awk '{print $1}') | ||
|
||
# compare core.img checksum before and after run grub2-install | ||
if [ "${core_sum}" != "${new_core_sum}" ]; then | ||
fatal "Error: not using grub2-install from target system" | ||
fi | ||
ok "using grub2-install from target system on ${arch}" |