diff --git a/sample/product-template/CLIENT_DATA/delsub32.ins b/sample/product-template/CLIENT_DATA/delsub32.ins index f9bbf36..0f955e8 100644 --- a/sample/product-template/CLIENT_DATA/delsub32.ins +++ b/sample/product-template/CLIENT_DATA/delsub32.ins @@ -4,11 +4,19 @@ ; credits: http://www.opsi.org/credits/ -Set $MsiId$ = '{XXXXXXXX-XXXX-XXXX-XXXX-XXXXXXXXXXXX}' Set $UninstallProgram$ = $InstallDir$ + "\uninstall.exe" +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 FileExists($UninstallProgram$) comment "Uninstall program found, starting uninstall" Winbatch_uninstall @@ -39,6 +47,9 @@ LinkFolder_uninstall ; "$UninstallProgram$" /silent /norestart /SUPPRESSMSGBOXES +[Winbatch_uninstall_msi_old] +msiexec /x $MsiIdOld$ /qb! REBOOT=ReallySuppress + [Winbatch_uninstall_msi] msiexec /x $MsiId$ /qb! REBOOT=ReallySuppress diff --git a/sample/product-template/CLIENT_DATA/delsub3264.ins b/sample/product-template/CLIENT_DATA/delsub3264.ins index be5e544..c3f7f1d 100644 --- a/sample/product-template/CLIENT_DATA/delsub3264.ins +++ b/sample/product-template/CLIENT_DATA/delsub3264.ins @@ -4,15 +4,25 @@ ; credits: http://www.opsi.org/credits/ -Set $MsiId32$ = '{XXXXXXXX-XXXX-XXXX-XXXX-XXXXXXXXXXXX}' Set $UninstallProgram32$ = $InstallDir32$ + "\uninstall.exe" - -Set $MsiId64$ = '{XXXXXXXX-XXXX-XXXX-XXXX-XXXXXXXXXXXX}' Set $UninstallProgram64$ = $InstallDir64$ + "\uninstall.exe" +Set $IniFile32$ = $InstallDir32$ + "\opsi-" + $ProductId$ + ".ini" +Set $IniFile64$ = $InstallDir64$ + "\opsi-" + $ProductId$ + ".ini" + + if (($INST_SystemType$ = "x86 System") and ($INST_architecture$ = "system specific")) or ($INST_architecture$ = "both") or ($INST_architecture$ = "32 only") Message "Uninstalling " + $ProductId$ + " 32 Bit..." + if FileExists($IniFile32$) + Set $MsiIdOld32$ = GetValueFromInifile($IniFile32$,"X86","MsiId32","{XXXXXXXX-XXXX-XXXX-XXXX-XXXXXXXXXXXX}") + if not (GetRegistryStringValue32("[HKEY_LOCAL_MACHINE\SOFTWARE\Microsoft\Windows\CurrentVersion\Uninstall\" + $MsiIdOld32$ + "] DisplayName") = "") + comment "Old MSI id " + $MsiIdOld32$ + " found in registry, starting msiexec to uninstall old version" + Winbatch_uninstall_msi_old_32 + sub_check_exitcode + endif + endif + if FileExists($UninstallProgram32$) comment "Uninstall program found, starting uninstall" Winbatch_uninstall_32 @@ -34,6 +44,14 @@ endif if ($INST_SystemType$ = "64 Bit System") and (($INST_architecture$ = "system specific") or ($INST_architecture$ = "both") or ($INST_architecture$ = "64 only")) Message "Uninstalling " + $ProductId$ + " 64 Bit..." + if FileExists($IniFile64$) + Set $MsiIdOld64$ = GetValueFromInifile($IniFile64$,"X86_64","MsiId64","{XXXXXXXX-XXXX-XXXX-XXXX-XXXXXXXXXXXX}") + if not (GetRegistryStringValue64("[HKEY_LOCAL_MACHINE\SOFTWARE\Microsoft\Windows\CurrentVersion\Uninstall\" + $MsiIdOld64$ + "] DisplayName") = "") + comment "Old MSI id " + $MsiIdOld64$ + " found in registry, starting msiexec to uninstall old version" + Winbatch_uninstall_msi_old_64 + sub_check_exitcode + endif + endif if FileExists($UninstallProgram64$) comment "Uninstall program found, starting uninstall" Winbatch_uninstall_64 @@ -65,6 +83,9 @@ LinkFolder_uninstall ; "$UninstallProgram32$" /silent /norestart /SUPPRESSMSGBOXES +[Winbatch_uninstall_msi_old_32] +msiexec /x $MsiIdOld32$ /qb! REBOOT=ReallySuppress + [Winbatch_uninstall_msi_32] msiexec /x $MsiId32$ /qb! REBOOT=ReallySuppress @@ -83,6 +104,9 @@ msiexec /x $MsiId32$ /qb! REBOOT=ReallySuppress ; "$UninstallProgram64$" /silent /norestart /SUPPRESSMSGBOXES +[Winbatch_uninstall_msi_old_64] +msiexec /x $MsiIdOld64$ /qb! REBOOT=ReallySuppress + [Winbatch_uninstall_msi_64] msiexec /x $MsiId64$ /qb! REBOOT=ReallySuppress diff --git a/sample/product-template/CLIENT_DATA/delsub64.ins b/sample/product-template/CLIENT_DATA/delsub64.ins index a633255..894f772 100644 --- a/sample/product-template/CLIENT_DATA/delsub64.ins +++ b/sample/product-template/CLIENT_DATA/delsub64.ins @@ -4,11 +4,19 @@ ; credits: http://www.opsi.org/credits/ -Set $MsiId$ = '{XXXXXXXX-XXXX-XXXX-XXXX-XXXXXXXXXXXX}' Set $UninstallProgram$ = $InstallDir$ + "\uninstall.exe" +Set $IniFile$ = $InstallDir$ + "\opsi-" + $ProductId$ + ".ini" Message "Uninstalling " + $ProductId$ + " ..." +if FileExists($IniFile$) + Set $MsiIdOld$ = GetValueFromInifile($IniFile$,"X86_64","MsiId","{XXXXXXXX-XXXX-XXXX-XXXX-XXXXXXXXXXXX}") + if not (GetRegistryStringValue64("[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 FileExists($UninstallProgram$) comment "Uninstall program found, starting uninstall" Winbatch_uninstall @@ -39,6 +47,9 @@ LinkFolder_uninstall ; "$UninstallProgram$" /silent /norestart /SUPPRESSMSGBOXES +[Winbatch_uninstall_msi_old] +msiexec /x $MsiIdOld$ /qb! REBOOT=ReallySuppress + [Winbatch_uninstall_msi] msiexec /x $MsiId$ /qb! REBOOT=ReallySuppress diff --git a/sample/product-template/CLIENT_DATA/opsi-PN.ini b/sample/product-template/CLIENT_DATA/opsi-PN.ini new file mode 100644 index 0000000..978f02e --- /dev/null +++ b/sample/product-template/CLIENT_DATA/opsi-PN.ini @@ -0,0 +1,11 @@ +[X86] +MsiId={XXXXXXXX-XXXX-XXXX-XXXX-XXXXXXXXXXXX} +MsiId32={XXXXXXXX-XXXX-XXXX-XXXX-XXXXXXXXXXXX} + +[X86_64] +MsiId={XXXXXXXX-XXXX-XXXX-XXXX-XXXXXXXXXXXX} +MsiId64={XXXXXXXX-XXXX-XXXX-XXXX-XXXXXXXXXXXX} + +[COMMON] +PN=name +VERSION=version diff --git a/sample/product-template/CLIENT_DATA/setup32.ins b/sample/product-template/CLIENT_DATA/setup32.ins index 3333fbd..43d4214 100644 --- a/sample/product-template/CLIENT_DATA/setup32.ins +++ b/sample/product-template/CLIENT_DATA/setup32.ins @@ -6,8 +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$ @@ -39,6 +42,7 @@ Set $ProductId$ = "opsi-template" Set $MinimumSpace$ = "1 MB" ; the path were we find the product after the installation Set $InstallDir$ = "%ProgramFiles32Dir%\" +Set $IniCfgFile$ = "%ScriptPath%\opsi-" + $ProductId$ + ".ini" Set $LicenseRequired$ = "false" Set $LicensePool$ = "p_" + $ProductId$ ; ---------------------------------------------------------------- @@ -114,6 +118,9 @@ endif ; "%ScriptPath%\setup.exe" /sp- /silent /norestart /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$" diff --git a/sample/product-template/CLIENT_DATA/setup3264.ins b/sample/product-template/CLIENT_DATA/setup3264.ins index 7ff0f3e..6c9d30e 100644 --- a/sample/product-template/CLIENT_DATA/setup3264.ins +++ b/sample/product-template/CLIENT_DATA/setup3264.ins @@ -6,10 +6,15 @@ [Actions] requiredWinstVersion >= "4.10.8.6" -DefVar $MsiId32$ +; DefVar $MsiId32$ +DefVar $MsiIdOld32$ DefVar $UninstallProgram32$ -DefVar $MsiId64$ +DefVar $IniFile32$ +; DefVar $MsiId64$ +DefVar $MsiIdOld64$ DefVar $UninstallProgram64$ +DefVar $IniFile64$ +DefVar $IniCfgFile$ DefVar $LogDir$ DefVar $ProductId$ DefVar $MinimumSpace$ @@ -49,6 +54,7 @@ Set $MinimumSpace$ = "1 MB" ; the path were we find the product after the installation Set $InstallDir32$ = "%ProgramFiles32Dir%\" Set $InstallDir64$ = "%ProgramFiles64Dir%\" +Set $IniCfgFile$ = "%ScriptPath%\opsi-" + $ProductId$ + ".ini" Set $LicenseRequired$ = "false" Set $LicensePool$ = "p_" + $ProductId$ ; ---------------------------------------------------------------- @@ -128,6 +134,8 @@ endif ; "%ScriptPath%\setup.exe" /sp- /silent /norestart /SUPPRESSMSGBOXES [Files_install_32] +copy "$IniCfgFile$" "$InstallDir32$" + ; Example of recursively copying some files into the installation directory: ; ; copy -s "%ScriptPath%\files\*.*" "$InstallDir32$" @@ -159,6 +167,8 @@ endif ; "%ScriptPath%\setup.exe" /sp- /silent /norestart /SUPPRESSMSGBOXES [Files_install_64] +copy "$IniCfgFile$" "$InstallDir64$" + ; Example of recursively copying some files into the installation directory: ; ; copy -s "%ScriptPath%\files\*.*" "$InstallDir64$" diff --git a/sample/product-template/CLIENT_DATA/setup64.ins b/sample/product-template/CLIENT_DATA/setup64.ins index 045cf7f..d4ebde1 100644 --- a/sample/product-template/CLIENT_DATA/setup64.ins +++ b/sample/product-template/CLIENT_DATA/setup64.ins @@ -6,9 +6,11 @@ [Actions] requiredWinstVersion >= "4.10.8.6" -DefVar $MsiId$ +; DefVar $MsiId$ DefVar $UninstallProgram$ DefVar $LogDir$ +DefVar $IniFile$ +DefVar $IniCfgFile$ DefVar $ProductId$ DefVar $MinimumSpace$ DefVar $InstallDir$ @@ -39,6 +41,7 @@ Set $ProductId$ = "opsi-template" Set $MinimumSpace$ = "1 MB" ; the path were we find the product after the installation Set $InstallDir$ = "%ProgramFiles64Dir%\" +Set $IniCfgFile$ = "%ScriptPath%\opsi-" + $ProductId$ + ".ini" Set $LicenseRequired$ = "false" Set $LicensePool$ = "p_" + $ProductId$ ; ---------------------------------------------------------------- @@ -114,6 +117,8 @@ endif ; "%ScriptPath%\setup.exe" /sp- /silent /norestart /SUPPRESSMSGBOXES [Files_install] +copy "$IniCfgFile$" "$InstallDir$" + ; Example of recursively copying some files into the installation directory: ; ; copy -s "%ScriptPath%\files\*.*" "$InstallDir$" diff --git a/sample/product-template/CLIENT_DATA/uninstall32.ins b/sample/product-template/CLIENT_DATA/uninstall32.ins index ede4908..6d2ef5d 100644 --- a/sample/product-template/CLIENT_DATA/uninstall32.ins +++ b/sample/product-template/CLIENT_DATA/uninstall32.ins @@ -7,8 +7,11 @@ requiredWinstVersion >= "4.10.8.6" DefVar $MsiId$ +DefVar $MsiIdOld$ DefVar $UninstallProgram$ DefVar $LogDir$ +DefVar $IniFile$ +DefVar $IniCfgFile$ DefVar $ExitCode$ DefVar $ProductId$ DefVar $InstallDir$ diff --git a/sample/product-template/CLIENT_DATA/uninstall3264.ins b/sample/product-template/CLIENT_DATA/uninstall3264.ins index 4dec196..8ddb30d 100644 --- a/sample/product-template/CLIENT_DATA/uninstall3264.ins +++ b/sample/product-template/CLIENT_DATA/uninstall3264.ins @@ -7,9 +7,14 @@ requiredWinstVersion >= "4.10.8.6" DefVar $MsiId32$ +DefVar $MsiIdOld32$ DefVar $UninstallProgram32$ +DefVar $IniFile32$ DefVar $MsiId64$ +DefVar $MsiIdOld64$ DefVar $UninstallProgram64$ +DefVar $IniFile64$ +DefVar $IniCfgFile$ DefVar $LogDir$ DefVar $ExitCode$ DefVar $ProductId$ diff --git a/sample/product-template/CLIENT_DATA/uninstall64.ins b/sample/product-template/CLIENT_DATA/uninstall64.ins index 0eb5f4e..7c8e390 100644 --- a/sample/product-template/CLIENT_DATA/uninstall64.ins +++ b/sample/product-template/CLIENT_DATA/uninstall64.ins @@ -7,7 +7,10 @@ requiredWinstVersion >= "4.10.8.6" DefVar $MsiId$ +DefVar $MsiIdOld$ DefVar $UninstallProgram$ +DefVar $IniFile$ +DefVar $IniCfgFile$ DefVar $LogDir$ DefVar $ExitCode$ DefVar $ProductId$ diff --git a/sample/product-template/builder-product.cfg b/sample/product-template/builder-product.cfg index 7501b12..1e9ff4f 100644 --- a/sample/product-template/builder-product.cfg +++ b/sample/product-template/builder-product.cfg @@ -103,13 +103,36 @@ DL_WINST_NAME[2]=itWESS64 DL_FILE[3]="AiO-Runtimes-x86-v1.7.1.7z" DL_SOURCE[3]="http://ftp.computerbase.de/dl-758/weJMhoTGCTbFI5mzRnMlAg/1327825564/AiO-Runtimes-x86-v1.7.1.7z" DL_ARCH[3]="X86" -DL_DOWNLOADER="wget" +DL_DOWNLOADER[3]="wget" DL_EXTRACT_FORMAT[3]="unzip" DL_EXTACT_TO[3]="office" # File array index for the image showing while installing the program ICON_DL_INDEX=0 +######################### +# Setup required WINST variables +# which will be injected to the *.ins files (replaces token @@BUILDER_VARIABLES@@ ) +# +# The following tokens inside the WINST_VALUE will be replaced dynamically +# +# if your package is not msi based then you can remove the msi part from *.ins files and drop this variables compleatly +# !!! These Variables are requred if you remove them in this cfg file you will get error's about not defined Variables !!! +# +######################### +# if the packaga just supports X86 OR X86_64 (setupXX.ins delsubXX.ins uninstallXX.ins) then you have to just specify one MsiId + +WINST_NAME[0]="MsiId" +WINST_VALUE[0]="{XXXXXXXX-XXXX-XXXX-XXXX-XXXXXXXXXXXX}" + +# if the package supports X86 AND X86_64 (setup3264.ins delsub3264.ins uninstall3264.ins) then you have to specify 2 MsiId's + +WINST_NAME[0]="MsiId32" +WINST_VALUE[0]="{XXXXXXXX-XXXX-XXXX-XXXX-XXXXXXXXXXXX}" + +WINST_NAME[1]="MsiId64" +WINST_VALUE[1]="{XXXXXXXX-XXXX-XXXX-XXXX-XXXXXXXXXXXX}" + ######################### # Setup additional, custom WINST variables # which will be injected to the *.ins files (replaces token @@BUILDER_VARIABLES@@ )