Added check_os_support_status()

* Refactored from os_is_unsupported()
* Removed os_is_unsupported()
This commit is contained in:
2Shirt 2019-05-08 20:41:16 -06:00
parent b3b13be5a7
commit 0101506f2c
Signed by: 2Shirt
GPG key ID: 152FAC923B0E132C

View file

@ -8,6 +8,10 @@ from settings.sw_diags import *
class Not4KAlignedError(Exception):
pass
class WindowsOutdatedError(Exception):
pass
class WindowsUnsupportedError(Exception):
pass
def check_4k_alignment(show_alert=False):
@ -52,6 +56,37 @@ def check_connection():
abort()
def check_os_support_status():
"""Check if current OS is supported."""
msg = ''
outdated = False
unsupported = False
# Check OS version/notes
os_info = global_vars['OS'].copy()
if os_info['Notes'] == 'unsupported':
msg = 'The installed version of Windows is no longer supported'
unsupported = True
elif os_info['Notes'] == 'preview build':
msg = 'Preview builds are not officially supported'
unsupported = True
elif os_info['Version'] == '10' and os_info['Notes'] == 'outdated':
msg = 'The installed version of Windows is outdated'
outdated = True
if 'Preview' not in msg:
msg += '\n\nPlease consider upgrading before continuing setup.'
# Show alert
if outdated or unsupported:
show_alert_box(msg)
# Raise exception if necessary
if outdated:
raise WindowsOutdatedError
if unsupported:
raise WindowsUnsupportedError
def check_secure_boot_status(show_alert=False):
"""Checks UEFI Secure Boot status via PowerShell."""
boot_mode = get_boot_mode()
@ -114,33 +149,6 @@ def get_boot_mode():
return type_str
def os_is_unsupported(show_alert=False):
"""Checks if the current OS is unsupported, returns bool."""
msg = ''
unsupported = False
# Check OS version/notes
os_info = global_vars['OS'].copy()
if os_info['Notes'] == 'unsupported':
msg = 'The installed version of Windows is no longer supported'
unsupported = True
elif os_info['Notes'] == 'preview build':
msg = 'Preview builds are not officially supported'
unsupported = True
elif os_info['Version'] == '10' and os_info['Notes'] == 'outdated':
msg = 'The installed version of Windows is outdated'
unsupported = True
if 'Preview' not in msg:
msg += '\n\nPlease consider upgrading before continuing setup.'
# Show alert
if unsupported and show_alert:
show_alert_box(msg)
# Done
return unsupported
def run_autoruns():
"""Run AutoRuns in the background with VirusTotal checks enabled."""
extract_item('Autoruns', filter='autoruns*', silent=True)