Added 4K alignment check to checklists
This commit is contained in:
parent
dd08bc79e9
commit
5e75fffa86
4 changed files with 53 additions and 8 deletions
|
|
@ -6,6 +6,39 @@ from functions.common import *
|
|||
from settings.sw_diags import *
|
||||
|
||||
|
||||
class Not4KAlignedError(Exception):
|
||||
pass
|
||||
|
||||
|
||||
def check_4k_alignment(show_alert=False):
|
||||
"""Check that all partitions are 4K aligned."""
|
||||
aligned = True
|
||||
cmd = ['WMIC', 'partition', 'get', 'StartingOffset']
|
||||
offsets = []
|
||||
|
||||
# Get offsets
|
||||
result = run_program(cmd, encoding='utf-8', errors='ignore', check=False)
|
||||
offsets = result.stdout.splitlines()
|
||||
|
||||
# Check offsets
|
||||
for off in offsets:
|
||||
off = off.strip()
|
||||
if not off.isnumeric():
|
||||
# Skip
|
||||
continue
|
||||
|
||||
try:
|
||||
aligned &= int(off) % 4096 == 0
|
||||
except ValueError:
|
||||
# Ignore, this check is low priority
|
||||
pass
|
||||
|
||||
# Show alert
|
||||
if show_alert:
|
||||
show_alert_box('One or more partitions are not 4K aligned')
|
||||
raise Not4KAlignedError
|
||||
|
||||
|
||||
def check_connection():
|
||||
"""Check if the system is online and optionally abort the script."""
|
||||
while True:
|
||||
|
|
|
|||
|
|
@ -23,6 +23,7 @@ if __name__ == '__main__':
|
|||
'CalledProcessError': 'Unknown Error',
|
||||
'FileNotFoundError': 'File not found',
|
||||
'GenericError': 'Unknown Error',
|
||||
'Not4KAlignedError': 'False',
|
||||
'SecureBootDisabledError': 'Disabled',
|
||||
},
|
||||
'Warning': {
|
||||
|
|
@ -172,6 +173,9 @@ if __name__ == '__main__':
|
|||
try_and_print(message='Installed Antivirus:',
|
||||
function=get_installed_antivirus, ns='Unknown',
|
||||
other_results=other_results, print_return=True)
|
||||
try_and_print(message='Partitions 4K aligned:',
|
||||
function=check_4k_alignment, cs='True',
|
||||
other_results=other_results)
|
||||
|
||||
# Play audio, show devices, open Windows updates, and open Activation
|
||||
try_and_print(message='Opening Device Manager...',
|
||||
|
|
|
|||
|
|
@ -25,10 +25,11 @@ if __name__ == '__main__':
|
|||
ticket_number = get_ticket_number()
|
||||
other_results = {
|
||||
'Error': {
|
||||
'BIOSKeyNotFoundError': 'BIOS key not found',
|
||||
'CalledProcessError': 'Unknown Error',
|
||||
'FileNotFoundError': 'File not found',
|
||||
'GenericError': 'Unknown Error',
|
||||
'BIOSKeyNotFoundError': 'BIOS key not found',
|
||||
'CalledProcessError': 'Unknown Error',
|
||||
'FileNotFoundError': 'File not found',
|
||||
'GenericError': 'Unknown Error',
|
||||
'Not4KAlignedError': 'False',
|
||||
'SecureBootDisabledError': 'Disabled',
|
||||
},
|
||||
'Warning': {
|
||||
|
|
@ -120,6 +121,9 @@ if __name__ == '__main__':
|
|||
try_and_print(message='Installed Office:',
|
||||
function=get_installed_office, ns='Unknown',
|
||||
other_results=other_results, print_return=True)
|
||||
try_and_print(message='Partitions 4K aligned:',
|
||||
function=check_4k_alignment, cs='True',
|
||||
other_results=other_results)
|
||||
if D7_MODE:
|
||||
try_and_print(message='Product Keys:',
|
||||
function=get_product_keys, ns='Unknown', print_return=True)
|
||||
|
|
|
|||
|
|
@ -23,10 +23,11 @@ if __name__ == '__main__':
|
|||
ticket_number = get_ticket_number()
|
||||
other_results = {
|
||||
'Error': {
|
||||
'BIOSKeyNotFoundError': 'BIOS key not found',
|
||||
'CalledProcessError': 'Unknown Error',
|
||||
'FileNotFoundError': 'File not found',
|
||||
'GenericError': 'Unknown Error',
|
||||
'BIOSKeyNotFoundError': 'BIOS key not found',
|
||||
'CalledProcessError': 'Unknown Error',
|
||||
'FileNotFoundError': 'File not found',
|
||||
'GenericError': 'Unknown Error',
|
||||
'Not4KAlignedError': 'False',
|
||||
'SecureBootDisabledError': 'Disabled',
|
||||
},
|
||||
'Warning': {
|
||||
|
|
@ -90,6 +91,9 @@ if __name__ == '__main__':
|
|||
try_and_print(message='Installed Office:',
|
||||
function=get_installed_office, ns='Unknown',
|
||||
other_results=other_results, print_return=True)
|
||||
try_and_print(message='Partitions 4K aligned:',
|
||||
function=check_4k_alignment, cs='True',
|
||||
other_results=other_results)
|
||||
|
||||
# Play audio, show devices, open Windows updates, and open Activation
|
||||
try_and_print(message='Opening Device Manager...',
|
||||
|
|
|
|||
Loading…
Reference in a new issue