diff --git a/.bin/Scripts/functions/setup.py b/.bin/Scripts/functions/setup.py index e6a901fa..08199377 100644 --- a/.bin/Scripts/functions/setup.py +++ b/.bin/Scripts/functions/setup.py @@ -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 = [] diff --git a/.bin/Scripts/new_system_setup.py b/.bin/Scripts/new_system_setup.py index a33f58d3..b0e9dbcd 100644 --- a/.bin/Scripts/new_system_setup.py +++ b/.bin/Scripts/new_system_setup.py @@ -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', diff --git a/.bin/Scripts/settings/setup.py b/.bin/Scripts/settings/setup.py index db30fe19..72d6a56f 100644 --- a/.bin/Scripts/settings/setup.py +++ b/.bin/Scripts/settings/setup.py @@ -155,6 +155,15 @@ SETTINGS_EXPLORER_USER = { }, } +# LibreOffice +LIBREOFFICE_XCU_DATA = ''' + +Impress MS PowerPoint 2007 XML +Calc MS Excel 2007 XML +MS Word 2007 XML + +''' + # Registry SETTINGS_REGBACK = { # Enable RegBack