diff --git a/CLIENT_DATA/delsub32.ins b/CLIENT_DATA/delsub32.ins index 1dc3e1c..7c9024c 100644 --- a/CLIENT_DATA/delsub32.ins +++ b/CLIENT_DATA/delsub32.ins @@ -4,10 +4,18 @@ ; credits: http://www.opsi.org/credits/ -Set $MsiId$ = '{AC76BA86-7AD7-1031-7B44-AA1000000001}' +Set $IniFile$ = $InstallDir$ + "\opsi-" + $ProductId$ + ".ini" Message "Uninstalling " + $ProductId$ + " ..." +if FileExists($IniFile$) + Set $MsiIdOld$ = GetValueFromInifile($IniFile$,"X86","MsiId","{XXXXXXXX-XXXX-XXXX-XXXX-XXXXXXXXXXXX}") + if not (GetRegistryStringValue32("[HKEY_LOCAL_MACHINE\SOFTWARE\Microsoft\Windows\CurrentVersion\Uninstall\" + $MsiIdOld$ + "] DisplayName") = "") + comment "Old MSI id " + $MsiIdOld$ + " found in registry, starting msiexec to uninstall old version" + Winbatch_uninstall_msi_old + sub_check_exitcode + endif +endif if not (GetRegistryStringValue32("[HKEY_LOCAL_MACHINE\SOFTWARE\Microsoft\Windows\CurrentVersion\Uninstall\" + $MsiId$ + "] DisplayName") = "") comment "MSI id " + $MsiId$ + " found in registry, starting msiexec to uninstall" Winbatch_uninstall_msi @@ -23,6 +31,9 @@ Registry_uninstall /32Bit comment "Delete program shortcuts" LinkFolder_uninstall +[Winbatch_uninstall_msi_old] +msiexec /x $MsiIdOld$ /qb! REBOOT=ReallySuppress + [Winbatch_uninstall_msi] msiexec /x $MsiId$ /qb! REBOOT=ReallySuppress diff --git a/CLIENT_DATA/opsi-adobe.acrobatreader.ini b/CLIENT_DATA/opsi-adobe.acrobatreader.ini new file mode 100644 index 0000000..f7bfbbc --- /dev/null +++ b/CLIENT_DATA/opsi-adobe.acrobatreader.ini @@ -0,0 +1,6 @@ +[X86] +MsiId={AC76BA86-7AD7-1031-7B44-AA1000000001} + +[COMMON] +PN=adobe.acrobatreader +VERSION=10.1.2.0 diff --git a/CLIENT_DATA/setup32.ins b/CLIENT_DATA/setup32.ins index 94709a8..20e6cc0 100644 --- a/CLIENT_DATA/setup32.ins +++ b/CLIENT_DATA/setup32.ins @@ -6,7 +6,11 @@ [Actions] requiredWinstVersion >= "4.10.8.6" -DefVar $MsiId$ +; DefVar $MsiId$ +DefVar $MsiIdOld$ +DefVar $UninstallProgram$ +DefVar $IniFile$ +DefVar $IniCfgFile$ DefVar $LogDir$ DefVar $ProductId$ DefVar $MinimumSpace$ @@ -35,6 +39,7 @@ Set $ProductId$ = "adobe.acrobatreader" Set $MinimumSpace$ = "150 MB" ; the path were we find the product after the installation Set $InstallDir$ = "%ProgramFiles32Dir%\Adobe\Reader 10.0\Reader\" +Set $IniCfgFile$ = "%ScriptPath%\opsi-" + $ProductId$ + ".ini" ; ---------------------------------------------------------------- if not(HasMinimumSpace ("%SystemDrive%", $MinimumSpace$)) @@ -77,9 +82,12 @@ else endif [Winbatch_install] -msiexec /i "$InstallMsi$" /l* "$LogDir$\$ProductId$.install_log.txt" /qb! ALLUSERS=2 REBOOT=ReallySuppress EULA_ACCEPT=YES +msiexec /i "$InstallMsi$" /l* "$LogDir$\$ProductId$.install_log.txt" /qb! ALLUSERS=2 REBOOT=ReallySuppress [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$" @@ -87,10 +95,10 @@ msiexec /i "$InstallMsi$" /l* "$LogDir$\$ProductId$.install_log.txt" /qb! ALLUSE [Registry_install] ; Example of setting some values of an registry key: ; -openkey [HKEY_LOCAL_MACHINE\Policies\Adobe\Acrobat Reader\10.0\FeatureLockDown] -set "bUpdater" = REG_DWORD:0000 -set "bProtectedMode" = REG_DWORD:0000 - +; 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: diff --git a/CLIENT_DATA/uninstall32.ins b/CLIENT_DATA/uninstall32.ins index d328e80..3d99296 100644 --- a/CLIENT_DATA/uninstall32.ins +++ b/CLIENT_DATA/uninstall32.ins @@ -6,14 +6,28 @@ [Actions] requiredWinstVersion >= "4.10.8.6" -DefVar $MsiId$ +; DefVar $MsiId$ +DefVar $MsiIdOld$ +DefVar $UninstallProgram$ DefVar $LogDir$ +DefVar $IniFile$ +DefVar $IniCfgFile$ DefVar $ExitCode$ DefVar $ProductId$ DefVar $InstallDir$ Set $LogDir$ = "%SystemDrive%\tmp" +; The token BUILDER_VARIABLES will be replaced by opsi-builder.sh +; and adds the following variables: +; from builder-product.cfg : all variables definded by attribute WINST[index] +; from builder-product.cfg : VENDOR PN VERSION RELEASE PRIORITY ADVICE TYPE +; from opsi-builder.cfg : CREATOR_TAG CREATOR_NAME CREATOR_EMAIL +; auto generated winst-variables +; $IconFile$: path to product picture +; +@@BUILDER_VARIABLES@@ + ; ---------------------------------------------------------------- ; - Please edit the following values - ; ---------------------------------------------------------------- @@ -31,4 +45,3 @@ if FileExists("%ScriptPath%\delsub32.ins") comment "Start uninstall sub section" Sub "%ScriptPath%\delsub32.ins" endif - diff --git a/builder-product.cfg b/builder-product.cfg index b062f71..451e87f 100644 --- a/builder-product.cfg +++ b/builder-product.cfg @@ -26,3 +26,7 @@ ICON_DL_INDEX=0 WINST_NAME[0]="InstallMsi" WINST_VALUE[0]="@DL_EXTRACT_WINST_PATH[1]@\\AcroRead.msi" + +WINST_NAME[1]="MsiId" +WINST_VALUE[1]="{AC76BA86-7AD7-1031-7B44-AA1000000001}" +