Major update for installing software bundles
* Initial versions of find_current_software() and find_missing_software() * Only covers browsers for now * Expanded bundles for more fine-tuned installations * Should fix failed installations in system_setup.py
This commit is contained in:
parent
70995f5dcf
commit
f5f4c79326
3 changed files with 103 additions and 20 deletions
|
|
@ -426,6 +426,12 @@ def list_homepages(indent=8, width=32):
|
||||||
indent=' '*indent, width=width, name=name, page=page))
|
indent=' '*indent, width=width, name=name, page=page))
|
||||||
|
|
||||||
|
|
||||||
|
def profile_present(browser_name):
|
||||||
|
"""Checks if a profile was detected for browser, returns bool."""
|
||||||
|
browser_name = browser_name.replace(' Chromium', '')
|
||||||
|
return bool(browser_data.get(browser_name, {}).get('profiles', False))
|
||||||
|
|
||||||
|
|
||||||
def reset_browsers(indent=8, width=32):
|
def reset_browsers(indent=8, width=32):
|
||||||
"""Reset all detected browsers to safe defaults."""
|
"""Reset all detected browsers to safe defaults."""
|
||||||
browser_list = [k for k, v in sorted(browser_data.items()) if v['profiles']]
|
browser_list = [k for k, v in sorted(browser_data.items()) if v['profiles']]
|
||||||
|
|
|
||||||
|
|
@ -158,6 +158,39 @@ def write_registry_settings(settings, all_users=False):
|
||||||
|
|
||||||
|
|
||||||
# Installations
|
# Installations
|
||||||
|
def find_current_software():
|
||||||
|
"""Find currently installed software, returns list."""
|
||||||
|
ninite_extras_path = r'{BaseDir}\Installers\Extras'.format(**global_vars)
|
||||||
|
installers = []
|
||||||
|
|
||||||
|
# Browsers
|
||||||
|
scan_for_browsers(skip_ie=True, silent=True)
|
||||||
|
for browser in ('Google Chrome', 'Mozilla Firefox', 'Opera Chromium'):
|
||||||
|
if is_installed(browser):
|
||||||
|
installers.append(
|
||||||
|
r'{}\Web Browsers\{}.exe'.format(ninite_extras_path, browser))
|
||||||
|
|
||||||
|
# TODO Add more sections
|
||||||
|
|
||||||
|
return installers
|
||||||
|
|
||||||
|
def find_missing_software():
|
||||||
|
"""Find missing software based on dirs/files present, returns list."""
|
||||||
|
ninite_extras_path = r'{BaseDir}\Installers\Extras'.format(**global_vars)
|
||||||
|
installers = []
|
||||||
|
|
||||||
|
# Browsers
|
||||||
|
scan_for_browsers(skip_ie=True, silent=True)
|
||||||
|
for browser in ('Google Chrome', 'Mozilla Firefox', 'Opera Chromium'):
|
||||||
|
if profile_present(browser):
|
||||||
|
installers.append(
|
||||||
|
r'{}\Web Browsers\{}.exe'.format(ninite_extras_path, browser))
|
||||||
|
|
||||||
|
# TODO Add more sections
|
||||||
|
|
||||||
|
return installers
|
||||||
|
|
||||||
|
|
||||||
def install_adobe_reader():
|
def install_adobe_reader():
|
||||||
"""Install Adobe Reader."""
|
"""Install Adobe Reader."""
|
||||||
cmd = [
|
cmd = [
|
||||||
|
|
@ -260,10 +293,19 @@ def install_libreoffice(
|
||||||
# Install LibreOffice
|
# Install LibreOffice
|
||||||
run_program(cmd, check=True)
|
run_program(cmd, check=True)
|
||||||
|
|
||||||
def install_ninite_bundle(browsers_only=False, mse=False, libreoffice=False):
|
def install_ninite_bundle(
|
||||||
|
base=True,
|
||||||
|
browsers_only=False,
|
||||||
|
current=False,
|
||||||
|
libreoffice=False,
|
||||||
|
missing=False,
|
||||||
|
mse=False,
|
||||||
|
standard=True,
|
||||||
|
):
|
||||||
"""Run Ninite installer(s), returns list of Popen objects."""
|
"""Run Ninite installer(s), returns list of Popen objects."""
|
||||||
popen_objects = []
|
popen_objects = []
|
||||||
if browsers_only:
|
if browsers_only:
|
||||||
|
# This option is deprecated
|
||||||
installer_path = r'{BaseDir}\Installers\Extras\Web Browsers'.format(
|
installer_path = r'{BaseDir}\Installers\Extras\Web Browsers'.format(
|
||||||
**global_vars)
|
**global_vars)
|
||||||
scan_for_browsers(skip_ie=True, silent=True)
|
scan_for_browsers(skip_ie=True, silent=True)
|
||||||
|
|
@ -271,26 +313,52 @@ def install_ninite_bundle(browsers_only=False, mse=False, libreoffice=False):
|
||||||
if is_installed(browser):
|
if is_installed(browser):
|
||||||
cmd = r'{}\{}.exe'.format(installer_path, browser)
|
cmd = r'{}\{}.exe'.format(installer_path, browser)
|
||||||
popen_objects.append(popen_program(cmd))
|
popen_objects.append(popen_program(cmd))
|
||||||
elif global_vars['OS']['Version'] in ('8', '8.1', '10'):
|
|
||||||
# Modern selection
|
# Bail
|
||||||
popen_objects.append(
|
return popen_objects
|
||||||
popen_program(r'{BaseDir}\Installers\Extras\Bundles\Modern.exe'.format(
|
|
||||||
**global_vars)))
|
# Main bundle
|
||||||
else:
|
selections = []
|
||||||
# Legacy selection
|
if base:
|
||||||
if mse:
|
selections.append('base')
|
||||||
cmd = r'{BaseDir}\Installers\Extras\Security'.format(**global_vars)
|
if standard and not missing:
|
||||||
cmd += r'\Microsoft Security Essentials.exe'
|
selections.append('browsers')
|
||||||
popen_objects.append(popen_program(cmd))
|
if standard:
|
||||||
popen_objects.append(
|
if global_vars['OS']['Version'] in ('8', '8.1', '10'):
|
||||||
popen_program(r'{BaseDir}\Installers\Extras\Bundles\Legacy.exe'.format(
|
selections.append('standard')
|
||||||
**global_vars)))
|
else:
|
||||||
|
selections.append('standard7')
|
||||||
|
cmd = r'{}\Installers\Extras\Bundles\{}.exe'.format(
|
||||||
|
global_vars['BaseDir'],
|
||||||
|
'-'.join(selections),
|
||||||
|
)
|
||||||
|
popen_objects.append(popen_program([cmd]))
|
||||||
|
|
||||||
|
# Current
|
||||||
|
if current:
|
||||||
|
for cmd in find_current_software():
|
||||||
|
popen_objects.append(popen_program([cmd]))
|
||||||
|
|
||||||
|
# Missing
|
||||||
|
if missing:
|
||||||
|
for cmd in find_missing_software():
|
||||||
|
popen_objects.append(popen_program([cmd]))
|
||||||
|
|
||||||
|
# Microsoft Security Essentials
|
||||||
|
if mse:
|
||||||
|
cmd = r'{}\Installers\Extras\Security\{}'.format(
|
||||||
|
global_vars['BaseDir'],
|
||||||
|
'Microsoft Security Essentials.exe',
|
||||||
|
)
|
||||||
|
popen_objects.append(popen_program([cmd]))
|
||||||
|
|
||||||
# LibreOffice
|
# LibreOffice
|
||||||
if libreoffice:
|
if libreoffice:
|
||||||
cmd = r'{BaseDir}\Installers\Extras\Office'.format(**global_vars)
|
cmd = r'{}\Installers\Extras\Office\{}'.format(
|
||||||
cmd += r'\LibreOffice.exe'
|
global_vars['BaseDir'],
|
||||||
popen_objects.append(popen_program(cmd))
|
'LibreOffice.exe',
|
||||||
|
)
|
||||||
|
popen_objects.append(popen_program([cmd]))
|
||||||
|
|
||||||
# Done
|
# Done
|
||||||
return popen_objects
|
return popen_objects
|
||||||
|
|
|
||||||
|
|
@ -75,8 +75,17 @@ VCREDIST_SOURCES = {
|
||||||
}
|
}
|
||||||
NINITE_SOURCES = {
|
NINITE_SOURCES = {
|
||||||
'Bundles': {
|
'Bundles': {
|
||||||
'Legacy.exe': '.net4.7.2-7zip-chrome-firefox-sumatrapdf-vlc',
|
'base-browsers-standard.exe': '.net4.7.2-7zip-chrome-classicstart-firefox-sumatrapdf-vlc',
|
||||||
'Modern.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',
|
||||||
},
|
},
|
||||||
'Audio-Video': {
|
'Audio-Video': {
|
||||||
'AIMP.exe': 'aimp',
|
'AIMP.exe': 'aimp',
|
||||||
|
|
|
||||||
Loading…
Reference in a new issue