Adjusted unsupported OS detection
This commit is contained in:
parent
88dffd7432
commit
49c1987ccf
2 changed files with 28 additions and 35 deletions
|
|
@ -41,39 +41,6 @@ def check_connection():
|
|||
abort()
|
||||
|
||||
|
||||
def check_for_outdated_os(show_alert=False):
|
||||
"""Checks if the current OS is supported, returns bool.
|
||||
|
||||
NOTE: Preview Builds are considered outdated even if newer than
|
||||
the latest stable release. This is done for simplicity and
|
||||
because preview builds are only valid for a short timeframe.
|
||||
"""
|
||||
msg = ''
|
||||
needs_updated = False
|
||||
preview_build = False
|
||||
|
||||
# Check OS version/notes
|
||||
os_info = global_vars['OS'].copy()
|
||||
if os_info['Notes'] == 'unsupported':
|
||||
needs_updated = True
|
||||
elif os_info['Version'] == '10' and os_info['Notes'] == 'preview build':
|
||||
preview_build = True
|
||||
elif os_info['Version'] == '10' and os_info['Notes'] == 'outdated':
|
||||
needs_updated = True
|
||||
|
||||
# Show alert
|
||||
if preview_build:
|
||||
msg = 'Preview builds are not officially supported'
|
||||
elif needs_updated:
|
||||
msg = 'The installed version of Windows is outdated'
|
||||
if msg and show_alert:
|
||||
msg += '\n\nPlease consider upgrading before continuing setup.'
|
||||
show_alert_box(msg)
|
||||
|
||||
# Done
|
||||
return needs_updated or preview_build
|
||||
|
||||
|
||||
def check_secure_boot_status(show_alert=False):
|
||||
"""Checks UEFI Secure Boot status via PowerShell."""
|
||||
boot_mode = get_boot_mode()
|
||||
|
|
@ -136,6 +103,33 @@ 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)
|
||||
|
|
|
|||
|
|
@ -40,8 +40,7 @@ if __name__ == '__main__':
|
|||
clear_screen()
|
||||
|
||||
# Check installed OS
|
||||
os_needs_updated = check_for_outdated_os(show_alert=True)
|
||||
if os_needs_updated:
|
||||
if os_is_unsupported(show_alert=True):
|
||||
print_warning('OS version not supported by this script')
|
||||
if not ask('Continue anyway? (NOT RECOMMENDED)'):
|
||||
abort()
|
||||
|
|
|
|||
Loading…
Reference in a new issue