Update win installer

This commit is contained in:
Dag Heyman 2017-03-13 11:24:31 +01:00
parent 13a6f10853
commit c144e62dea
No known key found for this signature in database
GPG Key ID: 06FC004369E7D338

View File

@ -1,17 +1,17 @@
!include "MUI2.nsh"
!include "nsProcess.nsh"
!define MUI_ICON "../../resources/icons/ykman.ico"
!define MUI_ICON "../../resources/icons/yubioath.ico"
;Start Menu Folder Page Configuration
!define MUI_STARTMENUPAGE_DEFAULTFOLDER "Yubico\Yubikey Manager"
!define MUI_STARTMENUPAGE_DEFAULTFOLDER "Yubico\Yubico Authenticator"
!define MUI_STARTMENUPAGE_REGISTRY_ROOT "HKCU"
!define MUI_STARTMENUPAGE_REGISTRY_KEY "Software\Yubico\Yubikey Manager"
!define MUI_STARTMENUPAGE_REGISTRY_KEY "Software\Yubico\Yubico Authenticator"
!define MUI_STARTMENUPAGE_REGISTRY_VALUENAME "Start Menu Folder"
!define MUI_ABORTWARNING
;Checkbox on finish page, "Run YubiKey Manager"
!define MUI_FINISHPAGE_RUN "$INSTDIR\ykman-gui.exe"
!define MUI_FINISHPAGE_RUN "$INSTDIR\yubioath-desktop.exe"
Var STARTMENU_FOLDER
@ -33,17 +33,17 @@ Var STARTMENU_FOLDER
!system "signtool.exe sign /fd SHA256 /t http://timestamp.verisign.com/scripts/timstamp.dll $%TEMP%\ykman-uninstall.exe" = 0
; The name of the installer
Name "YubiKey Manager"
Name "Yubico Authenticator"
; The file to write
OutFile "../../yubikey-manager-qt-${VERSION}-win.exe"
OutFile "../../yubioath-desktop-${VERSION}-win.exe"
; The default installation directory
InstallDir "$PROGRAMFILES\Yubico\YubiKey Manager"
InstallDir "$PROGRAMFILES\Yubico\Yubico Authenticator"
; Registry key to check for directory (so if you install again, it will
; overwrite the old one automatically)
InstallDirRegKey HKLM "Software\Yubico\yubikey-manager" "Install_Dir"
InstallDirRegKey HKLM "Software\Yubico\yubioath-desktop" "Install_Dir"
SetCompressor /SOLID lzma
@ -69,22 +69,16 @@ Var STARTMENU_FOLDER
SetShellVarContext all
SetOutPath "$SMPROGRAMS\$STARTMENU_FOLDER"
CreateDirectory "$SMPROGRAMS\$STARTMENU_FOLDER"
CreateShortCut "$SMPROGRAMS\$STARTMENU_FOLDER\YubiKey Manager.lnk" "$INSTDIR\ykman-gui.exe"
CreateShortCut "$SMPROGRAMS\$STARTMENU_FOLDER\Uninstall YubiKey Manager.lnk" "$INSTDIR\ykman-uninstall.exe"
CreateShortCut "$SMPROGRAMS\$STARTMENU_FOLDER\Yubico Authenticator.lnk" "$INSTDIR\yubioath-desktop.exe"
CreateShortCut "$SMPROGRAMS\$STARTMENU_FOLDER\Uninstall Yubico Authenticator.lnk" "$INSTDIR\yubioath-desktop-uninstall.exe"
!insertmacro MUI_STARTMENU_WRITE_END
SectionEnd
Section "Kill process" KillProcess
${nsProcess::FindProcess} "ykman-gui.exe" $R0
${nsProcess::FindProcess} "yubioath-desktop.exe" $R0
${If} $R0 == 0
DetailPrint "YubiKey Manager (CLI) is running. Closing..."
${nsProcess::CloseProcess} "ykman-gui.exe" $R0
Sleep 2000
${EndIf}
${nsProcess::FindProcess} "ykman-gui.exe" $R0
${If} $R0 == 0
DetailPrint "YubiKey Manager is running. Closing..."
${nsProcess::CloseProcess} "ykman-gui.exe" $R0
DetailPrint "Yubico Authenticator is running. Closing..."
${nsProcess::CloseProcess} "yubioath-desktop.exe" $R0
Sleep 2000
${EndIf}
${nsProcess::Unload}
@ -93,24 +87,24 @@ Var STARTMENU_FOLDER
Function .onInit
!ifdef INNER
WriteUninstaller "$%TEMP%\ykman-uninstall.exe"
WriteUninstaller "$%TEMP%\yubioath-desktop-uninstall.exe"
Quit
!endif
FunctionEnd
Var MYTMP
Section "YubiKey Manager"
Section "Yubico Authenticator"
SectionIn RO
SetOutPath $INSTDIR
FILE /r "..\..\ykman-gui\release\*"
FILE /r "..\..\release\*"
; Write the installation path into the registry
WriteRegStr HKLM "Software\Yubico\yubikey-manager" "Install_Dir" "$INSTDIR"
WriteRegStr HKLM "Software\Yubico\yubioath-desktop" "Install_Dir" "$INSTDIR"
; Windows Add/Remove Programs support
StrCpy $MYTMP "Software\Microsoft\Windows\CurrentVersion\Uninstall\yubikey-manager"
StrCpy $MYTMP "Software\Microsoft\Windows\CurrentVersion\Uninstall\yubioath-desktop"
WriteRegStr HKLM $MYTMP "DisplayName" "YubiKey Manager"
WriteRegExpandStr HKLM $MYTMP "UninstallString" '"$INSTDIR\ykman-uninstall.exe"'
WriteRegExpandStr HKLM $MYTMP "UninstallString" '"$INSTDIR\yubioath-desktop-uninstall.exe"'
WriteRegExpandStr HKLM $MYTMP "InstallLocation" "$INSTDIR"
WriteRegStr HKLM $MYTMP "DisplayVersion" "${VERSION}"
WriteRegStr HKLM $MYTMP "Publisher" "Yubico AB"
@ -122,7 +116,7 @@ SectionEnd
Section
!ifndef INNER
SetOutPath $INSTDIR
File $%TEMP%\ykman-uninstall.exe
File $%TEMP%\yubioath-desktop-uninstall.exe
!endif
SectionEnd
@ -134,24 +128,18 @@ SectionEnd
!ifdef INNER
Var MUI_TEMP
!insertmacro MUI_PAGE_STARTMENU Application $STARTMENU_FOLDER
Name "YubiKey Manager"
Name "Yubico Authenticator"
Section "Uninstall"
; Remove registry keys
DeleteRegKey HKLM "Software\Microsoft\Windows\CurrentVersion\Uninstall\yubikey-manager"
DeleteRegKey HKLM "Software\Yubico\yubikey-manager"
DeleteRegKey HKLM "Software\Microsoft\Windows\CurrentVersion\Uninstall\yubioath-desktop"
DeleteRegKey HKLM "Software\Yubico\yubioath-desktop"
; Kill processes
${nsProcess::FindProcess} "ykman.exe" $R0
${nsProcess::FindProcess} "yubioath-desktop.exe" $R0
${If} $R0 == 0
DetailPrint "YubiKey Manager (CLI) is running. Closing..."
${nsProcess::CloseProcess} "ykman.exe" $R0
Sleep 2000
${EndIf}
${nsProcess::FindProcess} "ykman-gui.exe" $R0
${If} $R0 == 0
DetailPrint "YubiKey Manager (GUI) is running. Closing..."
${nsProcess::CloseProcess} "ykman-gui.exe" $R0
DetailPrint "Yubico Authenticator is running. Closing..."
${nsProcess::CloseProcess} "yubioath-desktop.exe" $R0
Sleep 2000
${EndIf}
${nsProcess::Unload}
@ -163,8 +151,8 @@ SectionEnd
; Remove shortcuts, if any
!insertmacro MUI_STARTMENU_GETFOLDER Application $MUI_TEMP
SetShellVarContext all
Delete "$SMPROGRAMS\$MUI_TEMP\Uninstall YubiKey Manager.lnk"
Delete "$SMPROGRAMS\$MUI_TEMP\YubiKey Manager.lnk"
Delete "$SMPROGRAMS\$MUI_TEMP\Uninstall Yubico Authenticator.lnk"
Delete "$SMPROGRAMS\$MUI_TEMP\Yubico Authenticator.lnk"
;Delete empty start menu parent diretories
StrCpy $MUI_TEMP "$SMPROGRAMS\$MUI_TEMP"
@ -177,6 +165,6 @@ SectionEnd
StrCmp $MUI_TEMP $SMPROGRAMS startMenuDeleteLoopDone startMenuDeleteLoop
startMenuDeleteLoopDone:
DeleteRegKey /ifempty HKCU "Software\Yubico\yubikey-manager"
DeleteRegKey /ifempty HKCU "Software\Yubico\yubioath-desktop"
SectionEnd
!endif