From 49c1987ccfb73353397b9b318b9a6604bf37891f Mon Sep 17 00:00:00 2001 From: 2Shirt <2xShirt@gmail.com> Date: Tue, 1 Jan 2019 21:23:33 -0700 Subject: [PATCH] Adjusted unsupported OS detection --- .bin/Scripts/functions/sw_diags.py | 60 ++++++++++++++---------------- .bin/Scripts/new_system_setup.py | 3 +- 2 files changed, 28 insertions(+), 35 deletions(-) diff --git a/.bin/Scripts/functions/sw_diags.py b/.bin/Scripts/functions/sw_diags.py index d5a74060..100e5ad5 100644 --- a/.bin/Scripts/functions/sw_diags.py +++ b/.bin/Scripts/functions/sw_diags.py @@ -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) diff --git a/.bin/Scripts/new_system_setup.py b/.bin/Scripts/new_system_setup.py index 42005ba9..597fe981 100644 --- a/.bin/Scripts/new_system_setup.py +++ b/.bin/Scripts/new_system_setup.py @@ -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()