Difference between revisions of "Chocolatey"
From WPKG | Open Source Software Deployment and Distribution
Line 4: | Line 4: | ||
Once this is installed, you can use commands like "choco install 7zip -y" to install software automatically. This can be useful to save having to update WPKG packages for common tools, as chocolatey has a central repository. | Once this is installed, you can use commands like "choco install 7zip -y" to install software automatically. This can be useful to save having to update WPKG packages for common tools, as chocolatey has a central repository. | ||
+ | |||
+ | An example of how VLC might be installed using WPKG to trigger chocolatey is given below. | ||
<source lang="xml"> | <source lang="xml"> | ||
Line 35: | Line 37: | ||
<install cmd='powershell "%SOFTWARE%\%installerPath%"' /> | <install cmd='powershell "%SOFTWARE%\%installerPath%"' /> | ||
− | |||
− | |||
− | |||
− | |||
<upgrade include="install" /> | <upgrade include="install" /> | ||
− | |||
<remove cmd='cmd /c rmdir /s /q "%programdata%\chocolatey\"' /> | <remove cmd='cmd /c rmdir /s /q "%programdata%\chocolatey\"' /> | ||
− | </package> | + | </package> |
+ | <package | ||
+ | id="vlc" | ||
+ | name="VideoLAN Client (using Chocolatey)" | ||
+ | revision="1.%version%" | ||
+ | reboot="false" | ||
+ | priority="1"> | ||
+ | |||
+ | <depends package-id="chocolatey" /> | ||
+ | |||
+ | <variable name="version" value="2.2.6" /> | ||
+ | <variable name="PKGNAME" value="vlc" /> | ||
+ | |||
+ | <check type='uninstall' condition='versiongreaterorequal' path='VLC media player' value='%version%' /> | ||
+ | |||
+ | <install cmd='%COMSPEC% /c choco install %PKGNAME% -y' /> | ||
+ | <upgrade cmd='%COMSPEC% /c choco upgrade %PKGNAME% -y' /> | ||
+ | <remove cmd='%COMSPEC% /c choco uninstall %PKGNAME% -y'/> | ||
+ | |||
+ | <!-- | ||
+ | <install cmd='%COMSPEC% /c %programdata%\chocolatey\bin\chocolatey.exe install %PKGNAME% -y - -forceX86 - -force' architecture="x64" /> | ||
+ | --> | ||
+ | <!-- | ||
+ | Can be useful to pipe chocolatey output to log file: e.g. >c:\temp\choc.log | ||
+ | or see C:\ProgramData\chocolatey\logs\chocolatey.log | ||
+ | --> | ||
+ | |||
+ | </package> | ||
+ | |||
</packages:packages> | </packages:packages> | ||
</source> | </source> | ||
[[Category:Silent Installers]] | [[Category:Silent Installers]] |
Revision as of 18:21, 9 October 2017
A silent installer for Chocolately (https://chocolatey.org), which in turn does silent Windows software installs.
This downloads the install.ps1 script, which will download and install chocolatey to %programdata%\chocolatey.
Once this is installed, you can use commands like "choco install 7zip -y" to install software automatically. This can be useful to save having to update WPKG packages for common tools, as chocolatey has a central repository.
An example of how VLC might be installed using WPKG to trigger chocolatey is given below.
<?xml version="1.0" encoding="UTF-8"?>
<packages:packages xmlns:packages="http://www.wpkg.org/packages"
xmlns:wpkg="http://www.wpkg.org/wpkg" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
xsi:schemaLocation="http://www.wpkg.org/packages ../xsd/packages.xsd">
<package
id="chocolatey"
name="Chocolatey"
revision="1.%version%"
reboot="false"
priority="1">
<variable name="version" value="0.10.5.0" />
<check type="file" condition="exists" path='%programdata%\chocolatey\bin\chocolatey.exe' value="%version%" />
<variable name="installerPath" value="chocolatey\install.ps1"/>
<variable name="installerURL" value="https://chocolatey.org/install.ps1" />
<!-- standard variables - usually in config.xml -->
<variable name="SOFTWARE" value="software" />
<variable name="DOWNLOADERPATH" value="tools\downloader\downloader.cmd" />
<!-- conditional download -->
<install cmd='"%DOWNLOADERPATH%" "%installerURL%" "%software%\%installerPath%" >NUL'>
<condition><check type="logical" condition="not"><check type="file" condition="exists" path="%SOFTWARE%\%installerPath%" /></check></condition>
</install>
<install cmd='powershell "%SOFTWARE%\%installerPath%"' />
<upgrade include="install" />
<remove cmd='cmd /c rmdir /s /q "%programdata%\chocolatey\"' />
</package>
<package
id="vlc"
name="VideoLAN Client (using Chocolatey)"
revision="1.%version%"
reboot="false"
priority="1">
<depends package-id="chocolatey" />
<variable name="version" value="2.2.6" />
<variable name="PKGNAME" value="vlc" />
<check type='uninstall' condition='versiongreaterorequal' path='VLC media player' value='%version%' />
<install cmd='%COMSPEC% /c choco install %PKGNAME% -y' />
<upgrade cmd='%COMSPEC% /c choco upgrade %PKGNAME% -y' />
<remove cmd='%COMSPEC% /c choco uninstall %PKGNAME% -y'/>
<!--
<install cmd='%COMSPEC% /c %programdata%\chocolatey\bin\chocolatey.exe install %PKGNAME% -y - -forceX86 - -force' architecture="x64" />
-->
<!--
Can be useful to pipe chocolatey output to log file: e.g. >c:\temp\choc.log
or see C:\ProgramData\chocolatey\logs\chocolatey.log
-->
</package>
</packages:packages>