Skip to content

Commit

Permalink
Update syncthing.nsi
Browse files Browse the repository at this point in the history
Add uninstaller
  • Loading branch information
codabrink committed Jan 5, 2019
1 parent e857844 commit 9d49b1c
Showing 1 changed file with 21 additions and 0 deletions.
21 changes: 21 additions & 0 deletions syncthing.nsi
Original file line number Diff line number Diff line change
@@ -1,13 +1,34 @@
!include "nsProcess.nsh"

Name "Syncthing"
OutFile "Syncthing Installer.exe"
SetCompressor /FINAL lzma
Icon "${NSISDIR}\Contrib\Graphics\Icons\orange-install.ico"
SilentInstall silent

!define APPNAME "Syncthing"
!define APPREGNAME "Syncthing"

Section ""
SetOutPath $APPDATA\Syncthing
File syncthing.exe

CreateShortCut "$SMSTARTUP\Syncthing.lnk" "$APPDATA\Syncthing\syncthing.exe" "-no-console"
ExecShell "" "$SMSTARTUP\Syncthing.lnk"

WriteRegStr HKLM "Software\Microsoft\Windows\CurrentVersion\Uninstall\${APPREGNAME}" "DisplayName" "${APPNAME}"
WriteRegStr HKLM "Software\Microsoft\Windows\CurrentVersion\Uninstall\${APPREGNAME}" "UninstallString" '"$APPDATA\Syncthing\uninstall.exe"'
WriteRegStr HKLM "Software\Microsoft\Windows\CurrentVersion\Uninstall\${APPREGNAME}" "DisplayIcon" '"$APPDATA\Syncthing\Syncthing.exe"'
WriteRegDWORD HKLM "Software\Microsoft\Windows\CurrentVersion\Uninstall\${APPREGNAME}" "NoModify" 1
WriteRegDWORD HKLM "Software\Microsoft\Windows\CurrentVersion\Uninstall\${APPREGNAME}" "NoRepair" 1
WriteUninstaller "$APPDATA\Syncthing\uninstall.exe"
SectionEnd

Section "Uninstall"
${nsProcess::KillProcess} "Syncthing.exe" $R0

Delete "$SMSTARTUP\Syncthing.lnk"
RMDir /r "$APPDATA\Syncthing"

DeleteRegKey HKLM "Software\Microsoft\Windows\CurrentVersion\Uninstall\${APPREGNAME}"
SectionEnd

0 comments on commit 9d49b1c

Please sign in to comment.