From 940f3da59d8b75555249b0919e812ea4cd11e2dd Mon Sep 17 00:00:00 2001 From: Mario Fetka Date: Sun, 13 May 2012 09:30:28 +0200 Subject: [PATCH] new build system and change file association --- 7z920.exe.sha1sum | 1 - 7z920.msi.sha1sum | 1 + CLIENT_DATA/{delsub.ins => delsub3264.ins} | 42 +++++- CLIENT_DATA/opsi-7zip.7zip.ini | 9 ++ CLIENT_DATA/{setup.ins => setup3264.ins} | 136 +++++++++++------- .../{uninstall.ins => uninstall3264.ins} | 51 ++++--- OPSI/control | 4 +- builder-product.cfg | 12 +- 8 files changed, 173 insertions(+), 83 deletions(-) delete mode 100644 7z920.exe.sha1sum create mode 100644 7z920.msi.sha1sum rename CLIENT_DATA/{delsub.ins => delsub3264.ins} (69%) create mode 100644 CLIENT_DATA/opsi-7zip.7zip.ini rename CLIENT_DATA/{setup.ins => setup3264.ins} (57%) rename CLIENT_DATA/{uninstall.ins => uninstall3264.ins} (55%) diff --git a/7z920.exe.sha1sum b/7z920.exe.sha1sum deleted file mode 100644 index 4a63763..0000000 --- a/7z920.exe.sha1sum +++ /dev/null @@ -1 +0,0 @@ -55283ad59439134673fc32fc097bdd9ae920fbc6 /usr/portage/distfiles/7z920.exe diff --git a/7z920.msi.sha1sum b/7z920.msi.sha1sum new file mode 100644 index 0000000..c8491ee --- /dev/null +++ b/7z920.msi.sha1sum @@ -0,0 +1 @@ +c67d3f611ea3eb3336cf92f6ffcafdb14f8b12af /home/mario/.opsi-dist-cache/7zip.7zip-9.20/X86/7z920.msi diff --git a/CLIENT_DATA/delsub.ins b/CLIENT_DATA/delsub3264.ins similarity index 69% rename from CLIENT_DATA/delsub.ins rename to CLIENT_DATA/delsub3264.ins index edb1e38..c3f7f1d 100644 --- a/CLIENT_DATA/delsub.ins +++ b/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 $UninstallProgram32$ = $InstallDir32$ + "\uninstall.exe" +Set $UninstallProgram64$ = $InstallDir64$ + "\uninstall.exe" +Set $IniFile32$ = $InstallDir32$ + "\opsi-" + $ProductId$ + ".ini" +Set $IniFile64$ = $InstallDir64$ + "\opsi-" + $ProductId$ + ".ini" + -Set $MsiId64$ = '{23170F69-40C1-2702-0920-000001000000}' -Set $UninstallProgram32$ = $InstallDir64$ + "\Uninstall.exe" 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 @@ -59,9 +77,15 @@ LinkFolder_uninstall ; Choose one of the following examples as basis for program uninstall ; ; === Nullsoft Scriptable Install System ================================================================ -"$UninstallProgram32$" /S +; "$UninstallProgram32$" /S +; +; === Inno Setup ======================================================================================== +; "$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 @@ -74,9 +98,15 @@ msiexec /x $MsiId32$ /qb! REBOOT=ReallySuppress ; Choose one of the following examples as basis for program uninstall ; ; === Nullsoft Scriptable Install System ================================================================ -"$UninstallProgram64$" /S +; "$UninstallProgram64$" /S +; +; === Inno Setup ======================================================================================== +; "$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/CLIENT_DATA/opsi-7zip.7zip.ini b/CLIENT_DATA/opsi-7zip.7zip.ini new file mode 100644 index 0000000..c26e78f --- /dev/null +++ b/CLIENT_DATA/opsi-7zip.7zip.ini @@ -0,0 +1,9 @@ +[X86] +MsiId32={XXXXXXXX-XXXX-XXXX-XXXX-XXXXXXXXXXXX} + +[X86_64] +MsiId64={XXXXXXXX-XXXX-XXXX-XXXX-XXXXXXXXXXXX} + +[COMMON] +PN=7zip.7zip +VERSION=9.20 diff --git a/CLIENT_DATA/setup.ins b/CLIENT_DATA/setup3264.ins similarity index 57% rename from CLIENT_DATA/setup.ins rename to CLIENT_DATA/setup3264.ins index 7f41c94..ec9a545 100644 --- a/CLIENT_DATA/setup.ins +++ b/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$ @@ -28,7 +33,14 @@ set $INST_architecture$ = GetProductProperty("install_architecture","system spec Set $LogDir$ = "%SystemDrive%\tmp" -; Token BUILDER_VARIABLES will be replaced by opsi-builder.sh +; 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@@ ; ---------------------------------------------------------------- @@ -38,10 +50,11 @@ Set $LogDir$ = "%SystemDrive%\tmp" ; therefore please: only lower letters, no umlauts, ; no white space use '-' as a seperator Set $ProductId$ = "7zip.7zip" -Set $MinimumSpace$ = "3 MB" +Set $MinimumSpace$ = "10 MB" ; the path were we find the product after the installation Set $InstallDir32$ = "%ProgramFiles32Dir%\7-Zip" Set $InstallDir64$ = "%ProgramFiles64Dir%\7-Zip" +Set $IniCfgFile$ = "%ScriptPath%\opsi-" + $ProductId$ + ".ini" Set $LicenseRequired$ = "false" Set $LicensePool$ = "p_" + $ProductId$ ; ---------------------------------------------------------------- @@ -54,9 +67,9 @@ else comment "Show product picture" ShowBitmap "%ScriptPath%\" + $ProductId$ + ".png" $ProductId$ - if FileExists("%ScriptPath%\delsub.ins") + if FileExists("%ScriptPath%\delsub3264.ins") comment "Start uninstall sub section" - Sub "%ScriptPath%\delsub.ins" + Sub "%ScriptPath%\delsub3264.ins" endif if $LicenseRequired$ = "true" @@ -71,6 +84,8 @@ else comment "Start setup program" Winbatch_install_32 Sub_check_exitcode + Dosbatch_install_32 + Sub_check_exitcode comment "Copy files" Files_install_32 /32Bit comment "Patch Registry" @@ -84,6 +99,8 @@ else comment "Start setup program" Winbatch_install_64 Sub_check_exitcode + Dosbatch_install_64 + Sub_check_exitcode comment "Copy files" Files_install_64 /64Bit comment "Patch Registry" @@ -95,28 +112,52 @@ else endif [Winbatch_install_32] -; 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 ================================================================ -"$Install32Exe$" /S /D="$InstallDir32$" -"%ScriptPath%\associate.cmd" +msiexec /i "$Install32Msi$" /l* "$LogDir$\$ProductId$.install_log.txt" /qb! ALLUSERS=2 REBOOT=ReallySuppress + +[Dosbatch_install_32] +@echo off + +SET SC=HKLM\Software\Classes +SET Extn=001-9 7z-0 arj-4 bz2-2 bzip2-2 cab-7 cpio-7 deb-11 dmg-17 gz-14 fat-21 gz-14 gzip-14 hfs-18 iso-8 lha-6 lzh-6 lzma-16 ntfs-22 rar-3 rpm-10 split-9 squashfs-24 swm-15 tar-13 taz-5 tbz-2 tbz2-2 tgz-14 tpz-14 txz-23 vhd-20 wim-15 xar-19 xz-23 z-5 zip-1001-9 7z-0 arj-4 bz2-2 bzip2-2 cab-7 cpio-7 deb-11 dmg-17 gz-14 fat-21 gz-14 gzip-14 hfs-18 iso-8 lha-6 lzh-6 lzma-16 ntfs-22 rar-3 rpm-10 split-9 squashfs-24 swm-15 tar-13 taz-5 tbz-2 tbz2-2 tgz-14 tpz-14 txz-23 vhd-20 wim-15 xar-19 xz-23 z-5 zip-1 + +FOR %%j IN (%Extn%) DO ( + FOR /F "tokens=1,2 delims=-" %%A IN ("%%j") DO ( + REG ADD %SC%\.%%A /VE /D "7-Zip.%%A" /F + REG ADD %SC%\7-Zip.%%A /VE /D "%%A Archive" /F + REG ADD %SC%\7-Zip.%%A\DefaultIcon /VE /D "$InstallDir32$\7z.dll,%%B" /F + REG ADD %SC%\7-Zip.%%A\shell\open\command /VE /D "\"$InstallDir32$\7zFM.exe\" \"%%1\"" /F + ) +) + [Files_install_32] +copy "$IniCfgFile$" "$InstallDir32$" + ; Example of recursively copying some files into the installation directory: ; ; copy -s "%ScriptPath%\files\*.*" "$InstallDir32$" [Winbatch_install_64] -; Choose one of the following examples as basis for your installation -; You can use $LicenseKey$ var to pass a license key to the installer -; -; === MSI package ======================================================================================= -; You may use the parameter PIDKEY=$Licensekey$ -msiexec /i "Install64Msi" INSTALLDIR="$InstallDir64$" /l* "$LogDir$\$ProductId$.install_log.txt" /qb! ALLUSERS=2 REBOOT=ReallySuppress -"%ScriptPath%\associate.cmd" +msiexec /i "$Install64Msi$" /l* "$LogDir$\$ProductId$.install_log.txt" /qb! ALLUSERS=2 REBOOT=ReallySuppress + +[Dosbatch_install_64] +@echo off + +SET SC=HKLM\Software\Classes +SET Extn=001-9 7z-0 arj-4 bz2-2 bzip2-2 cab-7 cpio-7 deb-11 dmg-17 gz-14 fat-21 gz-14 gzip-14 hfs-18 iso-8 lha-6 lzh-6 lzma-16 ntfs-22 rar-3 rpm-10 split-9 squashfs-24 swm-15 tar-13 taz-5 tbz-2 tbz2-2 tgz-14 tpz-14 txz-23 vhd-20 wim-15 xar-19 xz-23 z-5 zip-1001-9 7z-0 arj-4 bz2-2 bzip2-2 cab-7 cpio-7 deb-11 dmg-17 gz-14 fat-21 gz-14 gzip-14 hfs-18 iso-8 lha-6 lzh-6 lzma-16 ntfs-22 rar-3 rpm-10 split-9 squashfs-24 swm-15 tar-13 taz-5 tbz-2 tbz2-2 tgz-14 tpz-14 txz-23 vhd-20 wim-15 xar-19 xz-23 z-5 zip-1 + +FOR %%j IN (%Extn%) DO ( + FOR /F "tokens=1,2 delims=-" %%A IN ("%%j") DO ( + REG ADD %SC%\.%%A /VE /D "7-Zip.%%A" /F + REG ADD %SC%\7-Zip.%%A /VE /D "%%A Archive" /F + REG ADD %SC%\7-Zip.%%A\DefaultIcon /VE /D "$InstallDir64$\7z.dll,%%B" /F + REG ADD %SC%\7-Zip.%%A\shell\open\command /VE /D "\"$InstallDir64$\7zFM.exe\" \"%%1\"" /F + ) +) [Files_install_64] +copy "$IniCfgFile$" "$InstallDir64$" + ; Example of recursively copying some files into the installation directory: ; ; copy -s "%ScriptPath%\files\*.*" "$InstallDir64$" @@ -164,43 +205,37 @@ msiexec /i "Install64Msi" INSTALLDIR="$InstallDir64$" /l* "$LogDir$\$ProductId$. ; end_link [Sub_get_licensekey] -if opsiLicenseManagementEnabled - comment "License management is enabled and will be used" +comment "License management is enabled and will be used" - comment "Trying to get a license key" - Set $LicenseKey$ = demandLicenseKey ($LicensePool$) - ; If there is an assignment of exactly one licensepool to the product the following call is possible: - ; Set $LicenseKey$ = demandLicenseKey ("", $ProductId$) - ; - ; If there is an assignment of a license pool to a windows software id, it is possible to use: - ; DefVar $WindowsSoftwareId$ - ; $WindowsSoftwareId$ = "..." - ; Set $LicenseKey$ = demandLicenseKey ("", "", $WindowsSoftwareId$) - - DefVar $ServiceErrorClass$ - set $ServiceErrorClass$ = getLastServiceErrorClass - comment "Error class: " + $ServiceErrorClass$ - - if $ServiceErrorClass$ = "None" - comment "Everything fine, we got the license key '" + $LicenseKey$ + "'" - else - if $ServiceErrorClass$ = "LicenseConfigurationError" - LogError "Fatal: license configuration must be corrected" - LogError getLastServiceErrorMessage +comment "Trying to get a license key" +Set $LicenseKey$ = demandLicenseKey ($LicensePool$) +; If there is an assignment of exactly one licensepool to the product the following call is possible: +; Set $LicenseKey$ = demandLicenseKey ("", $ProductId$) +; +; If there is an assignment of a license pool to a windows software id, it is possible to use: +; DefVar $WindowsSoftwareId$ +; $WindowsSoftwareId$ = "..." +; Set $LicenseKey$ = demandLicenseKey ("", "", $WindowsSoftwareId$) + +DefVar $ServiceErrorClass$ +set $ServiceErrorClass$ = getLastServiceErrorClass +comment "Error class: " + $ServiceErrorClass$ + +if $ServiceErrorClass$ = "None" + comment "Everything fine, we got the license key '" + $LicenseKey$ + "'" +else + if $ServiceErrorClass$ = "LicenseConfigurationError" + LogError "Fatal: license configuration must be corrected" + LogError getLastServiceErrorMessage + isFatalError + else + if $ServiceErrorClass$ = "LicenseMissingError" + LogError "Fatal: required license is not supplied" isFatalError - else - if $ServiceErrorClass$ = "LicenseMissingError" - LogError "Fatal: required license is not supplied" - isFatalError - endif endif endif -else - LogError "Fatal: license required, but license management not enabled" - isFatalError endif - [Sub_check_exitcode] comment "Test for installation success via exit code" set $ExitCode$ = getLastExitCode @@ -230,3 +265,4 @@ else endif endif + diff --git a/CLIENT_DATA/uninstall.ins b/CLIENT_DATA/uninstall3264.ins similarity index 55% rename from CLIENT_DATA/uninstall.ins rename to CLIENT_DATA/uninstall3264.ins index 89abe3d..ee9a1d5 100644 --- a/CLIENT_DATA/uninstall.ins +++ b/CLIENT_DATA/uninstall3264.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 $ExitCode$ DefVar $ProductId$ @@ -26,6 +31,16 @@ set $INST_architecture$ = GetProductProperty("install_architecture","system spec 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 - ; ---------------------------------------------------------------- @@ -42,9 +57,9 @@ ShowBitmap "%ScriptPath%\" + $ProductId$ + ".png" $ProductId$ Message "Uninstalling " + $ProductId$ + " ..." -if FileExists("%ScriptPath%\delsub.ins") +if FileExists("%ScriptPath%\delsub3264.ins") comment "Start uninstall sub section" - Sub "%ScriptPath%\delsub.ins" + Sub "%ScriptPath%\delsub3264.ins" endif if $LicenseRequired$ = "true" @@ -53,23 +68,17 @@ if $LicenseRequired$ = "true" endif [Sub_free_license] -if opsiLicenseManagementEnabled - comment "License management is enabled and will be used" - - comment "Trying to free license used for the product" - DefVar $result$ - Set $result$ = FreeLicense($LicensePool$) - ; If there is an assignment of a license pool to the product, it is possible to use - ; Set $result$ = FreeLicense("", $ProductId$) - ; - ; If there is an assignment of a license pool to a windows software id, it is possible to use - ; DefVar $WindowsSoftwareId$ - ; $WindowsSoftwareId$ = "..." - ; set $result$ = FreeLicense("", "", $WindowsSoftwareId$) -else - LogError "Error: licensing required, but license management not enabled" - isFatalError -endif +comment "License management is enabled and will be used" +comment "Trying to free license used for the product" +DefVar $result$ +Set $result$ = FreeLicense($LicensePool$) +; If there is an assignment of a license pool to the product, it is possible to use +; Set $result$ = FreeLicense("", $ProductId$) +; +; If there is an assignment of a license pool to a windows software id, it is possible to use +; DefVar $WindowsSoftwareId$ +; $WindowsSoftwareId$ = "..." +; set $result$ = FreeLicense("", "", $WindowsSoftwareId$) diff --git a/OPSI/control b/OPSI/control index 67fb7a1..f8b78ff 100644 --- a/OPSI/control +++ b/OPSI/control @@ -13,8 +13,8 @@ version: VERSION priority: PRIORITY licenseRequired: False productClasses: -setupScript: setup.ins -uninstallScript: uninstall.ins +setupScript: setup3264.ins +uninstallScript: uninstall3264.ins updateScript: alwaysScript: onceScript: diff --git a/builder-product.cfg b/builder-product.cfg index d5976a5..a873e84 100644 --- a/builder-product.cfg +++ b/builder-product.cfg @@ -16,10 +16,10 @@ TYPE="public" DL_FILE[0]="7zip-icon.png" DL_SOURCE[0]="http://icons.iconarchive.com/icons/benjigarner/softdimension/256/7zip-icon.png" -DL_FILE[1]="7z920.exe" -DL_SOURCE[1]="http://downloads.sourceforge.net/sevenzip/7z920.exe" +DL_FILE[1]="7z920.msi" +DL_SOURCE[1]="http://downloads.sourceforge.net/sevenzip/7z920.msi" DL_ARCH[1]="X86" -DL_WINST_NAME[1]=Install32Exe +DL_WINST_NAME[1]=Install32Msi DL_FILE[2]="7z920-x64.msi" DL_SOURCE[2]="http://downloads.sourceforge.net/sevenzip/7z920-x64.msi" @@ -29,3 +29,9 @@ DL_WINS_NAMET[2]=Install64Msi # File array index for the image showing while installing the program ICON_DL_INDEX=0 +WINST_NAME[0]="MsiId32" +WINST_VALUE[0]="{XXXXXXXX-XXXX-XXXX-XXXX-XXXXXXXXXXXX}" + +WINST_NAME[1]="MsiId64" +WINST_VALUE[1]="{XXXXXXXX-XXXX-XXXX-XXXX-XXXXXXXXXXXX}" +