barrier/res/Installer.nsi.in

171 lines
5.4 KiB
Plaintext
Raw Normal View History

2011-01-20 02:18:48 +00:00
; template variables
!define version ${in:version}
!define arch ${in:arch}
!define vcRedistDir ${in:vcRedistDir}
!define qtDir ${in:qtDir}
!define installDirVar ${in:installDirVar}
; normal variables
!define product "Synergy"
!define productOld "Synergy+"
!define packageName "synergy"
2011-01-20 03:44:43 +00:00
!define packageNameOld "synergy-plus"
2011-01-20 02:18:48 +00:00
!define platform "Windows"
!define publisher "The Synergy Project"
2011-01-20 03:44:43 +00:00
!define publisherOld "The Synergy+ Project"
2011-01-20 02:18:48 +00:00
!define helpUrl "http://synergy-foss.org/support"
!define vcRedistFile "vcredist_${arch}.exe"
!define startMenuApp "qsynergy.exe"
!define binDir "..\bin"
2011-01-20 02:18:48 +00:00
!define uninstall "uninstall.exe"
!define icon "..\src\gui\res\win\QSynergy.ico"
2011-01-20 02:18:48 +00:00
!define controlPanelReg "SOFTWARE\Microsoft\Windows\CurrentVersion\Uninstall"
!define MUI_ICON ${icon}
!define MUI_UNICON ${icon}
!include "MUI2.nsh"
!insertmacro MUI_PAGE_LICENSE "..\\res\\License.rtf"
2011-01-20 02:18:48 +00:00
!insertmacro MUI_PAGE_DIRECTORY
!insertmacro MUI_PAGE_INSTFILES
!insertmacro MUI_UNPAGE_WELCOME
!insertmacro MUI_UNPAGE_INSTFILES
!insertmacro MUI_LANGUAGE "English"
Name ${product}
2011-04-28 10:50:42 +00:00
OutFile "..\bin\${packageName}-${version}-${platform}-${arch}.exe"
2011-01-20 02:18:48 +00:00
InstallDir "${installDirVar}\${product}"
InstallDirRegKey HKEY_LOCAL_MACHINE "SOFTWARE\${product}" ""
2011-01-20 03:44:43 +00:00
; delete files we installed, and then dir if it's empty
!macro DeleteFiles dir
Delete "${dir}\synergyc.exe"
Delete "${dir}\synergys.exe"
Delete "${dir}\launcher.exe"
Delete "${dir}\synrgyhk.dll"
Delete "${dir}\libgcc_s_dw2-1.dll"
Delete "${dir}\mingwm10.dll"
Delete "${dir}\qsynergy.exe"
Delete "${dir}\QtCore4.dll"
Delete "${dir}\QtGui4.dll"
Delete "${dir}\QtNetwork4.dll"
Delete "${dir}\Uninstall.exe"
Delete "${dir}\uninstall.exe"
RMDir "${dir}"
!macroend
2011-01-20 02:18:48 +00:00
Section
SetShellVarContext all
SetOutPath "$INSTDIR"
2011-01-20 03:44:43 +00:00
; force kill all synergy processes
2011-01-20 02:18:48 +00:00
nsExec::Exec "taskkill /f /im qsynergy.exe"
2011-01-20 03:44:43 +00:00
nsExec::Exec "taskkill /f /im launcher.exe"
nsExec::Exec "taskkill /f /im synergys.exe"
nsExec::Exec "taskkill /f /im synergyc.exe"
; clean up legacy files that may exist (but leave user files)
!insertmacro DeleteFiles "$PROGRAMFILES32\${product}\bin"
!insertmacro DeleteFiles "$PROGRAMFILES64\${product}\bin"
!insertmacro DeleteFiles "$PROGRAMFILES32\${productOld}\bin"
!insertmacro DeleteFiles "$PROGRAMFILES64\${productOld}\bin"
!insertmacro DeleteFiles "$PROGRAMFILES32\${product}"
!insertmacro DeleteFiles "$PROGRAMFILES64\${product}"
!insertmacro DeleteFiles "$PROGRAMFILES32\${productOld}"
!insertmacro DeleteFiles "$PROGRAMFILES64\${productOld}"
; clean up legacy start menu entries
RMDir /R "$SMPROGRAMS\${product}"
RMDir /R "$SMPROGRAMS\${productOld}"
2011-01-20 02:18:48 +00:00
; always delete any existing uninstall info
DeleteRegKey HKLM "${controlPanelReg}\${product}"
2011-01-20 03:44:43 +00:00
DeleteRegKey HKLM "${controlPanelReg}\${productOld}"
DeleteRegKey HKLM "${controlPanelReg}\${publisher}"
DeleteRegKey HKLM "${controlPanelReg}\${publisherOld}"
DeleteRegKey HKLM "${controlPanelReg}\${packageNameOld}"
DeleteRegKey HKLM "SOFTWARE\${product}"
DeleteRegKey HKLM "SOFTWARE\${productOld}"
DeleteRegKey HKLM "SOFTWARE\${publisher}"
DeleteRegKey HKLM "SOFTWARE\${publisherOld}"
2011-01-20 02:18:48 +00:00
2011-01-20 03:44:43 +00:00
; create uninstaller (used for control panel icon)
WriteUninstaller "$INSTDIR\${uninstall}"
2011-01-20 02:18:48 +00:00
; add new uninstall info
WriteRegStr HKLM "${controlPanelReg}\${product}" "" $INSTDIR
WriteRegStr HKLM "${controlPanelReg}\${product}" "DisplayName" "${product}"
WriteRegStr HKLM "${controlPanelReg}\${product}" "DisplayVersion" "${version}"
WriteRegStr HKLM "${controlPanelReg}\${product}" "DisplayIcon" "$INSTDIR\uninstall.exe"
WriteRegStr HKLM "${controlPanelReg}\${product}" "Publisher" "${publisher}"
WriteRegStr HKLM "${controlPanelReg}\${product}" "UninstallString" "$INSTDIR\uninstall.exe"
WriteRegStr HKLM "${controlPanelReg}\${product}" "URLInfoAbout" "${helpUrl}"
SectionEnd
2011-01-20 03:44:43 +00:00
Section "Server and Client" core
; client and server files
2011-04-28 10:50:42 +00:00
File "${binDir}\Release\synergys.exe"
File "${binDir}\Release\synergyc.exe"
2011-05-08 22:46:06 +00:00
File "${binDir}\Release\synrgyhk.dll"
2011-01-20 03:44:43 +00:00
SectionEnd
2011-01-20 02:18:48 +00:00
Section "Graphical User Interface" gui
; gui and qt libs
File "${binDir}\Release\qsynergy.exe"
2011-01-20 02:18:48 +00:00
File "${qtDir}\qt\bin\libgcc_s_dw2-1.dll"
File "${qtDir}\qt\bin\mingwm10.dll"
File "${qtDir}\qt\bin\QtGui4.dll"
File "${qtDir}\qt\bin\QtCore4.dll"
File "${qtDir}\qt\bin\QtNetwork4.dll"
; gui start menu shortcut
SetShellVarContext all
CreateShortCut "$SMPROGRAMS\${product}.lnk" "$INSTDIR\${startMenuApp}"
SectionEnd
Section "Visual C++ Redistributable" vcredist
; copy redist file, run it, then delete when done
File "${vcRedistDir}\${vcRedistFile}"
ExecWait "$INSTDIR\${vcRedistFile} /install /q"
Delete $INSTDIR\${vcRedistFile}
SectionEnd
Section Uninstall
SetShellVarContext all
2011-01-20 03:44:43 +00:00
; force kill all synergy processes
2011-01-20 02:18:48 +00:00
nsExec::Exec "taskkill /f /im qsynergy.exe"
2011-01-20 03:44:43 +00:00
nsExec::Exec "taskkill /f /im launcher.exe"
nsExec::Exec "taskkill /f /im synergys.exe"
nsExec::Exec "taskkill /f /im synergyc.exe"
2011-01-20 02:18:48 +00:00
; delete start menu shortcut
Delete "$SMPROGRAMS\${product}.lnk"
; delete all registry keys
DeleteRegKey HKLM "SOFTWARE\${product}"
DeleteRegKey HKLM "${controlPanelReg}\${product}"
2011-01-20 03:44:43 +00:00
; delete only the files that we put there
!insertmacro DeleteFiles $INSTDIR
2011-01-20 02:18:48 +00:00
Delete "$INSTDIR\${uninstall}"
; delete (only if empty, so we don't delete user files)
RMDir "$INSTDIR"
SectionEnd