## MAJOR refactoring in progress ##
# BROKEN SCRIPTS #
(These scripts need updated to use the new global_vars & try_and_print)
* user_data_transfer.py
* install_sw_bundle.py
* All Python scripts
* PLAN: Replace vars_wk with global_vars
* functions.py
* PLAN: Will hold (nearly?) all functions going forward
* Should simplify the remaining scripts
* (e.g. reset_browsers and sw_diagnostics both had a backup_browsers())
* PLAN: Move all program definitions to functions.py
* (e.g. vars_wk['SevenZip'] --> global_vars['Programs']['SevenZip'])
* Added major_exception()
* Should be called if anything goes wrong to alert user and provide info
* Added non_clobber_rename()
* Appends a number (if necessary) to avoid overwriting data
* Added popen_program()
* Removes subprocess req for sw_checklist
* Added try_and_print()
* Run a function and show CS/NS/etc
* Can add additional "result" strings via Exception classes
* Passes unrecognized args/kwargs to the function
* Used by scripts to standardize message formatting and error handling
* exit_script() now handles opening the log (if set) and killing caffeine.exe
* Refactored init_vars_wk/os code to work with global_vars
* Uses the try_and_print function for better formatting and error handling
* BREAKING: 'OS' vars now located in global_vars['OS'] (including 'Arch')
* OS labeled as 'outdated', 'very outdated', and 'unrecognized' as needed
* BREAKING: renamed PROGRAMS to TOOLS
* Expanded TOOLS
* Removed log_file as a required argument from all functions
* Removed vars_wk/global_vars as a required argument from all functions
* Removed unused WinPE functions
* Sorted functions
* user_checklist() (formerly reset_browsers())
* Most functions moved to functions.py (see above)
* Browsers
* Work has been split into backup, reset, and config sections
* Script now asks all questions before starting backup/reset/config
* Script now forces the homepage to DEFAULT_HOMEPAGE (set in functions.py)
* (i.e. it no longer asks first, it just does it)
* Current homepages are listed where possible before backup/reset/config
* Launch/Launchers
* Added QuickBooks support
* Removed launchers
* CPU-Z
* HWMonitor
* PerfMonitor2
* SanDisk Express Cache
* Shortcut Cleaner
* SuperAntiSpyware (SAS)
* Replaced Notepad2-Mod with Notepad++
86 lines
3.1 KiB
Python
86 lines
3.1 KiB
Python
# Wizard Kit: Install the standard SW bundle based on the OS version
|
|
|
|
import os
|
|
import re
|
|
|
|
# Init
|
|
os.chdir(os.path.dirname(os.path.realpath(__file__)))
|
|
os.system('title Wizard Kit: SW Bundle Tool')
|
|
from functions import *
|
|
vars_wk = init_vars_wk()
|
|
vars_wk.update(init_vars_os())
|
|
|
|
if __name__ == '__main__':
|
|
stay_awake(vars_wk)
|
|
errors = False
|
|
|
|
# Adobe Reader
|
|
if vars_wk['OS']['Version'] != 'Vista':
|
|
print('Installing Adobe Reader DC...')
|
|
_prog = '{BaseDir}/Installers/Extras/Office/Adobe Reader DC.exe'.format(**vars_wk)
|
|
_args = ['/sAll', '/msi', '/norestart', '/quiet', 'ALLUSERS=1', 'EULA_ACCEPT=YES']
|
|
try:
|
|
run_program(_prog, _args)
|
|
except:
|
|
print_error('Failed to install Adobe Reader DC')
|
|
errors = True
|
|
|
|
# Visual C++ Redists
|
|
print('Installing Visual C++ Runtimes...')
|
|
extract_item('_vcredists', vars_wk, silent=True)
|
|
os.chdir('{BinDir}/_vcredists'.format(**vars_wk))
|
|
_redists = [
|
|
# 2005
|
|
{'Prog': 'msiexec',
|
|
'Args': ['/i', '2005sp1\\x86\\vcredist.msi', '/qb!', '/norestart']},
|
|
{'Prog': 'msiexec',
|
|
'Args': ['/i', '2005sp1\\x64\\vcredist.msi', '/qb!', '/norestart']},
|
|
# 2008
|
|
{'Prog': '2008sp1\\vcredist_x86.exe',
|
|
'Args': ['/qb! /norestart']},
|
|
{'Prog': '2008sp1\\vcredist_x64.exe',
|
|
'Args': ['/qb! /norestart']},
|
|
# 2010
|
|
{'Prog': '2010\\vcredist_x86.exe',
|
|
'Args': ['/passive', '/norestart']},
|
|
{'Prog': '2010\\vcredist_x64.exe',
|
|
'Args': ['/passive', '/norestart']},
|
|
# 2012
|
|
{'Prog': '2012u4\\vcredist_x86.exe',
|
|
'Args': ['/passive', '/norestart']},
|
|
{'Prog': '2012u4\\vcredist_x64.exe',
|
|
'Args': ['/passive', '/norestart']},
|
|
# 2013
|
|
{'Prog': '2013\\vcredist_x86.exe',
|
|
'Args': ['/install', '/passive', '/norestart']},
|
|
{'Prog': '2013\\vcredist_x64.exe',
|
|
'Args': ['/install', '/passive', '/norestart']},
|
|
# 2015
|
|
{'Prog': '2015u3\\vc_redist.x86.exe',
|
|
'Args': ['/install', '/passive', '/norestart']},
|
|
{'Prog': '2015u3\\vc_redist.x64.exe',
|
|
'Args': ['/install', '/passive', '/norestart']},
|
|
]
|
|
for vcr in _redists:
|
|
try:
|
|
run_program(vcr['Prog'], vcr['Args'], check=False)
|
|
except:
|
|
print_error('Failed to install {}'.format(vcr['Prog']))
|
|
errors = True
|
|
|
|
# Main Bundle
|
|
if vars_wk['OS']['Version'] in ['Vista', '7']:
|
|
# Legacy selection
|
|
if ask('Install MSE?'):
|
|
_prog = '{BaseDir}/Installers/Extras/Security/Microsoft Security Essentials.exe'.format(**vars_wk)
|
|
subprocess.Popen(_prog)
|
|
_prog = '{BaseDir}/Installers/Extras/Bundles/Legacy.exe'.format(**vars_wk)
|
|
subprocess.Popen(_prog)
|
|
elif vars_wk['OS']['Version'] in ['8', '10']:
|
|
# Modern selection
|
|
_prog = '{BaseDir}/Installers/Extras/Bundles/Modern.exe'.format(**vars_wk)
|
|
subprocess.Popen(_prog)
|
|
|
|
if errors:
|
|
pause("Press Enter to exit...")
|
|
exit_script(vars_wk)
|