summaryrefslogtreecommitdiff
diff options
authorPMR <pmr@pmr-lander>2016-12-22 19:35:57 +0000
committerPMR <pmr@pmr-lander>2016-12-22 19:35:57 +0000
commit69c1c2ead2e1bfa833b4c6ce1852cb36b9016b9d (patch)
tree4af36b59294c2b1af409583b59b7199e0ebcd66a
parente4ac37b13e5b77cf592db32568bffebf92d484c4 (diff)
parent9fcd4cb386de8ed076c11405dc3f8cb8f2b0771e (diff)
Merge #309798 from ~bladernr/plainbox-provider-checkbox:fix-efi-boot-test
-rwxr-xr-xbin/boot_mode_test35
1 files changed, 30 insertions, 5 deletions
diff --git a/bin/boot_mode_test b/bin/boot_mode_test
index d4c2956..330bb2b 100755
--- a/bin/boot_mode_test
+++ b/bin/boot_mode_test
@@ -24,6 +24,35 @@ import os
import sys
import logging
from argparse import ArgumentParser
+from platform import linux_distribution
+
+
+def version_check(check):
+ """Check the installed Ubuntu version to see if it is older than 16.04
+ (Xenial) and run the requested check
+
+ :returns:
+ 0 if if the installed version is older than 16.04 regardless of return
+ code from the requested check
+
+ return code from requested check if the installed version is 16.04 or
+ newer.
+ """
+ installed_version = int(linux_distribution()[1].split()[0])
+ if installed_version < 16:
+ logging.info("This system appears to be older than 16.04 LTS so this "
+ "will not block a certification in progress.")
+ if check == 'efi':
+ efi_boot_check()
+ else:
+ secure_boot_check()
+
+ return 0
+ else:
+ if check == 'efi':
+ return efi_boot_check()
+ else:
+ return secure_boot_check()
def efi_boot_check():
@@ -86,11 +115,7 @@ def main():
FORMAT = '%(levelname)s: %(message)s'
logging.basicConfig(level=logging.INFO, format=FORMAT)
- if args.check == 'efi':
- return efi_boot_check()
- else:
- return secure_boot_check()
-
+ return version_check(args.check)
if __name__ == '__main__':
sys.exit(main())