1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 36 37 38 39 40 41 42 43 44 45 46 47 48 49 50 51 52 53 54 55 56 57 58 59 60 61 62 63 64 65 66 67 68 69 70 71 72 73 74 75 76 77 78 79 80 81 82 83 84 85 86 87 88 89 90 91 92 93 94 95 96 97 98 99 100 101 102 103 104 105 106 107 108 109 110 111 112 113 114 115 116 117 118 119 120 121 122 123 124 125 126 127 128 129 130 131 132 133 134 135 136 137 138 139 140 141 142 143 144 145 146 147 148 149 150 151
|
;This file is part of Tryton. The COPYRIGHT file at the top level of
;this repository contains the full copyright notices and license terms.
;Check version
!ifndef VERSION
!error "Missing VERSION! Specify it with '/DVERSION=<VERSION>'"
!endif
;Include Modern UI
!include "MUI.nsh"
;General
Name "Neso ${VERSION}"
OutFile "neso-setup-${VERSION}.exe"
SetCompressor lzma
SetCompress auto
;Default installation folder
InstallDir "$PROGRAMFILES\neso-${VERSION}"
;Get installation folder from registry if available
InstallDirRegKey HKCU "Software\neso-${VERSION}" ""
BrandingText "Neso ${VERSION}"
;Vista redirects $SMPROGRAMS to all users without this
RequestExecutionLevel admin
;Variables
Var MUI_TEMP
Var STARTMENU_FOLDER
;Interface Settings
!define MUI_ABORTWARNING
;Language Selection Dialog Settings
;Remember the installer language
!define MUI_LANGDLL_REGISTRY_ROOT "HKCU"
!define MUI_LANGDLL_REGISTRY_KEY "Software\Modern UI Test"
!define MUI_LANGDLL_REGISTRY_VALUENAME "Installer Language"
;Pages
!define MUI_ICON "share\pixmaps\neso\neso.ico"
!define MUI_LICENSEPAGE_TEXT_BOTTOM "$(LicenseText)"
!define MUI_LICENSEPAGE_BUTTON "$(LicenseNext)"
!insertmacro MUI_PAGE_LICENSE "LICENSE"
!insertmacro MUI_PAGE_DIRECTORY
!insertmacro MUI_PAGE_STARTMENU Application $STARTMENU_FOLDER
!insertmacro MUI_PAGE_INSTFILES
!insertmacro MUI_UNPAGE_CONFIRM
!insertmacro MUI_UNPAGE_INSTFILES
;Languages
!insertmacro MUI_LANGUAGE "English"
!include "english.nsh"
!insertmacro MUI_LANGUAGE "French"
!include "french.nsh"
!insertmacro MUI_LANGUAGE "German"
!include "german.nsh"
!insertmacro MUI_LANGUAGE "Spanish"
!include "spanish.nsh"
;Reserve Files
;If you are using solid compression, files that are required before
;the actual installation should be stored first in the data block,
;because this will make your installer start faster.
!insertmacro MUI_RESERVEFILE_LANGDLL
;Installer Sections
Function .onInit
ClearErrors
ReadRegStr $0 HKCU "Software\neso-${VERSION}" ""
IfErrors DoInstall 0
MessageBox MB_OK "$(PreviousInstall)"
Quit
DoInstall:
FunctionEnd
Section $(SecNesoName) SecNeso
SectionIn 1 2 RO
;Set output path to the installation directory
SetOutPath "$INSTDIR"
;Put file
File /r "dist\*"
File "COPYRIGHT"
File "INSTALL"
File "LICENSE"
File "README"
File "CHANGELOG"
;Write the installation path into the registry
WriteRegStr HKCU "Software\neso-${VERSION}" "" $INSTDIR
WriteRegStr HKLM "Software\neso-${VERSION}" "" $INSTDIR
;Write the uninstall keys for Windows
WriteRegStr HKLM "Software\Microsoft\Windows\CurrentVersion\Uninstall\neso-${VERSION}" "DisplayName" "Neso ${VERSION} (remove only)"
WriteRegStr HKLM "Software\Microsoft\Windows\CurrentVersion\Uninstall\neso-${VERSION}" "UninstallString" "$INSTDIR\uninstall.exe"
;Create the uninstaller
WriteUninstaller uninstall.exe
SectionEnd
Section $(SecStartMenuName) SecStartMenu
SectionIn 1 2
!insertmacro MUI_STARTMENU_WRITE_BEGIN Application
SetShellVarContext all
CreateDirectory "$SMPROGRAMS\$STARTMENU_FOLDER"
CreateShortCut "$SMPROGRAMS\$STARTMENU_FOLDER\Uninstall.lnk" "$INSTDIR\uninstall.exe" "" "$INSTDIR\uninstall.exe" 0
CreateShortCut "$SMPROGRAMS\$STARTMENU_FOLDER\Neso-${VERSION}.lnk" "$INSTDIR\neso.exe" "" "$INSTDIR\neso.exe" 0
CreateShortCut "$DESKTOP\Neso-${VERSION}.lnk" "$INSTDIR\neso.exe" "" "$INSTDIR\neso.exe" 0
!insertmacro MUI_STARTMENU_WRITE_END
SectionEnd
;Descriptions
!insertmacro MUI_FUNCTION_DESCRIPTION_BEGIN
!insertmacro MUI_DESCRIPTION_TEXT ${SecNeso} $(SecNesoDesc)
!insertmacro MUI_DESCRIPTION_TEXT ${SecStartMenu} $(SecStartMenuDesc)
!insertmacro MUI_FUNCTION_DESCRIPTION_END
Section "Uninstall"
;Add your stuff here
RMDIR /r "$INSTDIR"
;remove registry keys
DeleteRegKey HKCU "Software\neso-${VERSION}"
DeleteRegKey HKLM "Software\neso-${VERSION}"
DeleteRegKey HKLM "Software\Microsoft\Windows\CurrentVersion\Uninstall\neso-${VERSION}"
SetShellVarContext all
Delete "$DESKTOP\Neso-${VERSION}.lnk"
!insertmacro MUI_STARTMENU_GETFOLDER Application $MUI_TEMP
StrCmp $MUI_TEMP "" noshortcuts
Delete "$SMPROGRAMS\$MUI_TEMP\Uninstall.lnk"
Delete "$SMPROGRAMS\$MUI_TEMP\Neso-${VERSION}.lnk"
RMDir "$SMPROGRAMS\$MUI_TEMP"
noshortcuts:
SectionEnd
|