Lodahl's blog: silent
Showing posts with label silent. Show all posts
Showing posts with label silent. Show all posts

29 September 2014

Silent installation on Windows (again)


One of many advantages of open source projects is for sure the eternal transition and evolutionary progress. This keeps people like my self busy just following the changes.

Last week I was asked to help a large organization prepare their LibreOffice install package for Windows and I thought “Cool – that gonna take about half an hour”. -Wrong!

The Windows installation parameters has been changed and as always it takes quite some time to find the documentation. You can find some documentation here: https://wiki.documentfoundation.org/Deployment_and_Migration But have ind mind that parameters has changed over time so you can't trust all of it.

The idea of installing all modules ( ADDLOCAL=ALL) and the remove individual modules ( REMOVE=gm_r_ex_Dictionary_Fr, ….) is still valid. But choosing language for the GUI is a little easier than before (UI_LANGS=en_US,da). Earlier you had to add all the language codes to the string and then choose your choice for each (… IS1030=1 IS1031=0 …).

Below is an example that installs LibreOffice in Danish and US English with some but not all dictionaries:

msiexec /qn /i C:\[path_to_install]\LibreOffice_4.3.2.2_Win_x86.msi /l* C:\[path_to_logs]\libreoffice_install_log.txt UI_LANGS=en_US,da CREATEDESKTOPLINK=1 ALLUSERS=1 RebootYesNo=No ADDLOCAL=ALL ISCHECKFORPRODUCTUPDATES=0 QUICKSTART=0 REMOVE=gm_r_ex_Dictionary_Fr,gm_r_ex_Dictionary_Es,gm_r_ex_Dictionary_Sr,gm_r_ex_Dictionary_Pt_Br,gm_r_ex_Dictionary_It,gm_r_ex_Dictionary_Af,gm_r_ex_Dictionary_An,gm_r_ex_Dictionary_Ar,gm_r_ex_Dictionary_Be,gm_r_ex_Dictionary_Bg,gm_r_ex_Dictionary_Bn,gm_r_ex_Dictionary_Br,gm_r_ex_Dictionary_Bs,gm_r_ex_Dictionary_Pt_Pt,gm_r_ex_Dictionary_Ca,gm_r_ex_Dictionary_Cs,gm_r_ex_Dictionary_De,gm_r_ex_Dictionary_Nl,gm_r_ex_Dictionary_Et,gm_r_ex_Dictionary_Gd,gm_r_ex_Dictionary_Gl,gm_r_ex_Dictionary_Gu,gm_r_ex_Dictionary_He,gm_r_ex_Dictionary_Hi,gm_r_ex_Dictionary_Hu,gm_r_ex_Dictionary_Ru,gm_r_ex_Dictionary_Lt,gm_r_ex_Dictionary_Lv,gm_r_ex_Dictionary_Ne,gm_r_ex_Dictionary_No,gm_r_ex_Dictionary_Is,gm_r_ex_Dictionary_Oc,gm_r_ex_Dictionary_Pl,gm_r_ex_Dictionary_Ro,gm_r_ex_Dictionary_Si,gm_r_ex_Dictionary_Lo,gm_r_ex_Dictionary_Sk,gm_r_ex_Dictionary_Sl,gm_r_ex_Dictionary_El,gm_r_ex_Dictionary_Hr,gm_r_ex_Dictionary_Sv,gm_r_ex_Dictionary_Te,gm_r_ex_Dictionary_Th,gm_r_ex_Dictionary_Uk,gm_r_ex_Dictionary_Vi,gm_r_ex_Dictionary_Zu

Some other things that has been improved dramatically is the new way of handling settings. In earlier versions settings could be manipulated by installing an extension with some XML-files. Nice but not perfect as you had to distribute files to each and every computer. 

From LibreOffice 4.2 its possible to change settings through the Windows Registry and this can be managed through one or more Group Policies in the Active Directory or similar adminsitration system.


I needed to make two small changes:
  1. Set “Warn alien format” to “false” and lock the setting.
  2. Set “Macro security level” to “High” and lock the settings
All I needed to do was to create two new keys in the Windows Registry and push this through a new Group Policy to the machines:

[HKEY_LOCAL_MACHINE\SOFTWARE\Policies\LibreOffice\org.openoffice.Office.Common\Save\Document\WarnAlienFormat]
"Value"="false" 
"Final"=dword:00000001

[HKEY_LOCAL_MACHINE\SOFTWARE\Policies\LibreOffice\org.openoffice.Office.Common\Security\Scripting\MacroSecurityLevel]
"Value"="2" 
"Final"=dword:00000001

I must say this is a much easier approach than the extension method and it makes the whole setup much more flexible since we don't need to handle extensions on each computer anymore.

17 November 2011

Silent installation - following up

In my earlier post about administrative installation of LibreOffice i described how its possible to use the program ORCA to manipulate the msi-file by creating a new mst-file.

Unfortunately this subject is not very well documented from the developers. if you are a developer and find that I am giving wrong or inaccurate information then please notify me ASAP.

Lately I have investigated some more details and possibilities in the installation process.

I have found that its possible to pass all the parameters directly to the installation without using a mst-file. The mst is like bundling the parameters in a container and in some situations this can be convenient e.g., if you need to distribute or publish a specific installation.

Overall I have found two interesting features. Basically I looked into the msi-file using ORCA and I found that the tables Feature and Properties include the most interesting parameters. All these can be manipulated as parameters at installation time.

Feature
The installed features are core components and it pretty much corresponds with the the page in the dialog that is only available if you select Custom installation from the gui.



If you want to manipulate the installed components with parameters you must first either identify every single component you want to install or better: install everything with the parameter ADDLOCAL=ALL and then define everything you don't want. This is done with the REMOVE parameter. Be aware that evetything you want to remove must be specified in one string with comma as separator and no space. E.g.,

REMOVE=gm_o_Testtool,gm_o_Xsltfiltersamples,gm_o_jf_Palm,gm_o_jf_Pocketpc

Predefined extensions can be removed like this:

REMOVE=gm_o_Extensions_PRESENTER_SCREEN,gm_o_Extensions_REPORTDESIGN

You can also remove dictionaries. Dictionaries are also installed as predefined extensions but in the installer process these are categorized as Dictionaries, so you need to add an extra part to the REMOVE like this:

REMOVE=gm_Dictionaries,gm_r_Extension_Dictionary_Af,gm_r_Extension_Dictionary_Pt

Please note the first value: gm_Dictionaries

Property
Another very important thing you can do during installation is setting some properties. The list is not complete, but only some examples:

  • ALLUSERS (default=1) - performs a per-user installation or per-machine installation depending on the access privileges of the user
  • CREATEDESKTOPLINK (default=1) - Create desktop shortcut icon
  • INSTALLLOCATION - specify installation directory
  • ISCHECKFORPRODUCTUPDATES (default=1) - Check for updates – I think this property is deprecated.
  • REGISTER_ALL_MSO_TYPES (default=0) - Use LibreOffice as the default application for Microsoft Office file formats
  • REGISTER_NO_MSO_TYPES (default=0) – Dont use LibreOffice as default application for any Microsoft Office file formats
  • REGISTER_DOC (default=0) - Use LibreOffice as the default application for Microsoft Word file format .doc (You can use similar for .xls, .ppt etc.)
  • IS1033 (default=1) – Unfortunately all languages are installed as default so you must specify each language that you DONT want to install. In the following example only Danish will be installed:
IS1033=0 IS1078=0 IS1025=0 IS1101=0 IS1610=0 IS1059=0 IS1026=0 IS2117=0 IS2121=0 IS1150=0 IS1603=0 IS5146=0 IS1027=0 IS32771=0 IS1029=0 IS1106=0 IS1030=1 IS1031=0 IS1604=0 IS2129=0 IS1032=0 IS2057=0 IS7177=0 IS1553=0 IS1034=0 IS1061=0 IS1069=0 IS1065=0 IS1035=0 IS1036=0 IS2108=0 IS1084=0 IS1110=0 IS1095=0 IS1037=0 IS1081=0 IS1050=0 IS1038=0 IS1057=0 IS1039=0 IS1040=0 IS1041=0 IS1079=0 IS1087=0 IS1107=0 IS1099=0 IS1042=0 IS1111=0 IS1120=0 IS1574=0 IS1108=0 IS1063=0 IS1062=0 IS1605=0 IS1071=0 IS1100=0 IS1104=0 IS1112=0 IS1102=0 IS1109=0 IS1044=0 IS1121=0 IS1043=0 IS2068=0 IS1580=0 IS1132=0 IS1154=0 IS2162=0 IS1096=0 IS1094=0 IS1045=0 IS2070=0 IS1046=0 IS1048=0 IS1049=0 IS1569=0 IS1103=0 IS1606=0 IS1113=0 IS2074=0 IS2133=0 IS1051=0 IS1060=0 IS1052=0 IS3098=0 IS1579=0 IS1072=0 IS1053=0 IS1089=0 IS1097=0 IS1098=0 IS1064=0 IS1054=0 IS1074=0 IS1055=0 IS1073=0 IS2200=0 IS1058=0 IS1091=0 IS1075=0 IS1066=0 IS1076=0 IS2052=0 IS1028=0 IS1077=0

I found a list of numeric language codes here: http://www.science.co.il/language/locale-codes.asp

This is an example of an installation with Danish language and only danish spellchecker (I don't remove gm_r_Extension_Dictionary_Da) with a few more details:

msiexec /qn /i libreoffice34.msi /L* ../Log/logfile1.txt TRANSFORMS=trans_da.mst SELECT_WORD=1 SELECT_EXCEL=1 SELECT_POWERPOINT=1 CREATEDESKTOPLINK=0 IS1033=0 IS1078=0 IS1025=0 IS1101=0 IS1610=0 IS1059=0 IS1026=0 IS2117=0 IS2121=0 IS1150=0 IS1603=0 IS5146=0 IS1027=0 IS32771=0 IS1029=0 IS1106=0 IS1030=1 IS1031=0 IS1604=0 IS2129=0 IS1032=0 IS2057=0 IS7177=0 IS1553=0 IS1034=0 IS1061=0 IS1069=0 IS1065=0 IS1035=0 IS1036=0 IS2108=0 IS1084=0 IS1110=0 IS1095=0 IS1037=0 IS1081=0 IS1050=0 IS1038=0 IS1057=0 IS1039=0 IS1040=0 IS1041=0 IS1079=0 IS1087=0 IS1107=0 IS1099=0 IS1042=0 IS1111=0 IS1120=0 IS1574=0 IS1108=0 IS1063=0 IS1062=0 IS1605=0 IS1071=0 IS1100=0 IS1104=0 IS1112=0 IS1102=0 IS1109=0 IS1044=0 IS1121=0 IS1043=0 IS2068=0 IS1580=0 IS1132=0 IS1154=0 IS2162=0 IS1096=0 IS1094=0 IS1045=0 IS2070=0 IS1046=0 IS1048=0 IS1049=0 IS1569=0 IS1103=0 IS1606=0 IS1113=0 IS2074=0 IS2133=0 IS1051=0 IS1060=0 IS1052=0 IS3098=0 IS1579=0 IS1072=0 IS1053=0 IS1089=0 IS1097=0 IS1098=0 IS1064=0 IS1054=0 IS1074=0 IS1055=0 IS1073=0 IS2200=0 IS1058=0 IS1091=0 IS1075=0 IS1066=0 IS1076=0 IS2052=0 IS1028=0 IS1077=0 REGISTER_DOC=1 ADDLOCAL=ALL REMOVE=gm_o_Testtool,gm_o_Xsltfiltersamples,gm_o_jf_Palm,gm_o_jf_Pocketpc,gm_o_Quickstart,gm_o_Extensions_PRESENTER_SCREEN,gm_o_Extensions_REPORTDESIGN,gm_o_Extensions_MEDIAWIKI,gm_o_Extensions_MINIMIZER,gm_Dictionaries,gm_r_Extension_Dictionary_Af,gm_r_Extension_Dictionary_Pt,gm_r_Extension_Dictionary_Ca,gm_r_Extension_Dictionary_Hr,gm_r_Extension_Dictionary_Cs,gm_r_Extension_Dictionary_Nl,gm_r_Extension_Dictionary_Et,gm_r_Extension_Dictionary_Fr,gm_r_Extension_Dictionary_De_AT,gm_r_Extension_Dictionary_De_DE,gm_r_Extension_Dictionary_De_CH,gm_r_Extension_Dictionary_He,gm_r_Extension_Dictionary_Hu,gm_r_Extension_Dictionary_It,gm_r_Extension_Dictionary_Ku_Tr,gm_r_Extension_Dictionary_Lt,gm_r_Extension_Dictionary_Ne,gm_r_Extension_Dictionary_No,gm_r_Extension_Dictionary_Oc,gm_r_Extension_Dictionary_Pl,gm_r_Extension_Dictionary_Ro,gm_r_Extension_Dictionary_Ru,gm_r_Extension_Dictionary_Sr,gm_r_Extension_Dictionary_Sk,gm_r_Extension_Dictionary_Sl,gm_r_Extension_Dictionary_Es,gm_r_Extension_Dictionary_Sv,gm_r_Extension_Dictionary_Th,gm_r_Extension_Dictionary_Uk,gm_r_Extension_Dictionary_Vi,gm_r_Extension_Dictionary_Zu


If you take a look in the log file you can see some details about how the installation process was. You can also see most of the properties that you can set in the installation.

Thanks to my colleague and good friend Beemen Beshara for valuable input.

15 February 2011

Silent installation of LibreOffice on Windows

The product packaging and installation procedure of LibreOffice for Windows are rather different from earlier experiences from OpenOffice.org. LibreOffice comes with one installation file containing all languages. Further more you need to download and install the help files separately.


If you are a private user this isn't any problem. Just download the two files, install it. You can change the language under Tools – Options – Language settings – Language.

But what if you are to install LibreOffice in a larger scale? Companies, organizations and public authorities can't install LibreOffice individual on each machine.

Most IT departments uses some kind of installation tool like Zenworks or IBM Tivoli. No matter which you need to know some insight knowledge to succeed.

In this article I will demonstrate some techniques using simple batch scripting but you can probably 'translate' these demonstrations to your own tool.

Preparing the installation files

Download

First you need to do is to download the two relevant installation files:

  • LibO_3.3.0_Win_x86_install_multi.exe

  • LibO_3.3.0_Win_x86_helppack_da.exe

You can find the files here: http://da.libreoffice.org/hent-libreoffice/ or http://www.libreoffice.org/download/

When you have downloaded the files you should execute and run the installation.


Select a suitable spot where you can extract the content. Be carefull not to mix the two. Extract the content to two separate subfolders e.g.,: “Program” and “Help”.



After extracting the content you should abort the installation (Cancel).

Extracting content from the executables can be done silently with the following command:

LibO_3.3.2_Win_x86_install_multi.exe /EXTRACTONLY=ON /S /D=c:\Path\to\Extracted\Installer\Files



The installation package is now extracted but not installed yet.

Installation

Because we need to atomize the installation process we will create a simple Windows batch file named “Install.bat” in the form of a normal text file. You can use Notepad or any other plain text editor. The content could look like this:

@echo off
CD "Program"
msiexec /qn /i libreoffice33.msi /L* ../logfile1.txt
CD ..
CD "Help"
msiexec /qn /i libreoffice33.msi /L* ../logfile2.txt

Please note that the two folders “Program” and “Help” is one level below the folder where “Install.bat” is. There will be created two log files (the /L parameter is optional) so you can detect errors if any.

Execute the bat file by double-clicking on the icon. You will see an empty dos window while the installation runs. It takes several minutes.


This window will close when the installation of LibreOffice is finalized.

Language settings

The version you just installed contains all (or most) languages but the graphical interface is in English. You can manually change this in “Tools – Options – Language Settings – Language” and change User interface to any other language of your choice. The language will be changing the next time you launch LibreOffice.

This (and all other) personal settings are stored in one specific file (registrymodifications.xcu). So if you exchange this file after installation with a simular file with the correct language settings, you are controlling the selected language in the GUI. You can create a fresh version of the file by installing LibreOffice on a “clean” computer and then change the language (without changing anything else. After that you can simply pick the file from “C:\Documents and Settings\[BRUGERNAVN]\Application Data\LibreOffice\3\user“ and distribute it to all users.

The installation file now looks like this:

@echo off
CD "Program"
msiexec /qn /i libreoffice33.msi /L* ../logfile1.txt
CD ..
MKDIR "%userprofile%\Application Data\LibreOffice\3\user"
Copy registrymodifications.xcu "%userprofile%\Application Data\LibreOffice\3\user" /y
CD "Help"
msiexec /qn /i libreoffice33.msi /L* ../logfile2.txt

Select language using an extension

Its even a better idea to control the default language by using an extension. I have created an example (http://blog.magenta-aps.dk/wp-content/uploads/2011/02/DanishUI.oxt). If you want to change the language you can simply open the oxt-file using a zip-program and edit the linguistic.xcu:

Installing the extension

The extension can be installed in several ways. One is to activate the UNOPKG mechanisme but with LibreOffice you can simply extract the content of the oxt file to the extension folder in LibreOffice: %PROGRAMFILES%\LibreOffice 3\share\extensions\DanishUI\META-INF\ . The batch file looks like this:

MD "%PROGRAMFILES%\LibreOffice 3\share\extensions\DanishUI\META-INF"
copy DanishUI\* "%PROGRAMFILES%\LibreOffice 3\share\extensions\DanishUI\"
copy DanishUI\META-INF\* "%PROGRAMFILES%\LibreOffice 3\share\extensions\DanishUI\META-INF\"

The oxt file is as mentioned above a zip file. It's not possible to unzip the content using simple batch programming, so you might have to extract it manually. The other operations are simple creating the folder and copying the files.

Install only the one language

A third and even better solution will be only to install the language you need. Unfortunately this is only possible by manipulating the msi file.

The program Orca (http://www.softpedia.com/get/Authoring-tools/Setup-creators/Orca.shtml) is a free tool for manipulating Windows installation files. I will actually recommend that you don't change the msi file but creates a new so called transformation file. This is a kind of ammendmend to the installation file.

What you actually do is to open the msi file in Orca and then attaches the existing transformation file for your language e.g., trans_da.mst. When you are done you can save (generate) a new transformation file with another name.

Orca

In Orca you can find Property in the left meny and then find the languages in the right window. All languages but the one you want to install must be changed to 0 (False). Danish is IS1030. You can find a (more or less) complere list of language codes here: http://www.science.co.il/language/Locale-Codes.asp?s=hexadecimal .

When you install LibreOffice you should attach the transformation file like this:

msiexec /qn /i libreoffice33.msi TRANSFORMS=trans_dansk.mst
  • trans_dansk.mst is the new transformation file we created

  • (trans_da.mst is the original transformation file for Danish)

Please have in mind that the transformation file (mst) must match the installation file (msi) precisely. So you have to generate a new mst file for each installation file you use.

Silent deinstallation

The similar batch file for deinstallation (uninstall.bat) could look like this:

@echo off
CD "Help"
msiexec /qn /x libreoffice33.msi /L* ../Logfile3.txt
CD ..
CD "Program"
msiexec /qn /x libreoffice33.msi /L* ../Logfile4.txt
RMDIR /S /Q "%userprofile%\Application Data\LibreOffice"

Please note that this batch file also removes all user settings. If you don't want to remove the settings you should remove the line “RMDIR…” from the batch file.

Note:

The file structure in these examples are from an English Windos XP. Other versions and languages of Windows might use other file paths.