1; 2; nlarn.nsi 3; Copyright (C) 2009-2020 Joachim de Groot <jdegroot@web.de> 4; 5; NLarn is free software: you can redistribute it and/or modify it 6; under the terms of the GNU General Public License as published by the 7; Free Software Foundation, either version 3 of the License, or 8; (at your option) any later version. 9; 10; NLarn is distributed in the hope that it will be useful, but 11; WITHOUT ANY WARRANTY; without even the implied warranty of 12; MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. 13; See the GNU General Public License for more details. 14; 15; You should have received a copy of the GNU General Public License along 16; with this program. If not, see <http://www.gnu.org/licenses/>. 17; 18 19; Unicode Installer 20Unicode True 21 22; Include Modern UI 23!include "MUI2.nsh" 24 25; check if NLarn version number has been defined 26!ifndef VERSION 27 !error "VERSION has not been defined" 28!endif 29 30; The name of the installer 31Name "NLarn ${VERSION}" 32 33; The file to write 34OutFile "nlarn-${VERSION}.exe" 35 36; Compression 37SetCompressor /SOLID lzma 38 39; The default installation directory 40InstallDir $PROGRAMFILES\NLarn 41 42; Registry key to check for directory (so if you install again, it will 43; overwrite the old one automatically) 44InstallDirRegKey HKLM "Software\NLarn" "Install_Dir" 45 46; Request application privileges for Windows Vista 47RequestExecutionLevel admin 48 49;-------------------------------- 50;Interface Configuration 51 52!define MUI_ICON "resources/nlarn-48.ico" 53!define MUI_UNICON "resources/nlarn-48.ico" 54 55;-------------------------------- 56; Pages 57 58!insertmacro MUI_PAGE_WELCOME 59!insertmacro MUI_PAGE_LICENSE "LICENSE" 60!insertmacro MUI_PAGE_DIRECTORY 61!insertmacro MUI_PAGE_INSTFILES 62!insertmacro MUI_PAGE_FINISH 63 64!insertmacro MUI_UNPAGE_WELCOME 65!insertmacro MUI_UNPAGE_CONFIRM 66!insertmacro MUI_UNPAGE_INSTFILES 67!insertmacro MUI_UNPAGE_FINISH 68 69 70;-------------------------------- 71; Localisation 72!insertmacro MUI_LANGUAGE "English" 73 74 75;-------------------------------- 76; Installer executable version information 77VIProductVersion "${VERSION_MAJOR}.${VERSION_MINOR}.${VERSION_PATCH}.0" 78VIAddVersionKey /LANG=${LANG_ENGLISH} "ProductName" "NLarn" 79VIAddVersionKey /LANG=${LANG_ENGLISH} "CompanyName" "Joachim de Groot" 80VIAddVersionKey /LANG=${LANG_ENGLISH} "LegalCopyright" "Copyright 2009-2020 Joachim de Groot" 81VIAddVersionKey /LANG=${LANG_ENGLISH} "FileDescription" "NLarn Installation Program" 82VIAddVersionKey /LANG=${LANG_ENGLISH} "FileVersion" "${VERSION}" 83 84 85;-------------------------------- 86; The stuff to install 87Section "NLarn (required)" 88 89 SectionIn RO 90 91 ; root directory 92 SetOutPath $INSTDIR 93 !include "mainfiles.nsh" 94 95 ; lib subdirectory 96 SetOutPath "$INSTDIR\lib" 97 !include "libfiles.nsh" 98 99 ; Write the installation path into the registry 100 WriteRegStr HKLM SOFTWARE\NLarn "Install_Dir" "$INSTDIR" 101 102 ; Write the uninstall keys for Windows 103 WriteRegStr HKLM "Software\Microsoft\Windows\CurrentVersion\Uninstall\NLarn" "DisplayIcon" '"$INSTDIR\uninstall.exe"' 104 WriteRegStr HKLM "Software\Microsoft\Windows\CurrentVersion\Uninstall\NLarn" "DisplayName" "NLarn ${VERSION}" 105 WriteRegStr HKLM "Software\Microsoft\Windows\CurrentVersion\Uninstall\NLarn" "DisplayVersion" "${VERSION}" 106 WriteRegStr HKLM "Software\Microsoft\Windows\CurrentVersion\Uninstall\NLarn" "Publisher" "Joachim de Groot" 107 WriteRegStr HKLM "Software\Microsoft\Windows\CurrentVersion\Uninstall\NLarn" "UninstallString" '"$INSTDIR\uninstall.exe"' 108 WriteRegDWORD HKLM "Software\Microsoft\Windows\CurrentVersion\Uninstall\NLarn" "NoModify" 1 109 WriteRegDWORD HKLM "Software\Microsoft\Windows\CurrentVersion\Uninstall\NLarn" "NoRepair" 1 110 WriteUninstaller "uninstall.exe" 111 112SectionEnd 113 114; Optional section (can be disabled by the user) 115Section "Start Menu Shortcuts" 116 117 CreateDirectory "$SMPROGRAMS\NLarn" 118 CreateShortCut "$SMPROGRAMS\NLarn\Uninstall.lnk" "$INSTDIR\uninstall.exe" 119 CreateShortCut "$SMPROGRAMS\NLarn\NLarn.lnk" "$INSTDIR\nlarn.exe" 120 CreateShortCut "$SMPROGRAMS\NLarn\README.lnk" "$INSTDIR\README.html" 121 CreateShortCut "$SMPROGRAMS\NLarn\Changelog.lnk" "$INSTDIR\Changelog.html" 122 123SectionEnd 124 125;-------------------------------- 126 127; Uninstaller 128 129Section "Uninstall" 130 131 ; Remove registry keys 132 DeleteRegKey HKLM "Software\Microsoft\Windows\CurrentVersion\Uninstall\NLarn" 133 DeleteRegKey HKLM SOFTWARE\NLarn 134 135 ; Remove files and uninstaller 136 Delete $INSTDIR\*.* 137 Delete $INSTDIR\lib\*.* 138 139 ; Remove shortcuts, if any 140 Delete "$SMPROGRAMS\NLarn\*.*" 141 142 ; Remove directories used 143 RMDir "$SMPROGRAMS\NLarn" 144 RMDir "$INSTDIR\lib" 145 RMDir "$INSTDIR" 146 147SectionEnd 148