From a13c90ed26719438728df87371d8646357d766aa Mon Sep 17 00:00:00 2001 From: requilence Date: Tue, 30 Oct 2018 12:27:54 +0200 Subject: [PATCH 1/2] Fix MSI upgrage and uninstall flow --- README.md | 11 +++--- pkg-scripts/msi-templates/FolderUninstall.wxs | 23 +++++++++++ pkg-scripts/msi-templates/WixUI_HK.wxs | 8 +++- pkg-scripts/msi-templates/choco/LICENSE.txt | 9 ----- .../msi-templates/choco/VERIFICATION.txt | 10 ----- .../msi-templates/choco/chocolateyInstall.ps1 | 7 ---- .../choco/chocolateyUninstall.ps1 | 6 --- pkg-scripts/msi-templates/choco/pkg.nuspec | 38 ------------------- pkg-scripts/msi-templates/product.wxs | 24 +++++++----- 9 files changed, 50 insertions(+), 86 deletions(-) create mode 100644 pkg-scripts/msi-templates/FolderUninstall.wxs delete mode 100644 pkg-scripts/msi-templates/choco/LICENSE.txt delete mode 100644 pkg-scripts/msi-templates/choco/VERIFICATION.txt delete mode 100644 pkg-scripts/msi-templates/choco/chocolateyInstall.ps1 delete mode 100644 pkg-scripts/msi-templates/choco/chocolateyUninstall.ps1 delete mode 100644 pkg-scripts/msi-templates/choco/pkg.nuspec diff --git a/README.md b/README.md index 245ff9c..d24e0a3 100644 --- a/README.md +++ b/README.md @@ -31,8 +31,9 @@ goreleaser --snapshot ``` ## Build MSI package -– Should be done on Windows machine -– Open command prompt(cmd.exe) -– Go to cagent directory `cd path_to_directory` -– Run `goreleaser --snapshot` to build binaries -– Run `build-win.bat` \ No newline at end of file +Should be done on Windows machine +- [Download go-msi](https://github.com/cloudradar-monitoring/go-msi/releases) and put it in the `C:\Program Files\go-msi` +- Open command prompt(cmd.exe or powershell) +- Go to cagent directory `cd path_to_directory` +- Run `goreleaser --snapshot` to build binaries +- Run `build-win.bat` \ No newline at end of file diff --git a/pkg-scripts/msi-templates/FolderUninstall.wxs b/pkg-scripts/msi-templates/FolderUninstall.wxs new file mode 100644 index 0000000..b036b3b --- /dev/null +++ b/pkg-scripts/msi-templates/FolderUninstall.wxs @@ -0,0 +1,23 @@ + + + + + + + + + + + + + + + + + + + + + \ No newline at end of file diff --git a/pkg-scripts/msi-templates/WixUI_HK.wxs b/pkg-scripts/msi-templates/WixUI_HK.wxs index 7e264ec..08c5aeb 100644 --- a/pkg-scripts/msi-templates/WixUI_HK.wxs +++ b/pkg-scripts/msi-templates/WixUI_HK.wxs @@ -46,15 +46,19 @@ 1 NOT WIXUI_DONTVALIDATEPATH "1"]]> - WIXUI_DONTVALIDATEPATH OR WIXUI_INSTALLDIR_VALID="1" + + OLDERVERSIONBEINGUPGRADED AND WIXUI_INSTALLDIR_VALID="1" + NOT OLDERVERSIONBEINGUPGRADED AND WIXUI_INSTALLDIR_VALID="1" 1 1 1 1 - Installed + OLDERVERSIONBEINGUPGRADED AND WIXUI_INSTALLDIR_VALID="1" + NOT OLDERVERSIONBEINGUPGRADED AND WIXUI_INSTALLDIR_VALID="1" + 1 diff --git a/pkg-scripts/msi-templates/choco/LICENSE.txt b/pkg-scripts/msi-templates/choco/LICENSE.txt deleted file mode 100644 index e0cd646..0000000 --- a/pkg-scripts/msi-templates/choco/LICENSE.txt +++ /dev/null @@ -1,9 +0,0 @@ -From: {{.Choco.LicenseURL}} - -LICENSE - -{{if gt (.License | len) 0}} -{{.License | cat}} -{{else if gt (.Choco.LicenseURL | len) 0}} -{{.Choco.LicenseURL | download}} -{{end}} diff --git a/pkg-scripts/msi-templates/choco/VERIFICATION.txt b/pkg-scripts/msi-templates/choco/VERIFICATION.txt deleted file mode 100644 index 1610954..0000000 --- a/pkg-scripts/msi-templates/choco/VERIFICATION.txt +++ /dev/null @@ -1,10 +0,0 @@ -VERIFICATION - -To check the checksum of this package, extract the msi file contained into it, -then run - - checksum.exe {{.Choco.MsiFile}} -t=sha256 - -The result must match - - {{.Choco.MsiSum | upper}} diff --git a/pkg-scripts/msi-templates/choco/chocolateyInstall.ps1 b/pkg-scripts/msi-templates/choco/chocolateyInstall.ps1 deleted file mode 100644 index f3cb7ae..0000000 --- a/pkg-scripts/msi-templates/choco/chocolateyInstall.ps1 +++ /dev/null @@ -1,7 +0,0 @@ -$packageName = '{{.Choco.ID}}' -$fileType = 'msi' -$silentArgs = '/quiet'; -$scriptPath = $(Split-Path $MyInvocation.MyCommand.Path); -$fileFullPath = Join-Path $scriptPath '{{.Choco.MsiFile}}'; - -Install-ChocolateyInstallPackage $packageName $fileType $silentArgs $fileFullPath -checksum '{{.Choco.MsiSum}}' -checksumType = 'sha256' diff --git a/pkg-scripts/msi-templates/choco/chocolateyUninstall.ps1 b/pkg-scripts/msi-templates/choco/chocolateyUninstall.ps1 deleted file mode 100644 index 367c85b..0000000 --- a/pkg-scripts/msi-templates/choco/chocolateyUninstall.ps1 +++ /dev/null @@ -1,6 +0,0 @@ -$packageName = "{{.Choco.ID}}"; -$fileType = 'msi'; -$scriptPath = $(Split-Path $MyInvocation.MyCommand.Path); -$fileFullPath = Join-Path $scriptPath '{{.Choco.MsiFile}}'; - -Uninstall-ChocolateyPackage $packageName $fileType "$fileFullPath /q" diff --git a/pkg-scripts/msi-templates/choco/pkg.nuspec b/pkg-scripts/msi-templates/choco/pkg.nuspec deleted file mode 100644 index c2e7d5b..0000000 --- a/pkg-scripts/msi-templates/choco/pkg.nuspec +++ /dev/null @@ -1,38 +0,0 @@ - - - - {{.Choco.ID}} - {{.Choco.Title}} - {{.VersionOk}} - {{.Choco.Authors}} - {{.Choco.Owners}} - {{.Choco.Description}} - {{if gt (.Choco.ProjectURL | len) 0}} - {{.Choco.ProjectURL}} - {{end}} - {{if gt (.Choco.Tags | len) 0}} - {{.Choco.Tags}} - {{end}} - {{if gt (.Choco.LicenseURL | len) 0}} - {{.Choco.LicenseURL}} - {{end}} - {{if gt (.Choco.IconURL | len) 0}} - {{.Choco.IconURL}} - {{end}} - {{if gt (.Choco.ChangeLog | len) 0}} - {{.Choco.ChangeLog}} - {{end}} - {{if .Choco.RequireLicense}} - true - {{else}} - false - {{end}} - - - - - - - - - diff --git a/pkg-scripts/msi-templates/product.wxs b/pkg-scripts/msi-templates/product.wxs index 1bd3bee..348a2b0 100644 --- a/pkg-scripts/msi-templates/product.wxs +++ b/pkg-scripts/msi-templates/product.wxs @@ -16,7 +16,7 @@ Manufacturer="{{.Company}}" Language="1033"> - + @@ -34,18 +34,21 @@ {{if gt (.Files.Items | len) 0}} {{range $i, $e := .Files.Items}} - {{if eq $i 0}} - - - {{end}} - {{end}} + + + + + + {{end}} + + {{end}} {{end}} {{if gt (.Directories | len) 0}} - {{range $i, $e := .Directories}} - - {{end}} + {{range $i, $e := .Directories}} + + {{end}} {{end}} @@ -137,6 +140,9 @@ {{range $i, $e := .Directories}} {{end}} + + + From 73d98ad3952a7ec4866f766a81f384f4261cf2e2 Mon Sep 17 00:00:00 2001 From: requilence Date: Tue, 30 Oct 2018 12:40:42 +0200 Subject: [PATCH 2/2] fix tabs --- pkg-scripts/msi-templates/WixUI_HK.wxs | 8 ++++---- 1 file changed, 4 insertions(+), 4 deletions(-) diff --git a/pkg-scripts/msi-templates/WixUI_HK.wxs b/pkg-scripts/msi-templates/WixUI_HK.wxs index 08c5aeb..79ff174 100644 --- a/pkg-scripts/msi-templates/WixUI_HK.wxs +++ b/pkg-scripts/msi-templates/WixUI_HK.wxs @@ -48,16 +48,16 @@ "1"]]> - OLDERVERSIONBEINGUPGRADED AND WIXUI_INSTALLDIR_VALID="1" - NOT OLDERVERSIONBEINGUPGRADED AND WIXUI_INSTALLDIR_VALID="1" + OLDERVERSIONBEINGUPGRADED AND WIXUI_INSTALLDIR_VALID="1" + NOT OLDERVERSIONBEINGUPGRADED AND WIXUI_INSTALLDIR_VALID="1" 1 1 1 1 - OLDERVERSIONBEINGUPGRADED AND WIXUI_INSTALLDIR_VALID="1" - NOT OLDERVERSIONBEINGUPGRADED AND WIXUI_INSTALLDIR_VALID="1" + OLDERVERSIONBEINGUPGRADED AND WIXUI_INSTALLDIR_VALID="1" + NOT OLDERVERSIONBEINGUPGRADED AND WIXUI_INSTALLDIR_VALID="1" 1