From e3fd8667eebbd17a6bbd058329afc2eeb8f83017 Mon Sep 17 00:00:00 2001 From: Mario Fetka Date: Wed, 13 Mar 2013 14:00:32 +0100 Subject: [PATCH] update to new opsi builder templates --- CLIENT_DATA/delsub32.ins | 95 +++++++++++++++++++++-- CLIENT_DATA/login.ins | 24 ++++++ CLIENT_DATA/opsi-gpg4win.gpg4win.ini | 5 ++ CLIENT_DATA/setup32.ins | 110 +++++++++++++++++++++++---- CLIENT_DATA/uninstall32.ins | 17 +++-- GnuPG_logo_2006.png.sha1sum | 1 - builder-product.cfg | 10 ++- gpg4win.jpg.sha1sum | 1 + 8 files changed, 234 insertions(+), 29 deletions(-) create mode 100644 CLIENT_DATA/login.ins create mode 100644 CLIENT_DATA/opsi-gpg4win.gpg4win.ini delete mode 100644 GnuPG_logo_2006.png.sha1sum create mode 100644 gpg4win.jpg.sha1sum diff --git a/CLIENT_DATA/delsub32.ins b/CLIENT_DATA/delsub32.ins index 4a4bfd0..8f4fe7c 100644 --- a/CLIENT_DATA/delsub32.ins +++ b/CLIENT_DATA/delsub32.ins @@ -2,11 +2,71 @@ ; This sourcecode is owned by uib gmbh ; and published under the Terms of the General Public License. ; credits: http://www.opsi.org/en/credits/ -DefStringlist $outlist$ + Set $UninstallProgram$ = $InstallDir$ + "\gpg4win-uninstall.exe" +Set $IniFile$ = $InstallDir$ + "\opsi-" + $ProductId$ + ".ini" -Message "Uninstalling " + $ProductId$ + " ..." +if FileExists($IniFile$) + Set $OLD_VERSION$ = GetValueFromInifile($IniFile$,"COMMON","VERSION","") + Set $OLD_CREATOR_TAG$ = GetValueFromInifile($IniFile$,"COMMON","CREATOR_TAG","") + Set $OLD_RELEASE$ = GetValueFromInifile($IniFile$,"COMMON","RELEASE","") +endif +Message "Uninstalling " + $ProductId$ + " " + $OLD_VERSION$ + "-" + $OLD_CREATOR_TAG$ + $OLD_RELEASE$ + " ..." + +if FileExists($IniFile$) + Set $UninstallProg$ = GetValueFromInifile($IniFile$,"X86","UninstallProg","XXXXXXXX.exe") + Set $UninstallProgramOld$ = $InstallDir$ + "\" + $UninstallProg$ + if FileExists($UninstallProgramOld$) + comment "Uninstall program found, starting uninstall" + killtask "kleopatra.exe" + killtask "gpg-agent.exe" + killtask "dirmngr.exe" + killtask "dbus-daemon.exe" + killtask "qdbus.exe" + Files_uninstall_special + setLoglevel = 7 + set $outlist$ = getProcessList + DosInAnIcon_kill_tasks winst /32bit + set $outlist$ = getProcessList + Files_uninstall_special + Winbatch_uninstall /WaitforProcessending "Au_.exe" /Timeoutseconds 30 + sub_check_exitcode + if not ("" = takefirststringcontaining(getProcessList,"Au_.exe")) + killtask "qdbus.exe" + killtask "kleopatra.exe" + killtask "gpg-agent.exe" + killtask "dirmngr.exe" + killtask "dbus-daemon.exe" + sleepseconds "10" + set $outlist$ = getProcessList + endif + if not ("" = takefirststringcontaining(getProcessList,"Au_.exe")) + killtask "qdbus.exe" + killtask "kleopatra.exe" + killtask "gpg-agent.exe" + killtask "dirmngr.exe" + killtask "dbus-daemon.exe" + sleepseconds "10" + set $outlist$ = getProcessList + endif + if not ("" = takefirststringcontaining(getProcessList,"Au_.exe")) + killtask "qdbus.exe" + killtask "kleopatra.exe" + killtask "gpg-agent.exe" + killtask "dirmngr.exe" + killtask "dbus-daemon.exe" + sleepseconds "10" + set $outlist$ = getProcessList + endif + if not ("" = takefirststringcontaining(getProcessList,"Au_.exe")) + set $outlist$ = getProcessList + LogError("uninstallation failed") + isFatalError + endif + setLoglevel = 6 + endif +endif if FileExists($UninstallProgram$) comment "Uninstall program found, starting uninstall" @@ -61,11 +121,21 @@ endif comment "Delete files" Files_uninstall /32Bit +comment "Cleanup registry" +Registry_uninstall /32Bit + +comment "Delete program shortcuts" +LinkFolder_uninstall + +[Winbatch_uninstall_old] +"$UninstallProgramOld$" /S + [Winbatch_uninstall] -; === Nullsoft Scriptable Install System ================================================================ "$UninstallProgram$" /S [Files_uninstall] +; Example for recursively deleting the installation directory: +; del -sf "$InstallDir$\" [Files_uninstall_special] @@ -77,6 +147,23 @@ taskkill /IM "gpg-agent.exe" /F taskkill /IM "dirmngr.exe" /F taskkill /IM "dbus-daemon.exe" /F +[Registry_uninstall] +; Example of deleting a registry key: +; +; deletekey [HKEY_LOCAL_MACHINE\Software\$ProductId$] + +[LinkFolder_uninstall] +; Example of deleting a folder from AllUsers startmenu: +; +; set_basefolder common_programs +; delete_subfolder $ProductId$ +; +; Example of deleting a shortcut from AllUsers desktop: +; +; set_basefolder common_desktopdirectory +; set_subfolder "" +; delete_element $ProductId$ + [Sub_check_exitcode] comment "Test for installation success via exit code" set $ExitCode$ = getLastExitCode @@ -94,12 +181,10 @@ else if ($ExitCode$ = "1641") comment "looks good: setup program gives exitcode 1641" comment "ERROR_SUCCESS_REBOOT_INITIATED 1641 The installer has initiated a restart. This message is indicative of a success." - Exitwindows /Reboot else if ($ExitCode$ = "3010") comment "looks good: setup program gives exitcode 3010" comment "ERROR_SUCCESS_REBOOT_REQUIRED 3010 A restart is required to complete the install. This message is indicative of a success." - Exitwindows /Reboot else logError "Fatal: Setup program gives an unknown exitcode unequal zero: " + $ExitCode$ isFatalError diff --git a/CLIENT_DATA/login.ins b/CLIENT_DATA/login.ins new file mode 100644 index 0000000..7b85744 --- /dev/null +++ b/CLIENT_DATA/login.ins @@ -0,0 +1,24 @@ +; Copyright (c) uib gmbh (www.uib.de) +; This sourcecode is owned by uib gmbh +; and published under the Terms of the General Public License. +; credits: http://www.opsi.org/en/credits/ + +[Actions] +Message "Profile Patch for VLC ...." + +comment "Did we run this script before ? - and set version stamp in profile" +if getValue("installationstate", getProductMap) = "installed" + comment "Product is installed" + if not (scriptWasExecutedBefore) + comment "loginscript was not run yet " + Files_profile_copy + Registry_currentuser_set + endif +endif + +[Files_profile_copy] +copy "%Scriptpath%\profiles\*.*" "%CurrentAppdataDir%\ACME" + +[Registry_currentuser_set] +openkey [HKCU\Software\ACME] +set "show_greeting_window" = "no" diff --git a/CLIENT_DATA/opsi-gpg4win.gpg4win.ini b/CLIENT_DATA/opsi-gpg4win.gpg4win.ini new file mode 100644 index 0000000..41585d5 --- /dev/null +++ b/CLIENT_DATA/opsi-gpg4win.gpg4win.ini @@ -0,0 +1,5 @@ +[X86] + +[COMMON] +PN=name +VERSION=version diff --git a/CLIENT_DATA/setup32.ins b/CLIENT_DATA/setup32.ins index 2cdebac..a30ba15 100644 --- a/CLIENT_DATA/setup32.ins +++ b/CLIENT_DATA/setup32.ins @@ -6,18 +6,20 @@ [Actions] requiredWinstVersion >= "4.11.2.6" -DefVar $MsiId$ DefVar $UninstallProgram$ +DefVar $UninstallProgramOld$ +DefVar $IniFile$ +DefVar $IniCfgFile$ DefVar $LogDir$ DefVar $ProductId$ DefVar $MinimumSpace$ DefVar $InstallDir$ DefVar $ExitCode$ -DefVar $LicenseRequired$ -DefVar $LicenseKey$ -DefVar $LicensePool$ +DefVar $OLD_VERSION$ +DefVar $OLD_CREATOR_TAG$ +DefVar $OLD_RELEASE$ -Set $LogDir$ = "%SystemDrive%\opsi.org\tmp" +Set $LogDir$ = "%SystemDrive%\tmp" ; The token BUILDER_VARIABLES will be replaced by opsi-builder.sh ; and adds the following variables: @@ -33,38 +35,122 @@ Set $LogDir$ = "%SystemDrive%\opsi.org\tmp" ; - Please edit the following values - ; ---------------------------------------------------------------- ;$ProductId$ should be the name of the product in opsi -Set $ProductId$ = "gpg4win.gpg4win" +; therefore please: only lower letters, no umlauts, +; no white space use '-' as a seperator Set $MinimumSpace$ = "200 MB" ; the path were we find the product after the installation Set $InstallDir$ = "%ProgramFiles32Dir%\gnu\gnupg" ; ---------------------------------------------------------------- +Set $IniCfgFile$ = "%ScriptPath%\opsi-" + $ProductId$ + ".ini" + if not(HasMinimumSpace ("%SystemDrive%", $MinimumSpace$)) LogError "Not enough space on %SystemDrive%, " + $MinimumSpace$ + " on drive %SystemDrive% needed for " + $ProductId$ - isFatalError + isFatalError "No Space" ; Stop process and set installation status to failed else comment "Show product picture" - ShowBitmap "%ScriptPath%\" + $ProductId$ + ".png" $ProductId$ + ShowBitmap "%ScriptPath%\" + $ProductId$ + ".png" $NAME$ if FileExists("%ScriptPath%\delsub32.ins") comment "Start uninstall sub section" Sub "%ScriptPath%\delsub32.ins" endif - Message "Installing " + $ProductId$ + " ..." - + Message "Installing " + $ProductId$ + " "+ $VERSION$ + "-" + $CREATOR_TAG$ + $RELEASE$ + " ..." comment "Start setup program" ChangeDirectory "%SCRIPTPATH%" Winbatch_install Sub_check_exitcode + comment "Copy files" + Files_install /32Bit + + comment "Patch Registry" + Registry_install /32Bit + + comment "Create shortcuts" + LinkFolder_install + endif [Winbatch_install] +; Choose one of the following examples as basis for your installation +; You can use $LicenseKey$ var to pass a license key to the installer +; ; === Nullsoft Scriptable Install System ================================================================ -"$InstallExe$" /S +; "%ScriptPath%\Setup.exe" /S +; +; === MSI package ======================================================================================= +; You may use the parameter PIDKEY=$Licensekey$ +; msiexec /i "%ScriptPath%\some.msi" /l* "$LogDir$\$ProductId$.install_log.txt" /qb! ALLUSERS=1 REBOOT=ReallySuppress +; +; === InstallShield + MSI===================================================================================== +; Attention: The path to the log file should not contain any whitespaces +; "%ScriptPath%\setup.exe" /s /v" /l* $LogDir$\$ProductId$.install_log.txt /qb! ALLUSERS=1 REBOOT=ReallySuppress" +; "%ScriptPath%\setup.exe" /s /v" /qb! ALLUSERS=2 REBOOT=ReallySuppress" +; +; === InstallShield ===================================================================================== +; Create setup.iss answer file by running: setup.exe /r /f1"c:\setup.iss" +; You may use an answer file by the parameter /f1"c:\setup.iss" +; "%ScriptPath%\setup.exe" /s /sms /f2"$LogDir$\$ProductId$.install_log.txt" +; +; === Inno Setup ======================================================================================== +; http://unattended.sourceforge.net/InnoSetup_Switches_ExitCodes.html +; You may create setup answer file by: setup.exe /SAVEINF="filename" +; You may use an answer file by the parameter /LOADINF="filename" +; "%ScriptPath%\setup.exe" /sp- /silent /norestart /nocancel /SUPPRESSMSGBOXES + +[Files_install] +; copy the ini file to the InstallDir +copy "$IniCfgFile$" "$InstallDir$" + +; Example of recursively copying some files into the installation directory: +; +; copy -s "%ScriptPath%\files\*.*" "$InstallDir$" + +[Registry_install] +; Example of setting some values of an registry key: +; +; openkey [HKEY_LOCAL_MACHINE\Software\$ProductId$] +; set "name1" = "some string value" +; set "name2" = REG_DWORD:0001 +; set "name3" = REG_BINARY:00 af 99 cd + +[LinkFolder_install] +; Example of deleting a folder from AllUsers startmenu: +; +; set_basefolder common_programs +; delete_subfolder $ProductId$ +; +; Example of creating an shortcut to the installed exe in AllUsers startmenu: +; +; set_basefolder common_programs +; set_subfolder $ProductId$ +; +; set_link +; name: $ProductId$ +; target: +; parameters: +; working_dir: $InstallDir$ +; icon_file: +; icon_index: +; end_link +; +; Example of creating an shortcut to the installed exe on AllUsers desktop: +; +; set_basefolder common_desktopdirectory +; set_subfolder "" +; +; set_link +; name: $ProductId$ +; target: +; parameters: +; working_dir: $InstallDir$ +; icon_file: +; icon_index: 2 +; end_link [Sub_check_exitcode] comment "Test for installation success via exit code" @@ -83,12 +169,10 @@ else if ($ExitCode$ = "1641") comment "looks good: setup program gives exitcode 1641" comment "ERROR_SUCCESS_REBOOT_INITIATED 1641 The installer has initiated a restart. This message is indicative of a success." - Exitwindows /Reboot else if ($ExitCode$ = "3010") comment "looks good: setup program gives exitcode 3010" comment "ERROR_SUCCESS_REBOOT_REQUIRED 3010 A restart is required to complete the install. This message is indicative of a success." - Exitwindows /Reboot else logError "Fatal: Setup program gives an unknown exitcode unequal zero: " + $ExitCode$ isFatalError diff --git a/CLIENT_DATA/uninstall32.ins b/CLIENT_DATA/uninstall32.ins index 475d146..45c8c7c 100644 --- a/CLIENT_DATA/uninstall32.ins +++ b/CLIENT_DATA/uninstall32.ins @@ -6,16 +6,19 @@ [Actions] requiredWinstVersion >= "4.11.2.6" -DefVar $MsiId$ DefVar $UninstallProgram$ +DefVar $UninstallProgramOld$ +DefVar $IniFile$ +DefVar $IniCfgFile$ DefVar $LogDir$ DefVar $ExitCode$ DefVar $ProductId$ DefVar $InstallDir$ -DefVar $LicenseRequired$ -DefVar $LicensePool$ +DefVar $OLD_VERSION$ +DefVar $OLD_CREATOR_TAG$ +DefVar $OLD_RELEASE$ -Set $LogDir$ = "%SystemDrive%\opsi.org\tmp" +Set $LogDir$ = "%SystemDrive%\tmp" ; The token BUILDER_VARIABLES will be replaced by opsi-builder.sh ; and adds the following variables: @@ -30,14 +33,13 @@ Set $LogDir$ = "%SystemDrive%\opsi.org\tmp" ; ---------------------------------------------------------------- ; - Please edit the following values - ; ---------------------------------------------------------------- -Set $ProductId$ = "gpg4win.gpg4win" -; the path were we find the product after the installation Set $InstallDir$ = "%ProgramFiles32Dir%\gnu\gnupg" ; ---------------------------------------------------------------- +Set $IniCfgFile$ = "%ScriptPath%\opsi-" + $ProductId$ + ".ini" comment "Show product picture" -ShowBitmap "%ScriptPath%\" + $ProductId$ + ".png" $ProductId$ +ShowBitmap "%ScriptPath%\" + $ProductId$ + ".png" $NAME$ Message "Uninstalling " + $ProductId$ + " ..." @@ -46,4 +48,3 @@ if FileExists("%ScriptPath%\delsub32.ins") Sub "%ScriptPath%\delsub32.ins" endif - diff --git a/GnuPG_logo_2006.png.sha1sum b/GnuPG_logo_2006.png.sha1sum deleted file mode 100644 index c9447c3..0000000 --- a/GnuPG_logo_2006.png.sha1sum +++ /dev/null @@ -1 +0,0 @@ -96902fd180c2c61cac795e486dff5c5c49663e96 /home/mario/.opsi-dist-cache/gpg4win.gpg4win-2.1.0//GnuPG_logo_2006.png diff --git a/builder-product.cfg b/builder-product.cfg index 576734d..12bb9e1 100644 --- a/builder-product.cfg +++ b/builder-product.cfg @@ -3,6 +3,8 @@ ############################ VENDOR="gpg4win.de" PN="gpg4win.gpg4win" +NAME="GPG \\ 4Win" +DESCRIPTION"GnuPG Windows Helper" VERSION="2.1.0" RELEASE="3" PRIORITY="0" @@ -13,8 +15,8 @@ ADVICE="" TYPE="public" -DL_FILE[0]="GnuPG_logo_2006.png" -DL_SOURCE[0]="http://upload.wikimedia.org/wikipedia/ro/f/f1/GnuPG_logo_2006.png" +DL_FILE[0]="gpg4win.jpg" +DL_SOURCE[0]="http://petrkout.com/wp-content/uploads/2012/03/gpg4win.jpg" DL_FILE[1]="gpg4win-${VERSION}.exe" DL_SOURCE[1]="http://files.gpg4win.org/gpg4win-${VERSION}.exe" @@ -23,3 +25,7 @@ DL_WINST_NAME[1]=InstallExe # File array index for the image showing while installing the program ICON_DL_INDEX=0 + +OPSI_INI_SECTION[0]="X86" +OPSI_INI_OPTION[0]="UninstallProg" +OPSI_INI_VALUE[0]="gpg4win-uninstall.exe" diff --git a/gpg4win.jpg.sha1sum b/gpg4win.jpg.sha1sum new file mode 100644 index 0000000..b80e3e0 --- /dev/null +++ b/gpg4win.jpg.sha1sum @@ -0,0 +1 @@ +0bd8715e6493e762f44ad3ab019777518753cc58 /home/mario/.opsi-dist-cache/gpg4win.gpg4win-2.1.0//gpg4win.jpg