Newer
Older
dub_jkp / installer / win / installer.nsi
@Sönke Ludwig Sönke Ludwig on 17 Apr 2013 4 KB dummy commit
  1. SetCompressor /SOLID lzma
  2.  
  3. ;--------------------------------------------------------
  4. ; Defines
  5. ;--------------------------------------------------------
  6.  
  7. ; Options
  8. !define Version "0.9.13"
  9. !define DubExecPath "..\..\bin"
  10.  
  11. ;--------------------------------------------------------
  12. ; Includes
  13. ;--------------------------------------------------------
  14.  
  15. !include "MUI.nsh"
  16. !include "EnvVarUpdate.nsh"
  17.  
  18. ;--------------------------------------------------------
  19. ; General definitions
  20. ;--------------------------------------------------------
  21.  
  22. ; Name of the installer
  23. Name "dub Package Manager ${Version}"
  24.  
  25. ; Name of the output file of the installer
  26. OutFile "dub-${Version}-setup.exe"
  27.  
  28. ; Where the program will be installed
  29. InstallDir "$PROGRAMFILES\dub"
  30.  
  31. ; Take the installation directory from the registry, if possible
  32. InstallDirRegKey HKLM "Software\dub" ""
  33.  
  34. ; Prevent installation of a corrupt installer
  35. CRCCheck force
  36.  
  37. RequestExecutionLevel admin
  38.  
  39. ;--------------------------------------------------------
  40. ; Interface settings
  41. ;--------------------------------------------------------
  42.  
  43. ;!define MUI_ICON "installer-icon.ico"
  44. ;!define MUI_UNICON "uninstaller-icon.ico"
  45.  
  46. ;--------------------------------------------------------
  47. ; Installer pages
  48. ;--------------------------------------------------------
  49.  
  50. !define MUI_WELCOMEFINISHPAGE_BITMAP "banner.bmp"
  51. !define MUI_HEADERIMAGE
  52. !define MUI_HEADERIMAGE_BITMAP "header.bmp"
  53. !insertmacro MUI_PAGE_WELCOME
  54. !insertmacro MUI_PAGE_COMPONENTS
  55. !insertmacro MUI_PAGE_DIRECTORY
  56. !insertmacro MUI_PAGE_INSTFILES
  57. !insertmacro MUI_PAGE_FINISH
  58.  
  59. !insertmacro MUI_UNPAGE_WELCOME
  60. !insertmacro MUI_UNPAGE_CONFIRM
  61. !insertmacro MUI_UNPAGE_INSTFILES
  62. !insertmacro MUI_UNPAGE_FINISH
  63.  
  64. ;--------------------------------------------------------
  65. ; The languages
  66. ;--------------------------------------------------------
  67.  
  68. !insertmacro MUI_LANGUAGE "English"
  69.  
  70.  
  71. ;--------------------------------------------------------
  72. ; Required section: main program files,
  73. ; registry entries, etc.
  74. ;--------------------------------------------------------
  75. ;
  76. Section "dub" DubFiles
  77.  
  78. ; This section is mandatory
  79. SectionIn RO
  80. SetOutPath $INSTDIR
  81. ; Create installation directory
  82. CreateDirectory "$INSTDIR"
  83. File "${DubExecPath}\dub.exe"
  84. File "${DubExecPath}\libcurl.dll"
  85. File "${DubExecPath}\libeay32.dll"
  86. File "${DubExecPath}\ssleay32.dll"
  87. ; Create command line batch file
  88. FileOpen $0 "$INSTDIR\dubvars.bat" w
  89. FileWrite $0 "@echo.$\n"
  90. FileWrite $0 "@echo Setting up environment for using dub from %~dp0$\n"
  91. FileWrite $0 "@set PATH=%~dp0;%PATH%$\n"
  92. FileClose $0
  93.  
  94. ; Write installation dir in the registry
  95. WriteRegStr HKLM SOFTWARE\dub "Install_Dir" "$INSTDIR"
  96.  
  97. ; Write registry keys to make uninstall from Windows
  98. WriteRegStr HKLM "Software\Microsoft\Windows\CurrentVersion\Uninstall\dub" "DisplayName" "dub package manager"
  99. WriteRegStr HKLM "Software\Microsoft\Windows\CurrentVersion\Uninstall\dub" "UninstallString" '"$INSTDIR\uninstall.exe"'
  100. WriteRegDWORD HKLM "Software\Microsoft\Windows\CurrentVersion\Uninstall\dub" "NoModify" 1
  101. WriteRegDWORD HKLM "Software\Microsoft\Windows\CurrentVersion\Uninstall\dub" "NoRepair" 1
  102. WriteUninstaller "uninstall.exe"
  103.  
  104. SectionEnd
  105.  
  106. Section "Add to PATH" AddDubToPath
  107.  
  108. ; Add dub directory to path (for all users)
  109. ${EnvVarUpdate} $0 "PATH" "A" "HKLM" "$INSTDIR"
  110.  
  111. SectionEnd
  112.  
  113. Section /o "Start menu shortcuts" StartMenuShortcuts
  114. CreateDirectory "$SMPROGRAMS\DUB"
  115.  
  116. ; install dub command prompt
  117. CreateShortCut "$SMPROGRAMS\DUB\DUB Command Prompt.lnk" '%comspec%' '/k ""$INSTDIR\dubvars.bat""' "" "" SW_SHOWNORMAL "" "Open DUB Command Prompt"
  118.  
  119. CreateShortCut "$SMPROGRAMS\DUB\Uninstall.lnk" "$INSTDIR\uninstall.exe" "" "$INSTDIR\uninstall.exe" 0
  120. SectionEnd
  121.  
  122. ;--------------------------------------------------------
  123. ; Uninstaller
  124. ;--------------------------------------------------------
  125.  
  126. Section "Uninstall"
  127.  
  128. ; Remove directories to path (for all users)
  129. ; (if for the current user, use HKCU)
  130. ${un.EnvVarUpdate} $0 "PATH" "R" "HKLM" "$INSTDIR"
  131.  
  132. ; Remove stuff from registry
  133. DeleteRegKey HKLM "Software\Microsoft\Windows\CurrentVersion\Uninstall\dub"
  134. DeleteRegKey HKLM SOFTWARE\dub
  135. DeleteRegKey /ifempty HKLM SOFTWARE\dub
  136.  
  137. ; This is for deleting the remembered language of the installation
  138. DeleteRegKey HKCU Software\dub
  139. DeleteRegKey /ifempty HKCU Software\dub
  140.  
  141. ; Remove the uninstaller
  142. Delete $INSTDIR\uninstall.exe
  143. ; Remove shortcuts
  144. Delete "$SMPROGRAMS\dub\dub Command Prompt.lnk"
  145.  
  146. ; Remove used directories
  147. RMDir /r /REBOOTOK "$INSTDIR"
  148. RMDir /r /REBOOTOK "$SMPROGRAMS\dub"
  149.  
  150. SectionEnd
  151.