parent
3f2b7e24e6
commit
3f48cc4e46
4 changed files with 45 additions and 8 deletions
|
|
@ -45,6 +45,15 @@ LAUNCHERS = {
|
||||||
},
|
},
|
||||||
},
|
},
|
||||||
r'Data Transfers': {
|
r'Data Transfers': {
|
||||||
|
"Fab's Autobackup Pro": {
|
||||||
|
'L_TYPE': 'Executable',
|
||||||
|
'L_PATH': 'AutoBackupPro',
|
||||||
|
'L_ITEM': 'autobackup6pro.exe',
|
||||||
|
'Extra Code': [
|
||||||
|
r'call "%bin%\Scripts\init_client_dir.cmd"',
|
||||||
|
r'reg add HKCU\Software\1201-WizardKit /v FabLastRun /t REG_SZ /d %iso_date% /f >nul 2>&1',
|
||||||
|
],
|
||||||
|
},
|
||||||
'FastCopy (as ADMIN)': {
|
'FastCopy (as ADMIN)': {
|
||||||
'L_TYPE': 'Executable',
|
'L_TYPE': 'Executable',
|
||||||
'L_PATH': 'FastCopy',
|
'L_PATH': 'FastCopy',
|
||||||
|
|
|
||||||
|
|
@ -10,6 +10,7 @@ BROWSER_PATHS = {
|
||||||
'Microsoft Edge': 'Microsoft/Edge/Application/msedge.exe',
|
'Microsoft Edge': 'Microsoft/Edge/Application/msedge.exe',
|
||||||
'Opera': 'Opera/launcher.exe',
|
'Opera': 'Opera/launcher.exe',
|
||||||
}
|
}
|
||||||
|
FAB_TIMEFRAME = 14 # If it's been at least this many days don't prompt for an AV scan
|
||||||
LIBREOFFICE_XCU_DATA = '''<?xml version="1.0" encoding="UTF-8"?>
|
LIBREOFFICE_XCU_DATA = '''<?xml version="1.0" encoding="UTF-8"?>
|
||||||
<oor:items xmlns:oor="http://openoffice.org/2001/registry" xmlns:xs="http://www.w3.org/2001/XMLSchema" xmlns:xsi="http
|
<oor:items xmlns:oor="http://openoffice.org/2001/registry" xmlns:xs="http://www.w3.org/2001/XMLSchema" xmlns:xsi="http
|
||||||
<item oor:path="/org.openoffice.Setup/Office/Factories/org.openoffice.Setup:Factory['com.sun.star.presentation.Present
|
<item oor:path="/org.openoffice.Setup/Office/Factories/org.openoffice.Setup:Factory['com.sun.star.presentation.Present
|
||||||
|
|
|
||||||
|
|
@ -162,7 +162,7 @@ def build_menus(base_menus, title):
|
||||||
return menus
|
return menus
|
||||||
|
|
||||||
|
|
||||||
def end_session():
|
def end_session(menus):
|
||||||
"""End Auto Repairs session."""
|
"""End Auto Repairs session."""
|
||||||
# Remove logon task
|
# Remove logon task
|
||||||
cmd = [
|
cmd = [
|
||||||
|
|
@ -190,11 +190,14 @@ def end_session():
|
||||||
reg_delete_value('HKCU', AUTO_REPAIR_KEY, 'SessionStarted')
|
reg_delete_value('HKCU', AUTO_REPAIR_KEY, 'SessionStarted')
|
||||||
except FileNotFoundError:
|
except FileNotFoundError:
|
||||||
LOG.error('Ending repair session but session not started.')
|
LOG.error('Ending repair session but session not started.')
|
||||||
|
for group in menus:
|
||||||
try:
|
try:
|
||||||
cmd = ['reg', 'delete', fr'HKCU\{AUTO_REPAIR_KEY}', '/f']
|
cmd = ['reg', 'delete', fr'HKCU\{AUTO_REPAIR_KEY}\{group}', '/f']
|
||||||
run_program(cmd)
|
run_program(cmd)
|
||||||
except CalledProcessError:
|
except CalledProcessError:
|
||||||
LOG.error('Failed to remote Auto Repairs session settings')
|
LOG.error(
|
||||||
|
'Failed to remove Auto Repairs session settings for group %s', group,
|
||||||
|
)
|
||||||
|
|
||||||
|
|
||||||
def get_entry_settings(group, name):
|
def get_entry_settings(group, name):
|
||||||
|
|
@ -362,7 +365,7 @@ def run_auto_repairs(base_menus):
|
||||||
show_main_menu(base_menus, menus)
|
show_main_menu(base_menus, menus)
|
||||||
except SystemExit:
|
except SystemExit:
|
||||||
if ask('End session?'):
|
if ask('End session?'):
|
||||||
end_session()
|
end_session(menus)
|
||||||
raise
|
raise
|
||||||
|
|
||||||
# Re-check if a repair session was started
|
# Re-check if a repair session was started
|
||||||
|
|
@ -398,7 +401,7 @@ def run_auto_repairs(base_menus):
|
||||||
abort()
|
abort()
|
||||||
|
|
||||||
# Done
|
# Done
|
||||||
end_session()
|
end_session(menus)
|
||||||
print_info('Done')
|
print_info('Done')
|
||||||
pause('Press Enter to exit...')
|
pause('Press Enter to exit...')
|
||||||
|
|
||||||
|
|
|
||||||
|
|
@ -3,6 +3,7 @@
|
||||||
# vim: sts=2 sw=2 ts=2
|
# vim: sts=2 sw=2 ts=2
|
||||||
|
|
||||||
import configparser
|
import configparser
|
||||||
|
from datetime import datetime, timedelta
|
||||||
import logging
|
import logging
|
||||||
import json
|
import json
|
||||||
import os
|
import os
|
||||||
|
|
@ -12,6 +13,7 @@ import sys
|
||||||
from wk.cfg.main import KIT_NAME_FULL
|
from wk.cfg.main import KIT_NAME_FULL
|
||||||
from wk.cfg.setup import (
|
from wk.cfg.setup import (
|
||||||
BROWSER_PATHS,
|
BROWSER_PATHS,
|
||||||
|
FAB_TIMEFRAME,
|
||||||
REG_ESET_NOD32_SETTINGS,
|
REG_ESET_NOD32_SETTINGS,
|
||||||
LIBREOFFICE_XCU_DATA,
|
LIBREOFFICE_XCU_DATA,
|
||||||
REG_CHROME_UBLOCK_ORIGIN,
|
REG_CHROME_UBLOCK_ORIGIN,
|
||||||
|
|
@ -43,6 +45,7 @@ from wk.os.win import (
|
||||||
get_volume_usage,
|
get_volume_usage,
|
||||||
is_activated,
|
is_activated,
|
||||||
is_secure_boot_enabled,
|
is_secure_boot_enabled,
|
||||||
|
reg_read_value,
|
||||||
reg_set_value,
|
reg_set_value,
|
||||||
reg_write_settings,
|
reg_write_settings,
|
||||||
)
|
)
|
||||||
|
|
@ -157,6 +160,24 @@ def build_menus(base_menus, title, presets):
|
||||||
return menus
|
return menus
|
||||||
|
|
||||||
|
|
||||||
|
def check_if_av_scan_is_needed():
|
||||||
|
"""Check if an AV scan is needed based on last Fab run."""
|
||||||
|
try:
|
||||||
|
last_run = reg_read_value(
|
||||||
|
'HKCU', fr'Software\{KIT_NAME_FULL}', 'FabLastRun',
|
||||||
|
)
|
||||||
|
except FileNotFoundError:
|
||||||
|
# Assuming it isn't needed
|
||||||
|
return
|
||||||
|
|
||||||
|
# Check date and prompt tech if necessary
|
||||||
|
last_run_date = datetime.strptime(last_run, '%Y-%m-%d')
|
||||||
|
if datetime.now() - last_run_date < timedelta(days=FAB_TIMEFRAME):
|
||||||
|
print_warning('Fab was recently run, an AV scan may be needed.')
|
||||||
|
if not ask('Continue with setup?'):
|
||||||
|
abort()
|
||||||
|
|
||||||
|
|
||||||
def check_os_and_set_menu_title(title):
|
def check_os_and_set_menu_title(title):
|
||||||
"""Check OS version and update title for menus, returns str."""
|
"""Check OS version and update title for menus, returns str."""
|
||||||
color = None
|
color = None
|
||||||
|
|
@ -246,6 +267,9 @@ def run_auto_setup(base_menus, presets):
|
||||||
# Check OS and update title for menus
|
# Check OS and update title for menus
|
||||||
title = check_os_and_set_menu_title(title)
|
title = check_os_and_set_menu_title(title)
|
||||||
|
|
||||||
|
# Check if AV scan needs to be run
|
||||||
|
check_if_av_scan_is_needed()
|
||||||
|
|
||||||
# Generate menus
|
# Generate menus
|
||||||
menus = build_menus(base_menus, title, presets)
|
menus = build_menus(base_menus, title, presets)
|
||||||
|
|
||||||
|
|
|
||||||
Loading…
Reference in a new issue