Wait for installations

This commit is contained in:
2Shirt 2019-05-10 19:55:01 -06:00
parent f5f4c79326
commit c30e30232f
Signed by: 2Shirt
GPG key ID: 152FAC923B0E132C
3 changed files with 46 additions and 28 deletions

View file

@ -126,7 +126,7 @@ def enable_system_restore():
def update_clock():
"""Set Timezone and sync clock."""
run_program(['tzutil' ,'/s', WINDOWS_TIME_ZONE], check=False)
run_program(['tzutil', '/s', WINDOWS_TIME_ZONE], check=False)
run_program(['net', 'stop', 'w32ime'], check=False)
run_program(
['w32tm', '/config', '/syncfromflags:manual',
@ -294,9 +294,9 @@ def install_libreoffice(
run_program(cmd, check=True)
def install_ninite_bundle(
# pylint: disable=too-many-arguments,too-many-branches
base=True,
browsers_only=False,
current=False,
libreoffice=False,
missing=False,
mse=False,
@ -317,32 +317,43 @@ def install_ninite_bundle(
# Bail
return popen_objects
# Main bundle
selections = []
# Main selections
main_selections = []
if base:
selections.append('base')
if standard and not missing:
selections.append('browsers')
main_selections.append('base')
if standard:
if global_vars['OS']['Version'] in ('8', '8.1', '10'):
selections.append('standard')
main_selections.append('standard')
else:
selections.append('standard7')
main_selections.append('standard7')
cmd = r'{}\Installers\Extras\Bundles\{}.exe'.format(
global_vars['BaseDir'],
'-'.join(selections),
'-'.join(main_selections),
)
popen_objects.append(popen_program([cmd]))
# Current
if current:
for cmd in find_current_software():
popen_objects.append(popen_program([cmd]))
# Missing
# Extra selections
extra_selections = {}
for cmd in find_current_software():
extra_selections[cmd] = True
if missing:
for cmd in find_missing_software():
popen_objects.append(popen_program([cmd]))
extra_selections[cmd] = True
# Remove overlapping selections
regex = []
for n_name, n_group in NINITE_REGEX.items():
if n_name in main_selections:
regex.extend(n_group)
regex = '({})'.format('|'.join(regex))
extra_selections = {
cmd: True for cmd in extra_selections
if not re.search(regex, cmd, re.IGNORECASE)
}
# Start extra selections
for cmd in extra_selections:
popen_objects.append(popen_program([cmd]))
# Microsoft Security Essentials
if mse:

View file

@ -73,19 +73,18 @@ VCREDIST_SOURCES = {
'64': 'https://aka.ms/vs/15/release/vc_redist.x64.exe',
},
}
NINITE_REGEX = {
'base': ['7-Zip', 'VLC'],
'standard': ['Google Chrome', 'Mozilla Firefox', 'SumatraPDF'],
'standard7': ['Google Chrome', 'Mozilla Firefox', 'SumatraPDF'],
}
NINITE_SOURCES = {
'Bundles': {
'base-browsers-standard.exe': '.net4.7.2-7zip-chrome-classicstart-firefox-sumatrapdf-vlc',
'base-browsers-standard7.exe': '.net4.7.2-7zip-chrome-firefox-sumatrapdf-vlc',
'base-browsers.exe': '.net4.7.2-7zip-chrome-firefox-vlc',
'base-standard.exe': '.net4.7.2-7zip-classicstart-sumatrapdf-vlc',
'base-standard7.exe': '.net4.7.2-7zip-sumatrapdf-vlc',
'base.exe': '.net4.7.2-7zip-vlc',
'browsers-standard.exe': 'chrome-classicstart-firefox-sumatrapdf',
'browsers-standard7.exe': 'chrome-firefox-sumatrapdf',
'browsers.exe': 'chrome-firefox',
'standard.exe': 'classicstart-sumatrapdf',
'standard7.exe': 'sumatrapdf',
'base-standard.exe': '.net4.7.2-7zip-chrome-classicstart-firefox-sumatrapdf-vlc',
'base-standard7.exe': '.net4.7.2-7zip-chrome-firefox-sumatrapdf-vlc',
'standard.exe': 'chrome-classicstart-firefox-sumatrapdf',
'standard7.exe': 'chrome-firefox-sumatrapdf',
},
'Audio-Video': {
'AIMP.exe': 'aimp',

View file

@ -140,7 +140,6 @@ SETUP_QUESTIONS = {
# Ninite
'Base': {'New': True, 'Fab': True, 'Cur': True, 'HW': False},
'Current': {'New': False, 'Fab': False, 'Cur': True, 'HW': False},
'Missing': {'New': False, 'Fab': True, 'Cur': False, 'HW': False},
'Standard': {'New': True, 'Fab': True, 'Cur': False, 'HW': False},
}
@ -321,6 +320,15 @@ def main():
other_results=OTHER_RESULTS,
**kwargs)
# Wait for Ninite proc(s)
if action == 'Ninite bundle':
print_standard('Waiting for installations to finish...')
try:
for proc in result['Out']:
proc.wait()
except KeyboardInterrupt:
pass
# Pause
if values.get('Pause', False):
print_standard(values['Pause'])