Changes

7-Zip

10,588 bytes removed, 01:52, 11 September 2012
Remove redundant sections. Combine 32bit and 64bit into one package.
A free file compressor/extractor: [http://www.7-zip.org/ www.7-zip.org]
 
== MSI installer package.xml ==
 
=== Using GUID for Uninstall===
<source lang="xml">
<package id="7zip" name="7-Zip" revision="920" reboot="false" priority="0">  <check type="uninstall" condition="exists" path="7-Zip 9.20" />  <install cmd='msiexec /qn /norestart /i %SOFTWARE%\7zip\7z920.msi' />  <upgrade cmd='msiexec /qn /norestart /i %SOFTWARE%\7zip\7z920.msi' />  <remove cmd='msiexec /qn /x{23170F69-40C1-2701-0920-000001000000}' />  </package></source> === Using .msi for Uninstall=== Alternatively to the use of the GUID you might use the MSI file for uninstall as well. This method has the advantage that since a new GUID string is used for each release, you need to search for the right ID at each release; using the MSI file obsoletes this step. However, with this approach you need to remember to leave older version(s) of the installer on your server. <source lang="xml"> <package id='7zip' name='7-ZipPacker' revision='465920' priority='500' reboot='false' >  <check type='uninstalllogical' condition='existsor' path='7-Zip 4.65' / <install cmd='msiexec /i "%SOFTWARE%\7zip\7z465.msi" /qn' />  <upgrade cmd='msiexec /i "%SOFTWARE%\7zip\7z465.msi" /qn' />  <remove cmd='msiexec /x "%SOFTWARE%\7zip\7z465.msi" /qn' />  </package></source> == MSI installer package.xml for use with existing older exe based installs=='''Background''' The hosts on my network are a mix of 7-Zip (various versions) .exe and .msi based installs. If you do a .msi based install without first uninstalling the .exe version it will leave some files from the .exe based install intact as well as an entry in "Add/Remove Programs". Use this if you have existing .exe based installs of 7-Zip (such as 4.20) and you would like to uninstall them before switching to an .msi based install.  <source lang="xml"> <package id="7zip" name="7-Zip" revision="465" reboot="false" priority="0">  <check type="'uninstall" ' condition="'exists" ' path="7-Zip 4.65" />  <install cmd='%comspec% /c if exist "%PROGRAMFILES%\7-Zip\Uninstall9.exe" "%PROGRAMFILES%\7-Zip\Uninstall.exe" /S20' /> <install cmd='msiexec /qn /norestart /i %SOFTWARE%\7zip\7z465.msi' />  <upgrade cmd='%comspec% /c if exist "%PROGRAMFILES%\7-Zip\Uninstall.exe" "%PROGRAMFILES%\7-Zip\Uninstall.exe" /S' /> <upgrade cmd='msiexec /qn /norestart /i %SOFTWARE%\7zip\7z465.msi' />  <remove cmd='msiexec /qn /norestart /x %SOFTWARE%\7zip\7z465.msi' /> </package></source> == MSI installer for use with existing older exe based installs with mixed 32-bit/64-bit hosts== On a 64-bit host, the 64-bit version is more useful, because the 32-bit version of 7-Zip doesn't integrate in the Windows Explorer. '''Warning''': The approach demonstrated below which checks the value of "PROCESSOR_ARCHITECTURE" in the registry is flawed for several reasons:* When you remove the package, 7zip-x64 will never be detected as being successfully removed on 32bit systems (and vice versa), because the check on "PROCESSOR_ARCHITECTURE" will always return true.* When you upgrade the package and increase the revision number, WPKG will detect this and try to execute the upgrade commands even if the check statements return true! However on a 32bit host the upgrade commands of 7zip-x64 will of course always fail, as will the upgrade commands of 7zip on a 64bit host.* "''So please remember that checks are NOT there to check if a package applies to the system if the checks are true. Checks are there to verify that a package is installed properly and WPKG will run the commands over and over again until checks become true. In case of your checks they will never become true since the package will for sure not change the PROCESSOR_ARCHITECTURE or CurrentVersion value.''" (WPKG author Rainer Meier - [http://lists.wpkg.org/pipermail/wpkg-users/2010-January/006210.html wpkg-users]) A better approach is to either A) put both packages "7zip" and "7zip-x64" in your package database without the checks on PROCESSOR_ARCHITECTURE and assign "7zip" only to 32bit hosts and "7zip-x64" only to 64bit hosts, orB) create only one package that contains both the 32bit and 64bit installers of 7-Zip, and write a custom installer script that checks the operating system and installs the correct version of 7-Zip. <source lang="xml"><?xml version="1.0" encoding="UTF-8"?> <packages> <package id='7zip' name='7-Zip Packer' revision='465' priority='50' reboot='false' > <check type="logical" condition="or"> <check type="registry" condition="equals" path="HKEY_LOCAL_MACHINE\SYSTEM\CurrentControlSet\Control\Session Manager\Environment\PROCESSOR_ARCHITECTURE" value="AMD64" /> <check type='uninstall' condition='exists' path='7-Zip 49.6520 (x64 edition)' /> </check>  <!-- First Uninstall the .exe --> <install cmd='%comspec% /c if exist "%PROGRAMFILES%\7-Zip\Uninstall.exe" "%PROGRAMFILES%\7-Zip\Uninstall.exe" /S' /> <install cmd='msiexec /i "%SOFTWARE%\7zip\7z465.msi" /qn /norestart' />  <!-- If you do a .msi based install without first uninstalling the .exe
version it will leave some files from the .exe based install intact
as well as an entry in "Add/Remove Programs". -->
<install cmd='%comspec% /c if exist "%PROGRAMFILES%\7-Zip\Uninstall.exe" "%PROGRAMFILES%\7-Zip\Uninstall.exe" /S' /> <install cmd='msiexec /i "%SOFTWARE%\7zip\7z920.msi" /qn' architecture='x86' /> <install cmd='msiexec /i "%SOFTWARE%\7zip\7z920-x64.msi" /qn' architecture='x64' /> <install cmd='"%SOFTWARE%\7zip\7zext.bat">nul'><exit code="any"/></install> <upgrade cmd='%comspec% /c if exist "%PROGRAMFILES%\7-Zip\Uninstall.exe" "%PROGRAMFILES%\7-Zip\Uninstall.exe" /S' /> <upgrade cmd='msiexec /i "%SOFTWARE%\7zip\7z4657z920.msi" /qn ' architecture='x86' /norestart> <upgrade cmd=' msiexec /i "%SOFTWARE%\7zip\7z920-x64.msi" /qn' architecture='x64' /> <upgrade cmd='"%SOFTWARE%\7zip\7zext.bat">nul'><exit code="any"/></upgrade> <remove cmd='msiexec /x "%SOFTWARE%\7zip\7z920.msi" /qn' architecture='x86' /> <remove cmd='msiexec /x "%SOFTWARE%\7zip\7z920-x64.msi" /qn' architecture='x64' /> </package>
</package>
 
<package
id='7zip-64'
name='7-Zip 4.65 (x64 edition)'
revision='465'
priority='50'
reboot='false'
>
<check type="logical" condition="or">
<check
type="registry"
condition="equals"
path="HKEY_LOCAL_MACHINE\SYSTEM\CurrentControlSet\Control\Session Manager\Environment\PROCESSOR_ARCHITECTURE"
value="x86"
/>
<check
type='uninstall'
condition='exists'
path='7-Zip 4.65 (x64 edition)'
/>
</check>
 
<!-- First Uninstall the .exe -->
<install cmd='%comspec% /c if exist "%PROGRAMFILES%\7-Zip\Uninstall.exe" "%PROGRAMFILES%\7-Zip\Uninstall.exe" /S' />
<install cmd='msiexec /i "%SOFTWARE%\7zip\7z465-x64.msi" /qn /norestart' />
 
<!-- If you do a .msi based install without first uninstalling the .exe
version it will leave some files from the .exe based install intact
as well as an entry in "Add/Remove Programs". -->
<upgrade cmd='%comspec% /c if exist "%PROGRAMFILES%\7-Zip\Uninstall.exe" "%PROGRAMFILES%\7-Zip\Uninstall.exe" /S' />
<upgrade cmd='msiexec /i "%SOFTWARE%\7zip\7z465-x64.msi" /qn /norestart' />
 
</package>
 
 
</packages>
</source>
== EXE installer package.xml == <source lang="xml"> <package id="7zip" name="7-Zip" revision="464" reboot="false" priority="0">  <check type="file" condition="exists" path="%PROGRAMFILES%\7-Zip\7zFM.exe" />  <install cmd='%SOFTWARE%\7zip\7z464.exe /S'> <exit code="0" /> </install>  <remove cmd='"%PROGRAMFILES%\7-Zip\Uninstall.exe" /S'> <exit code="0"/> </remove>  </package></source> == MSI Installer package.xmlFile Associations, sets 7-zip as default archive application == In meantime, while 7-zip author considers installer switches for via batch file associations, you can use registry files to do it yourself. <source lang="xml"><packages> <package id="7zip" name="7-Zip" revision="465" priority="0" reboot="false"> <check type="uninstall" condition="exists" path="7-Zip 4.65"/>  <install cmd="msiexec /qn /norestart /i %SOFTWARE%\7zip\7z465.msi"/> <install cmd="regedit /s %SETTINGS%\7zip.reg"/>  <upgrade cmd="msiexec /qn /norestart /i %SOFTWARE%\7zip\7z465.msi"/> <upgrade cmd="regedit /s %SETTINGS%\7zip.reg"/>  <remove cmd="msiexec /qn /x{23170F69-40C1-2701-0465-000001000000}"/> </package></packages></source> You can use a batch-script (tested for Version 9.20), to add the extension. Feel free to add further extensions to 7-Zip Shortly explained what the script is doing:  * This batch grabs the extension from the with space delimited extension list (EXTN=001-9 ... zip-1) * <extension>-<standard-icon in 7z.dll> means that the first part is the name of the extension. The second part is the icon, which is stored within the 7z.dll. * This data will be used to automatically add the desired values to the registry. ATTENTION: Please install 7-Zip x86 for x86 systems only and not on x64 Systems. Otherwise you have to check prior, which programfiles folder to use. (see batch script below %PROGRAMFILES% / %PROGRAMFILES(x86)%)
<source lang="dos">
REM This is 7zext.bat
@echo off
</source>
Alternative What the script is doing:  * This batch grabs the extension from the space delimited extension list (EXTN=001-9 ... zip-1) * <extension>-<standard-icon in 7z.dll> means that the first part is the name of the extension. The second part is the icon, which is stored within the 7z.dll. * This data will be used to automatically add the desired values to the registry. === File Associations, via registry === <source lang="xml"> <install cmd="regedit /s %SETTINGS%\7zip.reg file:"/></source>
The .reg file:
<source lang="reg">
Windows Registry Editor Version 5.00
</source>
== MSI installer package.xml for 7-zip x64 ==
 
For the 64 bit version of 7-Zip you just have to change the check-flag. This is the method, which sets 7-Zip as default application for archives.
 
<source lang="xml">
<package id="7zip-x64"
name="7-Zip x64"
revision="465"
reboot="false"
priority="0">
<check type="uninstall" condition="exists" path="7-Zip 4.65 (x64 edition)" />
<install cmd='msiexec /qn /norestart /i %SOFTWARE%\7zip\7z465-x64.msi' />
<install cmd="regedit /s %SETTINGS%\7zip.reg"/>
<upgrade cmd='msiexec /qn /norestart /i %SOFTWARE%\7zip\7z465-x64.msi' />
<upgrade cmd="regedit /s %SETTINGS%\7zip.reg"/>
<remove cmd='msiexec /x "%SOFTWARE%\7zip\7z465-x64.msi" /qn' />
</package>
</source>
 
== 7-Zip EXE installer options ==
 
"Use the "/S" parameter to do a silent installation and the "/D=dir" parameter to specify the "output directory". These options are case-sensitive. 7-Zip uses the NSIS installer by Nullsoft." - http://www.7-zip.org/faq.html
 
== 7-ZIP 9.10 (beta) MSI installer for 32bit and 64bit hosts ==
 
<source lang="xml">
<?xml version="1.0" encoding="utf-8" ?>
<packages>
<package
id='7zip'
name='7-Zip 9.10'
revision='910'
priority='50'
reboot='false'
>
 
<check type="logical" condition="or">
<check
type="registry"
condition="equals"
path="HKEY_LOCAL_MACHINE\SYSTEM\CurrentControlSet\Control\Session Manager\Environment\PROCESSOR_ARCHITECTURE"
value="AMD64"
/>
<check
type='uninstall'
condition='exists'
path='7-Zip 9.10'
/>
</check>
 
<!-- First Uninstall the .exe -->
<install cmd='%comspec% /c if exist "%PROGRAMFILES%\7-Zip\Uninstall.exe" "%PROGRAMFILES%\7-Zip\Uninstall.exe" /S' />
<install cmd='msiexec /i "%SOFTWARE%\7zip\7z910.msi" /qn /norestart' />
 
<!-- If you do a .msi based install without first uninstalling the .exe
version it will leave some files from the .exe based install intact
as well as an entry in "Add/Remove Programs". -->
<upgrade cmd='%comspec% /c if exist "%PROGRAMFILES%\7-Zip\Uninstall.exe" "%PROGRAMFILES%\7-Zip\Uninstall.exe" /S' />
<upgrade cmd='msiexec /i "%SOFTWARE%\7zip\7z910.msi" /qn /norestart' />
<remove cmd='msiexec /x "%SOFTWARE%\7zip\7z910.msi" /qn' />
</package>
 
<package
id='7zip-64'
name='7-Zip 9.10 (x64 edition)'
revision='910'
priority='50'
reboot='false'
>
<check type="logical" condition="or">
<check
type="registry"
condition="equals"
path="HKEY_LOCAL_MACHINE\SYSTEM\CurrentControlSet\Control\Session Manager\Environment\PROCESSOR_ARCHITECTURE"
value="x86"
/>
<check
type='uninstall'
condition='exists'
path='7-Zip 9.10 (x64 edition)'
/>
</check>
<!-- First Uninstall the .exe -->
<install cmd='%comspec% /c if exist "%PROGRAMFILES(x86)%\7-Zip\Uninstall.exe" "%PROGRAMFILES%(x86)\7-Zip\Uninstall.exe" /S' />
<install cmd='msiexec /i "%SOFTWARE%\7zip\7z910-x64.msi" /qn /norestart' />
<!-- If you do a .msi based install without first uninstalling the .exe
version it will leave some files from the .exe based install intact
as well as an entry in "Add/Remove Programs". -->
<upgrade cmd='%comspec% /c if exist "%PROGRAMFILES(x86)%\7-Zip\Uninstall.exe" "%PROGRAMFILES%(x86)\7-Zip\Uninstall.exe" /S' />
<upgrade cmd='msiexec /i "%SOFTWARE%\7zip\7z910-x64.msi" /qn /norestart' />
<remove cmd='msiexec /x "%SOFTWARE%\7zip\7z910-x64.msi" /qn' />
</package>
 
</packages>
</source>
== Links ==
[[category:Silent Installers]]
[[Category:NSIS]]
117
edits