summaryrefslogtreecommitdiff
diff options
authorJeff Lane <jeffrey.lane@canonical.com>2016-11-01 16:45:31 -0400
committerJeff Lane <jeffrey.lane@canonical.com>2016-11-01 16:45:31 -0400
commit595a51420c7baf05c33d9cc16d4e6a5abb159ffe (patch)
treeb98cd63200c71afac386512052c7f458c99c4c0f
parent8cdb5b412cce7715efabb79fefff2092d38c2202 (diff)
bin/boot_mode_test - always returns 0 if run on something older than 16.04, otherwise returns status of the requested check. LP: #1638365
-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..877e647 100755
--- a/bin/boot_mode_test
+++ b/bin/boot_mode_test
@@ -24,8 +24,37 @@ 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 = '14.04.5'
+ #installed_version = linux_distribution()[1]
+ if installed_version < '16.04':
+ 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()
+ return 0
+ else:
+ secure_boot_check()
+ return 0
+ else:
+ if check == 'efi':
+ return efi_boot_check()
+ else:
+ return secure_boot_check()
+
def efi_boot_check():
"""Test that the computer booted in EFI mode
@@ -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())