|
| 1 | +Name "ssh-sync Installer" |
| 2 | +OutFile "ssh-sync-installer.exe" |
| 3 | +InstallDir "$LOCALAPPDATA\ssh-sync" |
| 4 | + |
| 5 | +RequestExecutionLevel user |
| 6 | + |
| 7 | +; InstallDirRegKey HKLM "Software\ssh-sync" "Install_Dir" |
| 8 | + |
| 9 | +Section "ssh-sync (required)" |
| 10 | + SectionIn RO |
| 11 | + |
| 12 | + ; Set output path to the installation directory. |
| 13 | + SetOutPath $INSTDIR |
| 14 | + |
| 15 | + ; Put file there (you can add more File lines too) |
| 16 | + File "ssh-sync.exe" |
| 17 | + ; Wildcards are allowed: |
| 18 | + ; File *.dll |
| 19 | + ; To add a folder named MYFOLDER and all files in it recursively, use this EXACT syntax: |
| 20 | + ; File /r MYFOLDER\*.* |
| 21 | + ; See: https://nsis.sourceforge.io/Reference/File |
| 22 | + ; MAKE SURE YOU PUT ALL THE FILES HERE IN THE UNINSTALLER TOO |
| 23 | + |
| 24 | + ; Write the installation path into the registry |
| 25 | + ; WriteRegStr HKLM SOFTWARE\ssh-sync "Install_Dir" "$INSTDIR" |
| 26 | + |
| 27 | + ; Write the uninstall keys for Windows |
| 28 | + ; WriteRegStr HKLM "Software\Microsoft\Windows\CurrentVersion\Uninstall\ssh-sync" "DisplayName" "ssh-sync" |
| 29 | + ; WriteRegStr HKLM "Software\Microsoft\Windows\CurrentVersion\Uninstall\ssh-sync" "UninstallString" '"$INSTDIR\uninstall.exe"' |
| 30 | + ; WriteRegDWORD HKLM "Software\Microsoft\Windows\CurrentVersion\Uninstall\ssh-sync" "NoModify" 1 |
| 31 | + ; WriteRegDWORD HKLM "Software\Microsoft\Windows\CurrentVersion\Uninstall\ssh-sync" "NoRepair" 1 |
| 32 | + WriteUninstaller "$INSTDIR\uninstall.exe" |
| 33 | +SectionEnd |
| 34 | + |
| 35 | +Section "Post Installation" |
| 36 | + EnVar::Check "PATH" "$INSTDIR" |
| 37 | + Pop $0 |
| 38 | + StrCmp $0 "0" +2 |
| 39 | + EnVar::AddValue "PATH" "$INSTDIR" |
| 40 | +SectionEnd |
| 41 | + |
| 42 | +Section "Uninstall" |
| 43 | + |
| 44 | + ; Remove registry keys |
| 45 | + ; DeleteRegKey HKLM "Software\Microsoft\Windows\CurrentVersion\Uninstall\ssh-sync" |
| 46 | + ; DeleteRegKey HKLM SOFTWARE\ssh-sync |
| 47 | + |
| 48 | + ; Remove files and uninstaller |
| 49 | + ; MAKE SURE NOT TO USE A WILDCARD. IF A |
| 50 | + ; USER CHOOSES A STUPID INSTALL DIRECTORY, |
| 51 | + ; YOU'LL WIPE OUT OTHER FILES TOO |
| 52 | + Delete $INSTDIR\ssh-sync.exe |
| 53 | + Delete $INSTDIR\uninstall.exe |
| 54 | + |
| 55 | + ; Remove shortcuts, if any |
| 56 | + ; Delete "$SMPROGRAMS\ssh-sync\*.*" |
| 57 | + |
| 58 | + ; Remove directories used (only deletes empty dirs) |
| 59 | + RMDir "$SMPROGRAMS\ssh-sync" |
| 60 | + RMDir "$INSTDIR" |
| 61 | + |
| 62 | + ; Remove from path |
| 63 | + EnVar::DeleteValue "PATH" "$INSTDIR" |
| 64 | +SectionEnd |
0 commit comments