Use local LibreOffice installer in system setup

This commit is contained in:
2Shirt 2019-05-05 15:14:11 -06:00
parent 1df64c30f8
commit dd08bc79e9
Signed by: 2Shirt
GPG key ID: 152FAC923B0E132C
3 changed files with 47 additions and 0 deletions

View file

@ -241,6 +241,36 @@ def install_firefox_extensions():
run_program(cmd)
def install_libreoffice(
quickstart=True, register_mso_types=True,
use_mso_formats=False, vcredist=False):
"""Install LibreOffice using specified settings."""
cmd = [
r'{}\Installers\Extras\Office\LibreOffice.msi'.format(
global_vars['BaseDir']),
'/qn',
'/norestart',
'REBOOTYESNO=No',
'ISCHECKFORPRODUCTUPDATES=0',
'QUICKSTART={}'.format(1 if quickstart else 0),
'UI_LANGS=en_US',
'VC_REDIST={}'.format(1 if vcredist else 0),
]
if register_mso_types:
cmd.append('REGISTER_ALL_MSO_TYPES=1')
else:
cmd.append('REGISTER_NO_MSO_TYPES=1')
xcu_file = r'{APPDATA}LibreOffice\4\user\registrymodifications.xcu'.format(
**global_vars)
# Set default save format
if use_mso_formats and not os.path.exists(xcu_file):
with open(xcu_file, 'w', encoding='utf-8', newline='\n') as f:
f.write(LIBREOFFICE_XCU_DATA)
# Install LibreOffice
run_program(cmd, check=True)
def install_ninite_bundle(browsers_only=False, mse=False, libreoffice=False):
"""Run Ninite installer(s), returns list of Popen objects."""
popen_objects = []

View file

@ -81,6 +81,14 @@ if __name__ == '__main__':
install_vcredists()
if answer_eset:
install_eset_nod32_av(scan_pups=answer_pups)
if answer_libreoffice:
try_and_print(message='LibreOffice...',
function=install_libreoffice, cs='done',
quickstart=True,
register_mso_types=True,
use_mso_formats=True,
vcredist=False,
)
result = try_and_print(
message='Ninite bundle...',
function=install_ninite_bundle, cs='Started',

View file

@ -155,6 +155,15 @@ SETTINGS_EXPLORER_USER = {
},
}
# LibreOffice
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://www.w3.org/2001/XMLSchema-instance">
<item oor:path="/org.openoffice.Setup/Office/Factories/org.openoffice.Setup:Factory['com.sun.star.presentation.PresentationDocument']"><prop oor:name="ooSetupFactoryDefaultFilter" oor:op="fuse"><value>Impress MS PowerPoint 2007 XML</value></prop></item>
<item oor:path="/org.openoffice.Setup/Office/Factories/org.openoffice.Setup:Factory['com.sun.star.sheet.SpreadsheetDocument']"><prop oor:name="ooSetupFactoryDefaultFilter" oor:op="fuse"><value>Calc MS Excel 2007 XML</value></prop></item>
<item oor:path="/org.openoffice.Setup/Office/Factories/org.openoffice.Setup:Factory['com.sun.star.text.TextDocument']"><prop oor:name="ooSetupFactoryDefaultFilter" oor:op="fuse"><value>MS Word 2007 XML</value></prop></item>
</oor:items>
'''
# Registry
SETTINGS_REGBACK = {
# Enable RegBack