mirror of https://github.com/liamg/aminal.git
Implement Uninstaller for Windows
This commit is contained in:
parent
8fd76c876b
commit
eaa60f129d
17
Makefile
17
Makefile
|
@ -66,17 +66,22 @@ launcher-windows: build-windows
|
||||||
powershell -Command "(gc ${GEN_SRC_DIR}\launcher\versioninfo.json) -creplace 'YEAR', (Get-Date -UFormat '%Y') | Out-File -Encoding default ${GEN_SRC_DIR}\launcher\versioninfo.json"
|
powershell -Command "(gc ${GEN_SRC_DIR}\launcher\versioninfo.json) -creplace 'YEAR', (Get-Date -UFormat '%Y') | Out-File -Encoding default ${GEN_SRC_DIR}\launcher\versioninfo.json"
|
||||||
copy aminal.ico "${GEN_SRC_DIR}\launcher" /Y
|
copy aminal.ico "${GEN_SRC_DIR}\launcher" /Y
|
||||||
go generate "${GEN_SRC_DIR}\launcher"
|
go generate "${GEN_SRC_DIR}\launcher"
|
||||||
if exist "bin\windows\launcher" rmdir /S /Q "bin\windows\launcher"
|
if exist "bin\windows\Aminal" rmdir /S /Q "bin\windows\Aminal"
|
||||||
mkdir "bin\windows\launcher\Versions\${VERSION}"
|
mkdir "bin\windows\Aminal\Versions\${VERSION}"
|
||||||
go build -o "bin\windows\launcher\${BINARY}.exe" -ldflags "-H windowsgui" "${GEN_SRC_DIR}\launcher"
|
go build -o "bin\windows\Aminal\${BINARY}.exe" -ldflags "-H windowsgui" "${GEN_SRC_DIR}\launcher"
|
||||||
copy ${BINARY}-windows-amd64.exe "bin\windows\launcher\Versions\${VERSION}\${BINARY}.exe" /Y
|
copy ${BINARY}-windows-amd64.exe "bin\windows\Aminal\Versions\${VERSION}\${BINARY}.exe" /Y
|
||||||
|
|
||||||
|
.PHONY: uninstaller-windows
|
||||||
|
uninstaller-windows: launcher-windows
|
||||||
|
makensis "/XOutFile bin/windows/UninstallerSetup.exe" /NOCD windows\Uninstaller.nsi
|
||||||
|
cmd /c "bin\windows\UninstallerSetup.exe /S /D=%cd%\bin\windows\Aminal"
|
||||||
|
|
||||||
.PHONY: installer-windows
|
.PHONY: installer-windows
|
||||||
installer-windows:
|
installer-windows: uninstaller-windows
|
||||||
if exist "${GEN_SRC_DIR}\installer" rmdir /S /Q "${GEN_SRC_DIR}\installer"
|
if exist "${GEN_SRC_DIR}\installer" rmdir /S /Q "${GEN_SRC_DIR}\installer"
|
||||||
xcopy "windows\installer\*.*" "${GEN_SRC_DIR}\installer" /K /H /Y /Q /I
|
xcopy "windows\installer\*.*" "${GEN_SRC_DIR}\installer" /K /H /Y /Q /I
|
||||||
powershell -Command "(gc ${GEN_SRC_DIR}\installer\installer.go) -creplace 'VERSION', '${VERSION}' | Out-File -Encoding default ${GEN_SRC_DIR}\installer\installer.go"
|
powershell -Command "(gc ${GEN_SRC_DIR}\installer\installer.go) -creplace 'VERSION', '${VERSION}' | Out-File -Encoding default ${GEN_SRC_DIR}\installer\installer.go"
|
||||||
go-bindata -prefix "bin\windows\launcher" -o "${GEN_SRC_DIR}/installer/data/data.go" "./bin/windows/launcher/..."
|
go-bindata -prefix "bin\windows\Aminal" -o "${GEN_SRC_DIR}/installer/data/data.go" "./bin/windows/Aminal/..."
|
||||||
powershell -Command "(gc ${GEN_SRC_DIR}\installer\data\data.go) -creplace 'package main', 'package data' | Out-File -Encoding default ${GEN_SRC_DIR}\installer\data\data.go"
|
powershell -Command "(gc ${GEN_SRC_DIR}\installer\data\data.go) -creplace 'package main', 'package data' | Out-File -Encoding default ${GEN_SRC_DIR}\installer\data\data.go"
|
||||||
go build -o bin/windows/AminalSetup.exe -ldflags "-H windowsgui" "${GEN_SRC_DIR}/installer/installer.go"
|
go build -o bin/windows/AminalSetup.exe -ldflags "-H windowsgui" "${GEN_SRC_DIR}/installer/installer.go"
|
||||||
rem If an .exe name contains "installer", "setup" etc., then at least Windows 10 automatically
|
rem If an .exe name contains "installer", "setup" etc., then at least Windows 10 automatically
|
||||||
|
|
|
@ -0,0 +1,72 @@
|
||||||
|
!include MUI2.nsh
|
||||||
|
|
||||||
|
;--------------------------------
|
||||||
|
;Perform Machine-level install, if possible
|
||||||
|
|
||||||
|
!define MULTIUSER_EXECUTIONLEVEL Highest
|
||||||
|
;Add support for command-line args that let uninstaller know whether to
|
||||||
|
;uninstall machine- or user installation:
|
||||||
|
!define MULTIUSER_INSTALLMODE_COMMANDLINE
|
||||||
|
!include MultiUser.nsh
|
||||||
|
!include LogicLib.nsh
|
||||||
|
|
||||||
|
Function .onInit
|
||||||
|
!insertmacro MULTIUSER_INIT
|
||||||
|
FunctionEnd
|
||||||
|
|
||||||
|
Function un.onInit
|
||||||
|
!insertmacro MULTIUSER_UNINIT
|
||||||
|
FunctionEnd
|
||||||
|
|
||||||
|
;--------------------------------
|
||||||
|
;General
|
||||||
|
|
||||||
|
Name "Aminal"
|
||||||
|
|
||||||
|
;--------------------------------
|
||||||
|
;Pages
|
||||||
|
|
||||||
|
!insertmacro MUI_UNPAGE_CONFIRM
|
||||||
|
!insertmacro MUI_UNPAGE_INSTFILES
|
||||||
|
|
||||||
|
;--------------------------------
|
||||||
|
;Languages
|
||||||
|
|
||||||
|
!insertmacro MUI_LANGUAGE "English"
|
||||||
|
|
||||||
|
;--------------------------------
|
||||||
|
;Installer Sections
|
||||||
|
|
||||||
|
Section
|
||||||
|
SetOutPath "$InstDir"
|
||||||
|
WriteUninstaller "$InstDir\uninstall.exe"
|
||||||
|
SectionEnd
|
||||||
|
|
||||||
|
;--------------------------------
|
||||||
|
;Uninstaller Section
|
||||||
|
|
||||||
|
!define UNINST_KEY \
|
||||||
|
"Software\Microsoft\Windows\CurrentVersion\Uninstall\Aminal"
|
||||||
|
!define ROOT_KEY "Software\Aminal"
|
||||||
|
!define UPDATE_KEY \
|
||||||
|
"${ROOT_KEY}\Update\Clients\{35B0CF1E-FBB0-486F-A1DA-BE3A41DDC780}"
|
||||||
|
|
||||||
|
Section "Uninstall"
|
||||||
|
|
||||||
|
RMDir /r "$InstDir\Versions"
|
||||||
|
Delete "$InstDir\Aminal.exe"
|
||||||
|
Delete "$InstDir\uninstall.exe"
|
||||||
|
;Omaha leaves this directory behind. Delete if empty:
|
||||||
|
RMDir "$InstDir\CrashReports"
|
||||||
|
RMDir "$InstDir"
|
||||||
|
Delete "$SMPROGRAMS\Aminal.lnk"
|
||||||
|
DeleteRegKey SHCTX "${UNINST_KEY}"
|
||||||
|
DeleteRegKey SHCTX "${UPDATE_KEY}"
|
||||||
|
DeleteRegKey /ifempty SHCTX "${ROOT_KEY}\Update\Clients"
|
||||||
|
;Try to speed up uninstall of Omaha:
|
||||||
|
DeleteRegValue SHCTX "${ROOT_KEY}\Update" "LastChecked"
|
||||||
|
DeleteRegKey /ifempty SHCTX "${ROOT_KEY}\Update"
|
||||||
|
WriteRegStr SHCTX "${ROOT_KEY}" "" ""
|
||||||
|
DeleteRegKey /ifempty SHCTX "${ROOT_KEY}"
|
||||||
|
|
||||||
|
SectionEnd
|
Loading…
Reference in New Issue