| 1 | ; Synergy.nsi
|
|---|
| 2 | ;
|
|---|
| 3 | ; This script is based on example1.nsi, but it remember the directory,
|
|---|
| 4 | ; has uninstall support and (optionally) installs start menu shortcuts.
|
|---|
| 5 | ;
|
|---|
| 6 | ; It will install makensisw.exe into a directory that the user selects,
|
|---|
| 7 |
|
|---|
| 8 | ;--------------------------------
|
|---|
| 9 |
|
|---|
| 10 | ; Path to root of tree
|
|---|
| 11 | !define DEPTH "..\.."
|
|---|
| 12 |
|
|---|
| 13 | ; The name of the installer
|
|---|
| 14 | Name "Synergy"
|
|---|
| 15 |
|
|---|
| 16 | ; The file to write
|
|---|
| 17 | OutFile "${DEPTH}\build\SynergyInstaller.exe"
|
|---|
| 18 |
|
|---|
| 19 | ; The default installation directory
|
|---|
| 20 | InstallDir $PROGRAMFILES\Synergy
|
|---|
| 21 |
|
|---|
| 22 | ; Registry key to check for directory (so if you install again, it will
|
|---|
| 23 | ; overwrite the old one automatically)
|
|---|
| 24 | InstallDirRegKey HKLM "Software\Synergy" "Install_Dir"
|
|---|
| 25 |
|
|---|
| 26 | ;--------------------------------
|
|---|
| 27 |
|
|---|
| 28 | ; Pages
|
|---|
| 29 |
|
|---|
| 30 | Page components
|
|---|
| 31 | Page license
|
|---|
| 32 | Page directory
|
|---|
| 33 | Page instfiles
|
|---|
| 34 |
|
|---|
| 35 | UninstPage uninstConfirm
|
|---|
| 36 | UninstPage instfiles
|
|---|
| 37 |
|
|---|
| 38 | ;--------------------------------
|
|---|
| 39 |
|
|---|
| 40 | ; Text
|
|---|
| 41 | ComponentText "This will install Synergy on your computer. Select the optional components you want to install."
|
|---|
| 42 | DirText "Choose a directory to install Synergy to:"
|
|---|
| 43 | UninstallText "This will uninstall Synergy from your computer."
|
|---|
| 44 | LicenseText "Synergy is distributed under the GNU GPL:"
|
|---|
| 45 | LicenseData "COPYING.txt"
|
|---|
| 46 |
|
|---|
| 47 | ;--------------------------------
|
|---|
| 48 |
|
|---|
| 49 | ; The stuff to install
|
|---|
| 50 | Section "Synergy (required)"
|
|---|
| 51 |
|
|---|
| 52 | SectionIn RO
|
|---|
| 53 |
|
|---|
| 54 | ; Set output path to the installation directory.
|
|---|
| 55 | SetOutPath $INSTDIR
|
|---|
| 56 |
|
|---|
| 57 | ; Put files there
|
|---|
| 58 | File "${DEPTH}\build\synergy.exe"
|
|---|
| 59 | File "${DEPTH}\build\synergyc.exe"
|
|---|
| 60 | File "${DEPTH}\build\synergys.exe"
|
|---|
| 61 | File "${DEPTH}\build\*.dll"
|
|---|
| 62 | File COPYING.txt
|
|---|
| 63 | File ChangeLog.txt
|
|---|
| 64 | File ${DEPTH}\doc\PORTING
|
|---|
| 65 | File ${DEPTH}\doc\about.html
|
|---|
| 66 | File ${DEPTH}\doc\authors.html
|
|---|
| 67 | File ${DEPTH}\doc\autostart.html
|
|---|
| 68 | File ${DEPTH}\doc\banner.html
|
|---|
| 69 | File ${DEPTH}\doc\compiling.html
|
|---|
| 70 | File ${DEPTH}\doc\configuration.html
|
|---|
| 71 | File ${DEPTH}\doc\contact.html
|
|---|
| 72 | File ${DEPTH}\doc\developer.html
|
|---|
| 73 | File ${DEPTH}\doc\faq.html
|
|---|
| 74 | File ${DEPTH}\doc\history.html
|
|---|
| 75 | File ${DEPTH}\doc\home.html
|
|---|
| 76 | File ${DEPTH}\doc\index.html
|
|---|
| 77 | File ${DEPTH}\doc\license.html
|
|---|
| 78 | File ${DEPTH}\doc\news.html
|
|---|
| 79 | File ${DEPTH}\doc\roadmap.html
|
|---|
| 80 | File ${DEPTH}\doc\running.html
|
|---|
| 81 | File ${DEPTH}\doc\security.html
|
|---|
| 82 | File ${DEPTH}\doc\synergy.css
|
|---|
| 83 | File ${DEPTH}\doc\tips.html
|
|---|
| 84 | File ${DEPTH}\doc\toc.html
|
|---|
| 85 | File ${DEPTH}\doc\trouble.html
|
|---|
| 86 |
|
|---|
| 87 | SetOutPath $INSTDIR\images
|
|---|
| 88 | File ${DEPTH}\doc\images\logo.gif
|
|---|
| 89 | File ${DEPTH}\doc\images\warp.gif
|
|---|
| 90 |
|
|---|
| 91 | ; Write the installation path into the registry
|
|---|
| 92 | WriteRegStr HKLM SOFTWARE\Synergy "Install_Dir" "$INSTDIR"
|
|---|
| 93 |
|
|---|
| 94 | ; Write the uninstall keys for Windows
|
|---|
| 95 | WriteRegStr HKLM "Software\Microsoft\Windows\CurrentVersion\Uninstall\Synergy" "DisplayName" "Synergy"
|
|---|
| 96 | WriteRegStr HKLM "Software\Microsoft\Windows\CurrentVersion\Uninstall\Synergy" "UninstallString" '"$INSTDIR\uninstall.exe"'
|
|---|
| 97 | WriteRegDWORD HKLM "Software\Microsoft\Windows\CurrentVersion\Uninstall\Synergy" "NoModify" 1
|
|---|
| 98 | WriteRegDWORD HKLM "Software\Microsoft\Windows\CurrentVersion\Uninstall\Synergy" "NoRepair" 1
|
|---|
| 99 | WriteUninstaller "uninstall.exe"
|
|---|
| 100 |
|
|---|
| 101 | SectionEnd
|
|---|
| 102 |
|
|---|
| 103 | ; Optional section (can be disabled by the user)
|
|---|
| 104 | Section "Start Menu Shortcuts"
|
|---|
| 105 |
|
|---|
| 106 | CreateDirectory "$SMPROGRAMS\Synergy"
|
|---|
| 107 | CreateShortCut "$SMPROGRAMS\Synergy\Synergy.lnk" "$INSTDIR\synergy.exe" "" "$INSTDIR\synergy.exe" 0
|
|---|
| 108 | CreateShortCut "$SMPROGRAMS\Synergy\README.lnk" "$INSTDIR\index.html"
|
|---|
| 109 | CreateShortCut "$SMPROGRAMS\Synergy\Synergy Folder.lnk" "$INSTDIR"
|
|---|
| 110 | CreateShortCut "$SMPROGRAMS\Synergy\Uninstall.lnk" "$INSTDIR\uninstall.exe" "" "$INSTDIR\uninstall.exe" 0
|
|---|
| 111 |
|
|---|
| 112 | SectionEnd
|
|---|
| 113 |
|
|---|
| 114 | ; Optional section (can be disabled by the user)
|
|---|
| 115 | Section "Desktop Icon"
|
|---|
| 116 |
|
|---|
| 117 | CreateShortCut "$DESKTOP\Synergy.lnk" "$INSTDIR\synergy.exe" "" "$INSTDIR\synergy.exe" 0
|
|---|
| 118 |
|
|---|
| 119 | SectionEnd
|
|---|
| 120 |
|
|---|
| 121 | ;--------------------------------
|
|---|
| 122 |
|
|---|
| 123 | ; Uninstaller
|
|---|
| 124 |
|
|---|
| 125 | Section "Uninstall"
|
|---|
| 126 | ; Stop and uninstall the daemons
|
|---|
| 127 | ExecWait '"$INSTDIR\synergy.exe" /uninstall'
|
|---|
| 128 |
|
|---|
| 129 | ; Remove autorun registry keys for synergy
|
|---|
| 130 | DeleteRegKey HKLM "SYSTEM\CurrentControlSet\Services\Synergy Server"
|
|---|
| 131 | DeleteRegKey HKLM "SYSTEM\CurrentControlSet\Services\Synergy Client"
|
|---|
| 132 | DeleteRegValue HKLM "Software\Microsoft\Windows\CurrentVersion\RunServices" "Synergy Server"
|
|---|
| 133 | DeleteRegValue HKLM "Software\Microsoft\Windows\CurrentVersion\RunServices" "Synergy Client"
|
|---|
| 134 | DeleteRegValue HKCU "Software\Microsoft\Windows\CurrentVersion\Run" "Synergy Server"
|
|---|
| 135 | DeleteRegValue HKCU "Software\Microsoft\Windows\CurrentVersion\Run" "Synergy Client"
|
|---|
| 136 |
|
|---|
| 137 | ; not all keys will have existed, so errors WILL have happened
|
|---|
| 138 | ClearErrors
|
|---|
| 139 |
|
|---|
| 140 | ; Remove registry keys
|
|---|
| 141 | DeleteRegKey HKLM "Software\Microsoft\Windows\CurrentVersion\Uninstall\Synergy"
|
|---|
| 142 | DeleteRegKey HKLM SOFTWARE\Synergy
|
|---|
| 143 |
|
|---|
| 144 | ClearErrors
|
|---|
| 145 |
|
|---|
| 146 | ; First try to remove files that might be locked (if synergy is running)
|
|---|
| 147 | Delete /REBOOTOK $INSTDIR\synergy.exe
|
|---|
| 148 | Delete /REBOOTOK $INSTDIR\synergyc.exe
|
|---|
| 149 | Delete /REBOOTOK $INSTDIR\synergys.exe
|
|---|
| 150 | Delete /REBOOTOK $INSTDIR\synrgyhk.dll
|
|---|
| 151 |
|
|---|
| 152 | ; Remove files and directory
|
|---|
| 153 | Delete $INSTDIR\*.*
|
|---|
| 154 | RMDir $INSTDIR
|
|---|
| 155 |
|
|---|
| 156 | ; Remove shortcuts, if any
|
|---|
| 157 | Delete "$SMPROGRAMS\Synergy\*.*"
|
|---|
| 158 | Delete "$DESKTOP\Synergy.lnk"
|
|---|
| 159 |
|
|---|
| 160 | ; Remove directories used
|
|---|
| 161 | RMDir "$SMPROGRAMS\Synergy"
|
|---|
| 162 | RMDir "$INSTDIR"
|
|---|
| 163 |
|
|---|
| 164 | IfRebootFlag 0 EndOfAll
|
|---|
| 165 | MessageBox MB_OKCANCEL "Uninstaller needs to reboot to finish cleaning up. reboot now?" IDCANCEL NoReboot
|
|---|
| 166 | ClearErrors
|
|---|
| 167 | Reboot
|
|---|
| 168 | IfErrors 0 EndOfAll
|
|---|
| 169 | MessageBox MB_OK "Uninstaller could not reboot. Please reboot manually. Thank you."
|
|---|
| 170 | Abort "Uninstaller could not reboot. Please reboot manually. Thank you."
|
|---|
| 171 | NoReboot:
|
|---|
| 172 | DetailPrint ""
|
|---|
| 173 | DetailPrint "Uninstaller could not reboot. Please reboot manually. Thank you."
|
|---|
| 174 | DetailPrint ""
|
|---|
| 175 | SetDetailsView show
|
|---|
| 176 | EndOfAll:
|
|---|
| 177 |
|
|---|
| 178 | SectionEnd
|
|---|