ssh-handler.nsi 3.7 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123
  1. ; SSH Handler
  2. ;
  3. ; Douglas Thrift
  4. ;
  5. ; ssh-handler.nsi
  6. # Copyright 2013 Douglas Thrift
  7. #
  8. # Licensed under the Apache License, Version 2.0 (the "License");
  9. # you may not use this file except in compliance with the License.
  10. # You may obtain a copy of the License at
  11. #
  12. # http://www.apache.org/licenses/LICENSE-2.0
  13. #
  14. # Unless required by applicable law or agreed to in writing, software
  15. # distributed under the License is distributed on an "AS IS" BASIS,
  16. # WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
  17. # See the License for the specific language governing permissions and
  18. # limitations under the License.
  19. !define SSH_HANDLER_VERSION "1.0.0"
  20. !define SSH_HANDLER_NAME "SSH Handler"
  21. Name "${SSH_HANDLER_NAME}"
  22. OutFile "ssh-handler-${SSH_HANDLER_VERSION}.exe"
  23. SetCompressor /SOLID lzma
  24. ShowInstDetails show
  25. ShowUninstDetails show
  26. XPStyle on
  27. !define SSH_HANDLER "${SSH_HANDLER_NAME} ${SSH_HANDLER_VERSION}"
  28. !define SSH_HANDLER_EXE "ssh-handler.exe"
  29. !define UNINST_REG "Software\Microsoft\Windows\CurrentVersion\Uninstall\$(^Name)"
  30. !define UNINST_EXE "ssh-handler-uninst.exe"
  31. !define MULTIUSER_EXECUTIONLEVEL "Highest"
  32. !define MULTIUSER_INSTALLMODE_COMMANDLINE
  33. !define MULTIUSER_INSTALLMODE_DEFAULT_REGISTRY_KEY "${UNINST_REG}"
  34. !define MULTIUSER_INSTALLMODE_DEFAULT_REGISTRY_VALUENAME "UninstallString"
  35. !define MULTIUSER_INSTALLMODE_INSTDIR "${SSH_HANDLER_NAME}"
  36. !define MULTIUSER_INSTALLMODE_INSTDIR_REGISTRY_KEY "${UNINST_REG}"
  37. !define MULTIUSER_INSTALLMODE_INSTDIR_REGISTRY_VALUENAME "InstallLocation"
  38. !define MULTIUSER_MUI
  39. !include "MultiUser.nsh"
  40. !include "MUI2.nsh"
  41. !define MUI_FINISHPAGE_NOAUTOCLOSE
  42. !insertmacro MUI_PAGE_WELCOME
  43. !insertmacro MUI_PAGE_LICENSE LICENSE
  44. !insertmacro MUI_PAGE_COMPONENTS
  45. !insertmacro MULTIUSER_PAGE_INSTALLMODE
  46. !insertmacro MUI_PAGE_DIRECTORY
  47. !insertmacro MUI_PAGE_INSTFILES
  48. !insertmacro MUI_PAGE_FINISH
  49. !define MUI_UNFINISHPAGE_NOAUTOCLOSE
  50. !insertmacro MUI_UNPAGE_WELCOME
  51. !insertmacro MUI_UNPAGE_CONFIRM
  52. !insertmacro MUI_UNPAGE_INSTFILES
  53. !insertmacro MUI_UNPAGE_FINISH
  54. !insertmacro MUI_LANGUAGE "English"
  55. !macro REGISTRY BASE_KEY
  56. WriteRegStr ${BASE_KEY} "Software\Classes\ssh" "" "URL:SSH Protocol"
  57. WriteRegStr ${BASE_KEY} "Software\Classes\ssh" "URL Protocol" ""
  58. WriteRegStr ${BASE_KEY} "Software\Classes\ssh\shell\open\command" "" '"$INSTDIR\${SSH_HANDLER_EXE}" "%1"'
  59. WriteRegStr ${BASE_KEY} "${UNINST_REG}" "DisplayName" "$(^Name)"
  60. WriteRegStr ${BASE_KEY} "${UNINST_REG}" "UninstallString" "$INSTDIR\${UNINST_EXE}"
  61. WriteRegStr ${BASE_KEY} "${UNINST_REG}" "InstallLocation" "$INSTDIR"
  62. WriteRegDWORD ${BASE_KEY} "${UNINST_REG}" "NoModify" 1
  63. WriteRegDWORD ${BASE_KEY} "${UNINST_REG}" "NoRepair" 1
  64. !macroend
  65. !macro UN_REGISTRY BASE_KEY
  66. DeleteRegKey ${BASE_KEY} "Software\Classes\ssh"
  67. DeleteRegKey ${BASE_KEY} "${UNINST_REG}"
  68. !macroend
  69. Section ".NET Framework 4 Client Profile"
  70. SectionIn 1 RO
  71. SectionEnd
  72. Section "!${SSH_HANDLER}"
  73. SectionIn 1 RO
  74. SetOutPath -
  75. WriteUninstaller "${UNINST_EXE}"
  76. File "ssh-handler\bin\Release\${SSH_HANDLER_EXE}"
  77. StrCmpS $MultiUser.InstallMode "CurrentUser" CurrentUser AllUsers
  78. CurrentUser:
  79. !insertmacro REGISTRY HKCU
  80. Goto Done
  81. AllUsers:
  82. !insertmacro REGISTRY HKLM
  83. Done:
  84. SectionEnd
  85. Section "un.${SSH_HANDLER}"
  86. Delete /REBOOTOK "$INSTDIR\${SSH_HANDLER_EXE}"
  87. Delete /REBOOTOK "$INSTDIR\${UNINST_EXE}"
  88. RMDir /REBOOTOK $INSTDIR
  89. StrCmpS $MultiUser.InstallMode "CurrentUser" CurrentUser AllUsers
  90. CurrentUser:
  91. !insertmacro UN_REGISTRY HKCU
  92. Goto Done
  93. AllUsers:
  94. !insertmacro UN_REGISTRY HKLM
  95. Done:
  96. SectionEnd
  97. Function .onInit
  98. !insertmacro MULTIUSER_INIT
  99. FunctionEnd
  100. Function un.onInit
  101. !insertmacro MULTIUSER_UNINIT
  102. FunctionEnd
  103. # vim: autoindent