Skip backup sections if backup previously run
This commit is contained in:
parent
8289df1d62
commit
2e485505d4
2 changed files with 34 additions and 6 deletions
|
|
@ -105,7 +105,6 @@ def no_op(*args):
|
||||||
BASE_MENUS = {
|
BASE_MENUS = {
|
||||||
'Groups': {
|
'Groups': {
|
||||||
'Backup Settings': (
|
'Backup Settings': (
|
||||||
# Add checks for existing backups and skip if detected
|
|
||||||
MenuEntry('Backup Browsers', 'auto_backup_browser_profiles'),
|
MenuEntry('Backup Browsers', 'auto_backup_browser_profiles'),
|
||||||
MenuEntry('Backup Power Plans', 'auto_backup_power_plans'),
|
MenuEntry('Backup Power Plans', 'auto_backup_power_plans'),
|
||||||
MenuEntry('Reset Power Plans', 'auto_reset_power_plans'),
|
MenuEntry('Reset Power Plans', 'auto_reset_power_plans'),
|
||||||
|
|
@ -113,7 +112,6 @@ BASE_MENUS = {
|
||||||
),
|
),
|
||||||
'Install Software': (
|
'Install Software': (
|
||||||
MenuEntry('Visual C++ Runtimes', 'auto_install_vcredists'),
|
MenuEntry('Visual C++ Runtimes', 'auto_install_vcredists'),
|
||||||
#MenuEntry('ESET NOD32 Antivirus', no_op),
|
|
||||||
MenuEntry('Firefox', 'auto_install_firefox'),
|
MenuEntry('Firefox', 'auto_install_firefox'),
|
||||||
MenuEntry('LibreOffice', 'auto_install_libreoffice'),
|
MenuEntry('LibreOffice', 'auto_install_libreoffice'),
|
||||||
MenuEntry('Open Shell', 'auto_install_open_shell'),
|
MenuEntry('Open Shell', 'auto_install_open_shell'),
|
||||||
|
|
@ -121,12 +119,9 @@ BASE_MENUS = {
|
||||||
),
|
),
|
||||||
'Configure System': (
|
'Configure System': (
|
||||||
MenuEntry('Chrome Notifications', 'auto_disable_chrome_notifications'),
|
MenuEntry('Chrome Notifications', 'auto_disable_chrome_notifications'),
|
||||||
#MenuEntry('O&O ShutUp 10', no_op),
|
|
||||||
MenuEntry('Open Shell', 'auto_config_open_shell'),
|
MenuEntry('Open Shell', 'auto_config_open_shell'),
|
||||||
MenuEntry('uBlock Origin', 'auto_enable_ublock_origin'),
|
MenuEntry('uBlock Origin', 'auto_enable_ublock_origin'),
|
||||||
#MenuEntry('Disable Fast Startup', no_op),
|
|
||||||
MenuEntry('Enable BSoD MiniDumps', 'auto_enable_bsod_minidumps'),
|
MenuEntry('Enable BSoD MiniDumps', 'auto_enable_bsod_minidumps'),
|
||||||
#MenuEntry('Enable Hibernation', no_op),
|
|
||||||
MenuEntry('Enable RegBack', 'auto_enable_regback'),
|
MenuEntry('Enable RegBack', 'auto_enable_regback'),
|
||||||
MenuEntry('Enable System Restore', 'auto_system_restore_enable'),
|
MenuEntry('Enable System Restore', 'auto_system_restore_enable'),
|
||||||
MenuEntry('Set System Restore Size', 'auto_system_restore_set_size'),
|
MenuEntry('Set System Restore Size', 'auto_system_restore_set_size'),
|
||||||
|
|
@ -154,7 +149,6 @@ BASE_MENUS = {
|
||||||
'Run Programs': (
|
'Run Programs': (
|
||||||
MenuEntry('Device Manager', no_op),
|
MenuEntry('Device Manager', no_op),
|
||||||
MenuEntry('HWiNFO Sensors', no_op),
|
MenuEntry('HWiNFO Sensors', no_op),
|
||||||
#MenuEntry('Snappy Driver Installer', no_op),
|
|
||||||
MenuEntry('Windows Updates', no_op),
|
MenuEntry('Windows Updates', no_op),
|
||||||
MenuEntry('Windows Activation', no_op),
|
MenuEntry('Windows Activation', no_op),
|
||||||
MenuEntry('XMPlay', no_op),
|
MenuEntry('XMPlay', no_op),
|
||||||
|
|
|
||||||
|
|
@ -875,6 +875,16 @@ def backup_browser_chromium(backup_path, browser, search_path, use_try_print):
|
||||||
if not match:
|
if not match:
|
||||||
continue
|
continue
|
||||||
output_path = backup_path.joinpath(f'{browser}-{item.name}.7z')
|
output_path = backup_path.joinpath(f'{browser}-{item.name}.7z')
|
||||||
|
if output_path.exists():
|
||||||
|
# Assuming backup was already done
|
||||||
|
if use_try_print:
|
||||||
|
show_data(
|
||||||
|
f'{" "*8}{browser} ({item.name})...', 'Backup already exists.',
|
||||||
|
color='YELLOW', width=WIDTH,
|
||||||
|
)
|
||||||
|
continue
|
||||||
|
|
||||||
|
# Backup data
|
||||||
cmd = [
|
cmd = [
|
||||||
*BACKUP_BROWSER_BASE_CMD,
|
*BACKUP_BROWSER_BASE_CMD,
|
||||||
output_path, item.joinpath('*'), '-x!*Cache*', '-x!Service Worker',
|
output_path, item.joinpath('*'), '-x!*Cache*', '-x!Service Worker',
|
||||||
|
|
@ -891,6 +901,18 @@ def backup_browser_chromium(backup_path, browser, search_path, use_try_print):
|
||||||
def backup_browser_firefox(backup_path, search_path, use_try_print):
|
def backup_browser_firefox(backup_path, search_path, use_try_print):
|
||||||
"""Backup Firefox browser profile."""
|
"""Backup Firefox browser profile."""
|
||||||
output_path = backup_path.joinpath('Firefox.7z')
|
output_path = backup_path.joinpath('Firefox.7z')
|
||||||
|
|
||||||
|
# Bail early
|
||||||
|
if output_path.exists():
|
||||||
|
# Assuming backup was already done
|
||||||
|
if use_try_print:
|
||||||
|
show_data(
|
||||||
|
f'{" "*8}Firefox (All)...', 'Backup already exists.',
|
||||||
|
color='YELLOW', width=WIDTH,
|
||||||
|
)
|
||||||
|
return
|
||||||
|
|
||||||
|
# Backup data
|
||||||
cmd = [
|
cmd = [
|
||||||
*BACKUP_BROWSER_BASE_CMD, output_path,
|
*BACKUP_BROWSER_BASE_CMD, output_path,
|
||||||
search_path.joinpath('Profiles'), search_path.joinpath('profiles.ini'),
|
search_path.joinpath('Profiles'), search_path.joinpath('profiles.ini'),
|
||||||
|
|
@ -934,6 +956,12 @@ def backup_registry():
|
||||||
"""Backup Registry."""
|
"""Backup Registry."""
|
||||||
backup_path = set_backup_path('Registry', date=True)
|
backup_path = set_backup_path('Registry', date=True)
|
||||||
backup_path.parent.mkdir(parents=True, exist_ok=True)
|
backup_path.parent.mkdir(parents=True, exist_ok=True)
|
||||||
|
|
||||||
|
# Check if backup was already done today
|
||||||
|
if backup_path.exists():
|
||||||
|
raise GenericWarning('Backup already exists.')
|
||||||
|
|
||||||
|
# Backup registry
|
||||||
extract_tool('ERUNT')
|
extract_tool('ERUNT')
|
||||||
run_tool('ERUNT', 'ERUNT', backup_path, 'sysreg', 'curuser', 'otherusers')
|
run_tool('ERUNT', 'ERUNT', backup_path, 'sysreg', 'curuser', 'otherusers')
|
||||||
|
|
||||||
|
|
@ -1155,6 +1183,12 @@ def enable_windows_updates():
|
||||||
def export_power_plans():
|
def export_power_plans():
|
||||||
"""Export existing power plans."""
|
"""Export existing power plans."""
|
||||||
backup_path = set_backup_path('Power Plans', date=True)
|
backup_path = set_backup_path('Power Plans', date=True)
|
||||||
|
|
||||||
|
# Bail early
|
||||||
|
if backup_path.exists():
|
||||||
|
raise GenericWarning('Backup already exists.')
|
||||||
|
|
||||||
|
# Get powercfg data
|
||||||
backup_path.mkdir(parents=True, exist_ok=True)
|
backup_path.mkdir(parents=True, exist_ok=True)
|
||||||
cmd = ['powercfg', '/L']
|
cmd = ['powercfg', '/L']
|
||||||
proc = run_program(cmd)
|
proc = run_program(cmd)
|
||||||
|
|
|
||||||
Loading…
Reference in a new issue