From 37d4a857126e148622ae954bccccae0d0cf25e51 Mon Sep 17 00:00:00 2001 From: Mario Fetka Date: Fri, 8 Mar 2013 16:51:28 +0100 Subject: [PATCH] new 7zip scripts with the new opsi builder design --- CLIENT_DATA/delsub3264.ins | 80 ++++++++---------------------- CLIENT_DATA/setup3264.ins | 93 ++++++++++------------------------- CLIENT_DATA/uninstall3264.ins | 39 ++------------- OPSI/changelog.txt | 2 + OPSI/control | 16 +++--- 5 files changed, 60 insertions(+), 170 deletions(-) diff --git a/CLIENT_DATA/delsub3264.ins b/CLIENT_DATA/delsub3264.ins index c3f7f1d..6780aa8 100644 --- a/CLIENT_DATA/delsub3264.ins +++ b/CLIENT_DATA/delsub3264.ins @@ -1,33 +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/credits/ +; credits: http://www.opsi.org/en/credits/ -Set $UninstallProgram32$ = $InstallDir32$ + "\uninstall.exe" -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 - sub_check_exitcode - endif + 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 not (GetRegistryStringValue32("[HKEY_LOCAL_MACHINE\SOFTWARE\Microsoft\Windows\CurrentVersion\Uninstall\" + $MsiId32$ + "] DisplayName") = "") comment "MSI id " + $MsiId32$ + " found in registry, starting msiexec to uninstall" @@ -44,19 +35,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 - sub_check_exitcode - endif + 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 not (GetRegistryStringValue64("[HKEY_LOCAL_MACHINE\SOFTWARE\Microsoft\Windows\CurrentVersion\Uninstall\" + $MsiId64$ + "] DisplayName") = "") comment "MSI id " + $MsiId64$ + " found in registry, starting msiexec to uninstall" @@ -73,19 +59,6 @@ endif comment "Delete program shortcuts" LinkFolder_uninstall -[Winbatch_uninstall_32] -; Choose one of the following examples as basis for program uninstall -; -; === Nullsoft Scriptable Install System ================================================================ -; "$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 @@ -94,26 +67,13 @@ msiexec /x $MsiId32$ /qb! REBOOT=ReallySuppress ; ; delete -sf "$InstallDir32$\" -[Winbatch_uninstall_64] -; Choose one of the following examples as basis for program uninstall -; -; === Nullsoft Scriptable Install System ================================================================ -; "$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 [Files_uninstall_64] -; Example for recursively deleting the installation directory (don't forget the trailing backslash): +; Example for recursively deleting the installation directory: ; -; delete -sf "$InstallDir64$\" +; del -sf "$InstallDir64$\" [Registry_uninstall] ; Example of deleting a registry key: diff --git a/CLIENT_DATA/setup3264.ins b/CLIENT_DATA/setup3264.ins index ec9a545..ee377d6 100644 --- a/CLIENT_DATA/setup3264.ins +++ b/CLIENT_DATA/setup3264.ins @@ -1,18 +1,14 @@ ; Copyright (c) uib gmbh (www.uib.de) ; This sourcecode is owned by uib ; and published under the Terms of the General Public License. -; credits: http://www.opsi.org/credits/ +; credits: http://www.opsi.org/en/credits/ [Actions] -requiredWinstVersion >= "4.10.8.6" +requiredWinstVersion >= "4.11.2.6" -; DefVar $MsiId32$ DefVar $MsiIdOld32$ -DefVar $UninstallProgram32$ DefVar $IniFile32$ -; DefVar $MsiId64$ DefVar $MsiIdOld64$ -DefVar $UninstallProgram64$ DefVar $IniFile64$ DefVar $IniCfgFile$ DefVar $LogDir$ @@ -21,16 +17,12 @@ DefVar $MinimumSpace$ DefVar $InstallDir32$ DefVar $InstallDir64$ DefVar $ExitCode$ -DefVar $LicenseRequired$ -DefVar $LicenseKey$ -DefVar $LicensePool$ DefVar $INST_SystemType$ DefVar $INST_architecture$ Set $INST_SystemType$ = GetSystemType set $INST_architecture$ = GetProductProperty("install_architecture","system specific") - Set $LogDir$ = "%SystemDrive%\tmp" ; The token BUILDER_VARIABLES will be replaced by opsi-builder.sh @@ -49,39 +41,33 @@ Set $LogDir$ = "%SystemDrive%\tmp" ;$ProductId$ should be the name of the product in opsi ; therefore please: only lower letters, no umlauts, ; no white space use '-' as a seperator -Set $ProductId$ = "7zip.7zip" 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$ ; ---------------------------------------------------------------- +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 ; Stop process and set installation status to failed else comment "Show product picture" - ShowBitmap "%ScriptPath%\" + $ProductId$ + ".png" $ProductId$ + ShowBitmap "%ScriptPath%\" + $ProductId$ + ".png" $NAME$ + " " + $VERSION$ + "-" + $CREATOR_TAG$ + $RELEASE$ if FileExists("%ScriptPath%\delsub3264.ins") comment "Start uninstall sub section" Sub "%ScriptPath%\delsub3264.ins" endif - if $LicenseRequired$ = "true" - comment "Licensing required, reserve license and get license key" - Sub_get_licensekey - endif - comment "installing" if (($INST_SystemType$ = "x86 System") and ($INST_architecture$ = "system specific")) or ($INST_architecture$ = "both") or ($INST_architecture$ = "32 only") Message "Installing " + $ProductId$ + " 32 Bit..." comment "Start setup program" + ChangeDirectory "%SCRIPTPATH%" Winbatch_install_32 Sub_check_exitcode Dosbatch_install_32 @@ -97,6 +83,7 @@ else if ($INST_SystemType$ = "64 Bit System") and (($INST_architecture$ = "system specific") or ($INST_architecture$ = "both") or ($INST_architecture$ = "64 only")) Message "Installing " + $ProductId$ + " 64 Bit..." comment "Start setup program" + ChangeDirectory "%SCRIPTPATH%" Winbatch_install_64 Sub_check_exitcode Dosbatch_install_64 @@ -112,7 +99,7 @@ else endif [Winbatch_install_32] -msiexec /i "$Install32Msi$" /l* "$LogDir$\$ProductId$.install_log.txt" /qb! ALLUSERS=2 REBOOT=ReallySuppress +msiexec /i "$Install32Msi$" /l* "$LogDir$\$ProductId$.install_log.txt" /qb! ALLUSERS=1 REBOOT=ReallySuppress [Dosbatch_install_32] @echo off @@ -121,16 +108,16 @@ 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 - ) + 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 the ini file to the InstallDir copy "$IniCfgFile$" "$InstallDir32$" ; Example of recursively copying some files into the installation directory: @@ -138,7 +125,7 @@ copy "$IniCfgFile$" "$InstallDir32$" ; copy -s "%ScriptPath%\files\*.*" "$InstallDir32$" [Winbatch_install_64] -msiexec /i "$Install64Msi$" /l* "$LogDir$\$ProductId$.install_log.txt" /qb! ALLUSERS=2 REBOOT=ReallySuppress +msiexec /i "$Install64Msi$" /l* "$LogDir$\$ProductId$.install_log.txt" /qb! ALLUSERS=1 REBOOT=ReallySuppress [Dosbatch_install_64] @echo off @@ -147,15 +134,18 @@ 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 - ) + 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 the ini file to the InstallDir copy "$IniCfgFile$" "$InstallDir64$" ; Example of recursively copying some files into the installation directory: @@ -204,38 +194,6 @@ copy "$IniCfgFile$" "$InstallDir64$" ; icon_index: 2 ; end_link -[Sub_get_licensekey] -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 - isFatalError - else - if $ServiceErrorClass$ = "LicenseMissingError" - LogError "Fatal: required license is not supplied" - isFatalError - endif - endif -endif - [Sub_check_exitcode] comment "Test for installation success via exit code" set $ExitCode$ = getLastExitCode @@ -265,4 +223,3 @@ else endif endif - diff --git a/CLIENT_DATA/uninstall3264.ins b/CLIENT_DATA/uninstall3264.ins index ee9a1d5..098285b 100644 --- a/CLIENT_DATA/uninstall3264.ins +++ b/CLIENT_DATA/uninstall3264.ins @@ -1,18 +1,14 @@ ; 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/credits/ +; credits: http://www.opsi.org/en/credits/ [Actions] -requiredWinstVersion >= "4.10.8.6" +requiredWinstVersion >= "4.11.2.6" -; DefVar $MsiId32$ DefVar $MsiIdOld32$ -DefVar $UninstallProgram32$ DefVar $IniFile32$ -; DefVar $MsiId64$ DefVar $MsiIdOld64$ -DefVar $UninstallProgram64$ DefVar $IniFile64$ DefVar $IniCfgFile$ DefVar $LogDir$ @@ -20,15 +16,12 @@ DefVar $ExitCode$ DefVar $ProductId$ DefVar $InstallDir32$ DefVar $InstallDir64$ -DefVar $LicenseRequired$ -DefVar $LicensePool$ DefVar $INST_SystemType$ DefVar $INST_architecture$ Set $INST_SystemType$ = GetSystemType set $INST_architecture$ = GetProductProperty("install_architecture","system specific") - Set $LogDir$ = "%SystemDrive%\tmp" ; The token BUILDER_VARIABLES will be replaced by opsi-builder.sh @@ -44,13 +37,11 @@ Set $LogDir$ = "%SystemDrive%\tmp" ; ---------------------------------------------------------------- ; - Please edit the following values - ; ---------------------------------------------------------------- -Set $ProductId$ = "7zip.7zip" -Set $InstallDir32$ = "%ProgramFiles32Dir%\7-Zip" -Set $InstallDir64$ = "%ProgramFiles64Dir%\7-Zip" -Set $LicenseRequired$ = "false" -Set $LicensePool$ = "p_" + $ProductId$ +Set $InstallDir32$ = "%ProgramFiles32Dir%\7-Zip" +Set $InstallDir64$ = "%ProgramFiles64Dir%\7-Zip" ; ---------------------------------------------------------------- +Set $IniCfgFile$ = "%ScriptPath%\opsi-" + $ProductId$ + ".ini" comment "Show product picture" ShowBitmap "%ScriptPath%\" + $ProductId$ + ".png" $ProductId$ @@ -62,23 +53,3 @@ if FileExists("%ScriptPath%\delsub3264.ins") Sub "%ScriptPath%\delsub3264.ins" endif -if $LicenseRequired$ = "true" - comment "Licensing required, free license used" - Sub_free_license -endif - -[Sub_free_license] -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/changelog.txt b/OPSI/changelog.txt index e69de29..bc69317 100644 --- a/OPSI/changelog.txt +++ b/OPSI/changelog.txt @@ -0,0 +1,2 @@ +Don't add cahngelog entries here! +It get autogenerated by the opsi-builder.sh \ No newline at end of file diff --git a/OPSI/control b/OPSI/control index f8b78ff..b102995 100644 --- a/OPSI/control +++ b/OPSI/control @@ -1,16 +1,16 @@ [Package] -version: RELEASE +version: 2 depends: incremental: False [Product] type: localboot -id: 7zip.7zip -name: 7-Zip file archiver -description: 7-Zip is a file archiver with a high compression ratio. -advice: ADVICE -version: VERSION -priority: PRIORITY +id: opsi-template +name: opsi template product +description: A template for opsi products +advice: +version: 4.0.2 +priority: 0 licenseRequired: False productClasses: setupScript: setup3264.ins @@ -19,7 +19,7 @@ updateScript: alwaysScript: onceScript: customScript: -userLoginScript: +userLoginScript: [ProductProperty] type: unicode