Add 4K alignment checks to Auto Setup
This commit is contained in:
parent
f1645f80e6
commit
eacab48c1e
3 changed files with 25 additions and 1 deletions
|
|
@ -143,7 +143,7 @@ BASE_MENUS = {
|
||||||
MenuEntry('Installed RAM', 'auto_show_installed_ram'),
|
MenuEntry('Installed RAM', 'auto_show_installed_ram'),
|
||||||
MenuEntry('Storage Status', 'auto_show_storage_status'),
|
MenuEntry('Storage Status', 'auto_show_storage_status'),
|
||||||
MenuEntry('Virus Protection', 'auto_show_installed_antivirus'),
|
MenuEntry('Virus Protection', 'auto_show_installed_antivirus'),
|
||||||
MenuEntry('Partitions 4K Aligned', no_op),
|
MenuEntry('Partitions 4K Aligned', 'auto_show_4k_alignment_check'),
|
||||||
),
|
),
|
||||||
'Run Programs': (
|
'Run Programs': (
|
||||||
MenuEntry('Device Manager', no_op),
|
MenuEntry('Device Manager', no_op),
|
||||||
|
|
|
||||||
|
|
@ -152,6 +152,23 @@ def set_timezone(zone):
|
||||||
|
|
||||||
|
|
||||||
# Info Functions
|
# Info Functions
|
||||||
|
def check_4k_alignment(show_alert=False):
|
||||||
|
"""Check if all partitions are 4K aligned, returns book."""
|
||||||
|
cmd = ['WMIC', 'partition', 'get', 'StartingOffset']
|
||||||
|
|
||||||
|
# Check offsets
|
||||||
|
proc = run_program(cmd)
|
||||||
|
for offset in proc.stdout.splitlines():
|
||||||
|
offset = offset.strip()
|
||||||
|
if not offset.isnumeric():
|
||||||
|
continue
|
||||||
|
if int(offset) % 4096 != 0:
|
||||||
|
# Not aligned
|
||||||
|
if show_alert:
|
||||||
|
show_alert_box('One or more partitions are not 4K aligned')
|
||||||
|
raise GenericError('One or more partitions are not 4K aligned')
|
||||||
|
|
||||||
|
|
||||||
def get_installed_antivirus():
|
def get_installed_antivirus():
|
||||||
"""Get list of installed antivirus programs, returns list."""
|
"""Get list of installed antivirus programs, returns list."""
|
||||||
cmd = [
|
cmd = [
|
||||||
|
|
|
||||||
|
|
@ -44,6 +44,7 @@ if platform.system() == 'Windows':
|
||||||
from wk.os.win import (
|
from wk.os.win import (
|
||||||
OS_VERSION,
|
OS_VERSION,
|
||||||
activate_with_bios,
|
activate_with_bios,
|
||||||
|
check_4k_alignment,
|
||||||
get_installed_antivirus,
|
get_installed_antivirus,
|
||||||
get_installed_ram,
|
get_installed_ram,
|
||||||
get_os_activation,
|
get_os_activation,
|
||||||
|
|
@ -71,6 +72,7 @@ else:
|
||||||
"""No-op function."""
|
"""No-op function."""
|
||||||
# wk.os.win
|
# wk.os.win
|
||||||
activate_with_bios = no_op
|
activate_with_bios = no_op
|
||||||
|
check_4k_alignment = no_op
|
||||||
get_installed_antivirus = no_op
|
get_installed_antivirus = no_op
|
||||||
get_installed_ram = no_op
|
get_installed_ram = no_op
|
||||||
get_os_activation = no_op
|
get_os_activation = no_op
|
||||||
|
|
@ -570,6 +572,11 @@ def auto_restore_default_uac():
|
||||||
TRY_PRINT.run('User Account Control...', restore_default_uac)
|
TRY_PRINT.run('User Account Control...', restore_default_uac)
|
||||||
|
|
||||||
|
|
||||||
|
def auto_show_4k_alignment_check():
|
||||||
|
"""Display 4K alignment check."""
|
||||||
|
TRY_PRINT.run('4K alignment Check...', check_4k_alignment, show_alert=True)
|
||||||
|
|
||||||
|
|
||||||
def auto_show_installed_antivirus():
|
def auto_show_installed_antivirus():
|
||||||
"""Display installed antivirus."""
|
"""Display installed antivirus."""
|
||||||
TRY_PRINT.run('Virus Protection...', get_installed_antivirus)
|
TRY_PRINT.run('Virus Protection...', get_installed_antivirus)
|
||||||
|
|
|
||||||
Loading…
Reference in a new issue