GPG4win

From WPKG | Open Source Software Deployment and Distribution
Jump to: navigation, search

This is a silent installer and uninstaller for GPG4Win (http://www.gpg4win.org/), a packaged version of GNU Privacy Guard (http://www.gnupg.org/) for Windows.


2.x Package

  <package
    id="GPG4Win"
    name="GPG4Win"
    revision="2"
    priority="35"
    reboot="true"> 

    <check type="uninstall" condition="versiongreaterorequal" path="Gpg4win" value="2.1.0" />

    <install cmd='%comspec% /c "net stop DirMngr"'/>
    <install cmd='%SOFTWARE%\GPG4Win\gpg4win-2.1.0.exe /S'/>
 
     <upgrade include="install" />

    <remove cmd='%PROGRAMFILES%\GNU\GnuPG\gpg4win-uninstall.exe /S'/>

  </package>


Issues

  • starting from 2.2.4, the gpg4win-uninstall.exe needs a language parameter, e.g. "/language=Deutsch", otherwise there's a popup with a listbox.
  • Installation of 2.1.0 and 2.3.x gives "Error: StartService: ec=1-56" and never fully completes, stop the DirMngr -Service to prevent this
  • The 2.1.0 installer reboots straight after installation, whether it's the GUI installer doing so without prompting, or the silent installer

See a question about this on the GPG4Win forum at http://wald.intevation.org/forum/forum.php?thread_id=984&forum_id=21 You may want to fall back to a GNU Privacy Guard 1.4.11 binary for Windows from http://www.gnupg.org/.

Executing the uninstall-command via wpkg results sometimes in an error. The uninstall-process is completed with error code zero but the uninstall still fails according to wpkg. I was able to solve this problem by using an uninstaller-script that takes care of the issue. I didn't write it myself but I can't find the webpage again, where I took it from. Please add the author of the script if you know him.

unattended_uninstall.cmd:

@echo off

:: This script is an extended uninstaller script for programs which have tricky
:: uninstallers (e.g. VLC media player).
:: It is able to run an uninstaller application and then to monitor if the
:: uninstaller is erased from the system. Depending on the result (either
:: remove completes or timeout occurs) it exits with different ecit code:
:: code 0: all fine, program uninstalled
:: code 1: failed, uninstaller still exissts after timeout


:: This is required to evaluate the target of %ProgramFiles% on 64-bit systems
:: Please note that this is required only if you uninstall a 32-bit application.
set PROGRAM_FILES=%ProgramFiles%
if not "%ProgramFiles(x86)%" == "" set PROGRAM_FILES=%ProgramFiles(x86)%

:: Path to the uninstaller (see path definition above)
set UNINSTALLER=%ProgramFiles%\GNU\GnuPG\gpg4win-uninstall.exe

:: Options to be passed to the uninstaller in order to uninstall silently
set OPTIONS=/S


:: ############################################################################
:: No need to change anything below this line (usually ;-))
:: ############################################################################
echo Removing Program

if not exist "%UNINSTALLER%" goto good_end
start /wait "Uninstall" "%UNINSTALLER%" %OPTIONS%
REM Unfortunately the uninstaller seems to fork a child process and the parent
REM process exits immediately. So give it some time to uninstall
for /L %%C IN (1,1,30) DO (
  if not exist "%UNINSTALLER%" goto good_end
  ping -n 2 127.0.0.1 > NUL
)
:bad_end
exit /B 1

:good_end
if exist "%APP_DIR%" rmdir /s /q "%APP_DIR%"
exit /B 0

Installer Options

From the 'README file for Gpg4win':

The default installation path can be specified with the /D=PATH option, which must be last on the command line. The installer supports the options /S for unattended installation, and the option /C=INIFILE to specify an .ini file which should contain exactly one section "[gpg4win]". This section contains various installer settings and absolute file paths to configuration files that should be preinstalled. Most options just set a different default value. Exceptions are documented below. Here is an example file which shows all possible keys:

[gpg4win]
  ; Installer settings.  Do not define or leave empty for defaults.
  inst_gpgol = true
  inst_gpgex = true
  inst_kleopatra = true
  inst_gpa = true
  inst_claws_mail = false
  inst_compendium_de = true
  inst_man_novice_en = true

  ; Where to install short-cuts.
  inst_start_menu = true
  inst_desktop = false
  inst_quick_launch_bar = false

  ; Contrary to other settings in this file, the start menu folder
  ; setting here will override the user selection at installation
  ; time.
  inst_start_menu_folder = Gpg4win

  ; Additional configuration files to install.
  gpg.conf = D:\config\gpg-site.conf
  gpg-agent.conf = D:\config\gpg-agent-site.conf
  trustlist.txt = D:\config\trustlist-site.txt
  dirmngr.conf = D:\config\dirmngr-site.conf
  dirmngr_ldapserver.conf = D:\config\dirmngr_ldapserver-site.conf
  scdaemon.conf = D:\config\scdaemon-site.txt
  gpa.conf = D:\config\gpa-site.conf

An example command for unattended installation could look like this:

 gpg4win.exe /S /C=C:\TEMP\gpg4win.ini /D=D:\Programme\Gpg4win

For the MSI installer, the above also holds, with the following changes: Unattended installation is achieved as usual with the /qb- option to msiexec. The control file must be called gpg4win.ini and reside in the system directory (C:\WINDOWS). It is found automatically by the installer. The installation directory can be specified with an entry for "instdir". Also, each entry can be given in uppercase at the command line through INSTDIR=... and INST_GPA=FALSE etc. (the control file takes precedence, though). The default config files as well as start menu directory and optional installation of short cuts are currently not supported through the MSI installer.