Skip to content

Commit

Permalink
add chocolatey package
Browse files Browse the repository at this point in the history
  • Loading branch information
rgl committed Jul 22, 2017
1 parent 463c46a commit 87f0023
Show file tree
Hide file tree
Showing 7 changed files with 57 additions and 4 deletions.
6 changes: 5 additions & 1 deletion .gitignore
Original file line number Diff line number Diff line change
@@ -1,3 +1,7 @@
packer-provisioner-windows-update*
packer-provisioner-windows-update
packer-provisioner-windows-update.exe
packer-provisioner-windows-update-*.tgz
packer-provisioner-windows-update-*.zip
tmp*
bindata.go
.idea/
19 changes: 16 additions & 3 deletions Makefile
Original file line number Diff line number Diff line change
Expand Up @@ -9,11 +9,24 @@ packer-provisioner-windows-update.exe: *.go update/* update/bindata.go
update/bindata.go: update/*.ps1
go-bindata -nocompress -ignore '\.go$$' -o $@ -prefix update -pkg update update

dist: build
dist: package-chocolatey

package: build
tar -czf packer-provisioner-windows-update-linux.tgz packer-provisioner-windows-update
zip packer-provisioner-windows-update-windows.zip packer-provisioner-windows-update.exe

package-chocolatey: package
rm -rf tmp-package-chocolatey
cp -R package-chocolatey tmp-package-chocolatey
sed -i -E " \
s,@@VERSION@@,$(shell cat VERSION),g; \
s,@@CHECKSUM@@,$(shell sha256sum packer-provisioner-windows-update-windows.zip | awk '{print $$1}'),g; \
" \
tmp-package-chocolatey/*.nuspec \
tmp-package-chocolatey/tools/*.ps1
choco pack tmp-package-chocolatey/*.nuspec

clean:
rm -f packer-provisioner-windows-update* update/bindata.go
rm -f packer-provisioner-windows-update* tmp* update/bindata.go

.PHONY: build dist clean
.PHONY: build dist package package-chocolatey clean
2 changes: 2 additions & 0 deletions README.md
Original file line number Diff line number Diff line change
@@ -1,6 +1,8 @@
# Packer Windows Update Provisioner

[![Build status](https://ci.appveyor.com/api/projects/status/1bmqt9ywh82vhojt?svg=true)](https://ci.appveyor.com/project/rgl/packer-provisioner-windows-update)
[![Latest version released](https://img.shields.io/chocolatey/v/packer-provisioner-windows-update.svg)](https://chocolatey.org/packages/packer-provisioner-windows-update)
[![Package downloads count](https://img.shields.io/chocolatey/dt/packer-provisioner-windows-update.svg)](https://chocolatey.org/packages/packer-provisioner-windows-update)

This is a Packer plugin for installing Windows updates (akin to [rgl/vagrant-windows-update](https://github.com/rgl/vagrant-windows-update)).

Expand Down
1 change: 1 addition & 0 deletions VERSION
Original file line number Diff line number Diff line change
@@ -0,0 +1 @@
0.3.0
22 changes: 22 additions & 0 deletions package-chocolatey/packer-provisioner-windows-update.nuspec
Original file line number Diff line number Diff line change
@@ -0,0 +1,22 @@
<?xml version="1.0"?>
<package xmlns="http://schemas.microsoft.com/packaging/2010/07/nuspec.xsd">
<metadata>
<id>packer-provisioner-windows-update</id>
<version>@@VERSION@@</version>
<title>Packer Windows Update Provisioner</title>
<authors>Rui Lopes</authors>
<owners>Rui Lopes</owners>
<licenseUrl>https://github.com/rgl/packer-provisioner-windows-update/blob/master/LICENSE.txt</licenseUrl>
<packageSourceUrl>https://github.com/rgl/packer-provisioner-windows-update</packageSourceUrl>
<projectUrl>https://github.com/rgl/packer-provisioner-windows-update</projectUrl>
<projectSourceUrl>https://github.com/rgl/packer-provisioner-windows-update</projectSourceUrl>
<bugTrackerUrl>https://github.com/rgl/packer-provisioner-windows-update/issues</bugTrackerUrl>
<requireLicenseAcceptance>false</requireLicenseAcceptance>
<description>A Packer plugin for installing Windows updates.</description>
<summary>A Packer plugin for installing Windows updates.</summary>
<tags>packer windows-update</tags>
</metadata>
<files>
<file src="tools\*" target="tools" />
</files>
</package>
6 changes: 6 additions & 0 deletions package-chocolatey/tools/chocolateyInstall.ps1
Original file line number Diff line number Diff line change
@@ -0,0 +1,6 @@
Install-ChocolateyZipPackage `
'packer-provisioner-windows-update' `
'https://github.com/rgl/packer-provisioner-windows-update/releases/download/v@@VERSION@@/packer-provisioner-windows-update-windows.zip' `
"$env:APPDATA\packer.d\plugins" `
-Checksum '@@CHECKSUM@@' `
-ChecksumType 'sha256'
5 changes: 5 additions & 0 deletions package-chocolatey/tools/chocolateyUninstall.ps1
Original file line number Diff line number Diff line change
@@ -0,0 +1,5 @@
$pluginExe = "$env:APPDATA\packer.d\plugins\packer-provisioner-windows-update.exe"

if (Test-Path $pluginExe) {
Remove-Item $pluginExe
}

0 comments on commit 87f0023

Please sign in to comment.