summaryrefslogtreecommitdiff
diff options
-rwxr-xr-xbin/check_grub_boothole.sh33
-rw-r--r--debian/control2
2 files changed, 34 insertions, 1 deletions
diff --git a/bin/check_grub_boothole.sh b/bin/check_grub_boothole.sh
index 9fe9db9..bede1fb 100755
--- a/bin/check_grub_boothole.sh
+++ b/bin/check_grub_boothole.sh
@@ -115,3 +115,36 @@ if dpkg --compare-versions "$(uname -r)" lt "$TARGET_KERNEL"; then
echo "Kernel version needs to be $TARGET_KERNEL at least, but it is $(uname -r) now."
exit 1
fi
+
+# Check the GRUB EFI file in the recovery partition
+if dpkg-query -W -f='${Status}\n' dell-recovery 2>&1 | grep "install ok installed" >/dev/null 2>&1; then
+ TARGET=$(python3 -c "import Dell.recovery_common as magic; target=magic.find_partition(); print(target.decode('utf8')) if type(target) is bytes else print(target)")
+elif dpkg-query -W -f='${Status}\n' ubuntu-recovery 2>&1 | grep "install ok installed" >/dev/null 2>&1; then
+ TARGET=$(python3 -c "import ubunturecovery.recovery_common as magic; target=magic.find_partition('PQSERVICE'); print(target.decode('utf8')) if type(target) is bytes else print(target)")
+else
+ echo "There is no dell-recovery or ubuntu-recovery partition in this system."
+ exit 0
+fi
+
+DISK=$(mktemp -d)
+
+clean_up ()
+{
+ cd /
+ umount "$DISK"
+ rmdir "$DISK"
+}
+
+trap clean_up EXIT
+mount "$TARGET" "$DISK"
+cd "$DISK" || exit
+
+for efi in efi.factory/boot/grubx64.efi efi/boot/grubx64.efi; do
+ if [ -f "$efi" ]; then
+ VERSION=$(strings "$efi" | grep "${TARGET_GRUB:0:12}")
+ if dpkg --compare-versions "$VERSION" lt "$TARGET_GRUB"; then
+ echo "The version of grubx64.efi in the recovery partition needs to be $TARGET_GRUB at least, but it is $VERSION now."
+ exit 1
+ fi
+ fi
+done
diff --git a/debian/control b/debian/control
index e040f3a..5a09b1e 100644
--- a/debian/control
+++ b/debian/control
@@ -16,7 +16,7 @@ Homepage: https://code.launchpad.net/~oem-qa/oem-qa-checkbox/+git/oem-plainbox
Package: plainbox-provider-oem
Architecture: all
-Depends: ${shlibs:Depends}, ${misc:Depends}, ${plainbox:Depends}, plainbox-provider-certification-client, acpica-tools, smbios-utils
+Depends: ${shlibs:Depends}, ${misc:Depends}, ${plainbox:Depends}, plainbox-provider-certification-client, acpica-tools, smbios-utils, binutils
Recommends: ${plainbox:Recommends}
Suggests: ${plainbox:Suggests}
X-Plainbox-Provider: yes