115 lines
4.5 KiB
NSIS
115 lines
4.5 KiB
NSIS
; Cagire NSIS Installer Script
|
|
; Receives defines from command line:
|
|
; -DVERSION=x.y.z
|
|
; -DCLI_EXE=/path/to/cagire.exe
|
|
; -DDESKTOP_EXE=/path/to/cagire-desktop.exe
|
|
; -DICON=/path/to/Cagire.ico
|
|
; -DOUTDIR=/path/to/releases
|
|
|
|
!include "MUI2.nsh"
|
|
!include "WordFunc.nsh"
|
|
|
|
Name "Cagire ${VERSION}"
|
|
OutFile "${OUTDIR}\cagire-${VERSION}-windows-x86_64-setup.exe"
|
|
InstallDir "$PROGRAMFILES64\Cagire"
|
|
InstallDirRegKey HKLM "Software\Cagire" "InstallDir"
|
|
RequestExecutionLevel admin
|
|
Unicode True
|
|
|
|
!define MUI_ICON "${ICON}"
|
|
!define MUI_UNICON "${ICON}"
|
|
!define MUI_ABORTWARNING
|
|
|
|
!define MUI_HEADERIMAGE
|
|
!define MUI_HEADERIMAGE_BITMAP "header.bmp"
|
|
!define MUI_WELCOMEFINISHPAGE_BITMAP "sidebar.bmp"
|
|
!define MUI_UNWELCOMEFINISHPAGE_BITMAP "sidebar.bmp"
|
|
|
|
!insertmacro MUI_PAGE_WELCOME
|
|
!insertmacro MUI_PAGE_COMPONENTS
|
|
!insertmacro MUI_PAGE_DIRECTORY
|
|
!insertmacro MUI_PAGE_INSTFILES
|
|
!insertmacro MUI_PAGE_FINISH
|
|
|
|
!insertmacro MUI_UNPAGE_CONFIRM
|
|
!insertmacro MUI_UNPAGE_INSTFILES
|
|
|
|
!insertmacro MUI_LANGUAGE "English"
|
|
|
|
Section "Cagire (required)" SecCore
|
|
SectionIn RO
|
|
SetOutPath "$INSTDIR"
|
|
!ifdef CLI_EXE
|
|
File "/oname=cagire.exe" "${CLI_EXE}"
|
|
!endif
|
|
!ifdef DESKTOP_EXE
|
|
File "/oname=cagire-desktop.exe" "${DESKTOP_EXE}"
|
|
!endif
|
|
|
|
WriteUninstaller "$INSTDIR\uninstall.exe"
|
|
WriteRegStr HKLM "Software\Cagire" "InstallDir" "$INSTDIR"
|
|
|
|
; Add/Remove Programs entry
|
|
WriteRegStr HKLM "Software\Microsoft\Windows\CurrentVersion\Uninstall\Cagire" "DisplayName" "Cagire"
|
|
WriteRegStr HKLM "Software\Microsoft\Windows\CurrentVersion\Uninstall\Cagire" "DisplayVersion" "${VERSION}"
|
|
WriteRegStr HKLM "Software\Microsoft\Windows\CurrentVersion\Uninstall\Cagire" "Publisher" "Raphael Forment"
|
|
WriteRegStr HKLM "Software\Microsoft\Windows\CurrentVersion\Uninstall\Cagire" "UninstallString" '"$INSTDIR\uninstall.exe"'
|
|
!ifdef DESKTOP_EXE
|
|
WriteRegStr HKLM "Software\Microsoft\Windows\CurrentVersion\Uninstall\Cagire" "DisplayIcon" '"$INSTDIR\cagire-desktop.exe"'
|
|
!else
|
|
WriteRegStr HKLM "Software\Microsoft\Windows\CurrentVersion\Uninstall\Cagire" "DisplayIcon" '"$INSTDIR\cagire.exe"'
|
|
!endif
|
|
WriteRegStr HKLM "Software\Microsoft\Windows\CurrentVersion\Uninstall\Cagire" "URLInfoAbout" "https://git.raphaelforment.fr/BuboBubo/cagire"
|
|
WriteRegStr HKLM "Software\Microsoft\Windows\CurrentVersion\Uninstall\Cagire" "HelpLink" "https://cagire.raphaelforment.fr"
|
|
WriteRegDWORD HKLM "Software\Microsoft\Windows\CurrentVersion\Uninstall\Cagire" "NoModify" 1
|
|
WriteRegDWORD HKLM "Software\Microsoft\Windows\CurrentVersion\Uninstall\Cagire" "NoRepair" 1
|
|
SectionEnd
|
|
|
|
Section "Add to PATH" SecPath
|
|
ReadRegStr $0 HKLM "SYSTEM\CurrentControlSet\Control\Session Manager\Environment" "Path"
|
|
StrCpy $0 "$0;$INSTDIR"
|
|
WriteRegExpandStr HKLM "SYSTEM\CurrentControlSet\Control\Session Manager\Environment" "Path" "$0"
|
|
SendMessage ${HWND_BROADCAST} ${WM_WININICHANGE} 0 "STR:Environment" /TIMEOUT=5000
|
|
SectionEnd
|
|
|
|
!ifdef DESKTOP_EXE
|
|
Section "Start Menu Shortcut" SecStartMenu
|
|
CreateDirectory "$SMPROGRAMS\Cagire"
|
|
CreateShortCut "$SMPROGRAMS\Cagire\Cagire.lnk" "$INSTDIR\cagire-desktop.exe" "" "$INSTDIR\cagire-desktop.exe" 0
|
|
CreateShortCut "$SMPROGRAMS\Cagire\Uninstall.lnk" "$INSTDIR\uninstall.exe"
|
|
SectionEnd
|
|
!endif
|
|
|
|
!insertmacro MUI_FUNCTION_DESCRIPTION_BEGIN
|
|
!insertmacro MUI_DESCRIPTION_TEXT ${SecCore} "Installs Cagire CLI and Desktop binaries."
|
|
!insertmacro MUI_DESCRIPTION_TEXT ${SecPath} "Add the install location to the PATH system environment variable."
|
|
!ifdef DESKTOP_EXE
|
|
!insertmacro MUI_DESCRIPTION_TEXT ${SecStartMenu} "Add a Cagire shortcut to the Start Menu."
|
|
!endif
|
|
!insertmacro MUI_FUNCTION_DESCRIPTION_END
|
|
|
|
Section "Uninstall"
|
|
!ifdef CLI_EXE
|
|
Delete "$INSTDIR\cagire.exe"
|
|
!endif
|
|
!ifdef DESKTOP_EXE
|
|
Delete "$INSTDIR\cagire-desktop.exe"
|
|
!endif
|
|
Delete "$INSTDIR\uninstall.exe"
|
|
RMDir "$INSTDIR"
|
|
|
|
Delete "$SMPROGRAMS\Cagire\Cagire.lnk"
|
|
Delete "$SMPROGRAMS\Cagire\Uninstall.lnk"
|
|
RMDir "$SMPROGRAMS\Cagire"
|
|
|
|
; Remove from PATH
|
|
ReadRegStr $0 HKLM "SYSTEM\CurrentControlSet\Control\Session Manager\Environment" "Path"
|
|
; Remove ";$INSTDIR" from the path string
|
|
${WordReplace} $0 ";$INSTDIR" "" "+" $0
|
|
WriteRegExpandStr HKLM "SYSTEM\CurrentControlSet\Control\Session Manager\Environment" "Path" "$0"
|
|
SendMessage ${HWND_BROADCAST} ${WM_WININICHANGE} 0 "STR:Environment" /TIMEOUT=5000
|
|
|
|
DeleteRegKey HKLM "Software\Microsoft\Windows\CurrentVersion\Uninstall\Cagire"
|
|
DeleteRegKey HKLM "Software\Cagire"
|
|
SectionEnd
|