diff --git a/.gitignore b/.gitignore index c420e03..d016fa4 100644 --- a/.gitignore +++ b/.gitignore @@ -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/ diff --git a/Makefile b/Makefile index 4f03493..2857fb6 100644 --- a/Makefile +++ b/Makefile @@ -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 diff --git a/README.md b/README.md index 7927a4f..ea29d8a 100644 --- a/README.md +++ b/README.md @@ -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)). diff --git a/VERSION b/VERSION new file mode 100644 index 0000000..9325c3c --- /dev/null +++ b/VERSION @@ -0,0 +1 @@ +0.3.0 \ No newline at end of file diff --git a/package-chocolatey/packer-provisioner-windows-update.nuspec b/package-chocolatey/packer-provisioner-windows-update.nuspec new file mode 100644 index 0000000..b3abadb --- /dev/null +++ b/package-chocolatey/packer-provisioner-windows-update.nuspec @@ -0,0 +1,22 @@ + + + + packer-provisioner-windows-update + @@VERSION@@ + Packer Windows Update Provisioner + Rui Lopes + Rui Lopes + https://github.com/rgl/packer-provisioner-windows-update/blob/master/LICENSE.txt + https://github.com/rgl/packer-provisioner-windows-update + https://github.com/rgl/packer-provisioner-windows-update + https://github.com/rgl/packer-provisioner-windows-update + https://github.com/rgl/packer-provisioner-windows-update/issues + false + A Packer plugin for installing Windows updates. + A Packer plugin for installing Windows updates. + packer windows-update + + + + + \ No newline at end of file diff --git a/package-chocolatey/tools/chocolateyInstall.ps1 b/package-chocolatey/tools/chocolateyInstall.ps1 new file mode 100644 index 0000000..997711c --- /dev/null +++ b/package-chocolatey/tools/chocolateyInstall.ps1 @@ -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' diff --git a/package-chocolatey/tools/chocolateyUninstall.ps1 b/package-chocolatey/tools/chocolateyUninstall.ps1 new file mode 100644 index 0000000..793099c --- /dev/null +++ b/package-chocolatey/tools/chocolateyUninstall.ps1 @@ -0,0 +1,5 @@ +$pluginExe = "$env:APPDATA\packer.d\plugins\packer-provisioner-windows-update.exe" + +if (Test-Path $pluginExe) { + Remove-Item $pluginExe +}