1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 36 37 38 39 40 41 42 43 44 45 46 47 48 49 50 51 52 53 54 55 56 57 58 59 60 61 62 63 64 65 66 67 68 69 70 71 72 73 74 75 76 77 78 79 80 81 82 83 84 85 86 87 88 89 90 91 92 93 94 95 96 97 98
|
# Required plugins: NSISdl, ZipDLL, FindProcDLL (by hnedka)
# Initial stuff
!include MUI2.nsh
!define APP_NAME SyncthingGTK
!define LIBRARIES_FILE "syncthing-gtk-windows-libraries-0.8.2.zip"
!define LIBRARIES_URL "http://kozec.com/${LIBRARIES_FILE}"
!define MUI_FINISHPAGE_RUN "$INSTDIR\syncthing-gtk.exe"
!include "build\version.nsh"
OutFile "${APP_NAME}-${VERSION}-installer.exe"
InstallDir $PROGRAMFILES\${APP_NAME}
Name "Syncthing-GTK"
!insertmacro MUI_PAGE_WELCOME
!insertmacro MUI_PAGE_DIRECTORY
!insertmacro MUI_PAGE_INSTFILES
!insertmacro MUI_PAGE_FINISH
!insertmacro MUI_UNPAGE_CONFIRM
!insertmacro MUI_UNPAGE_INSTFILES
!insertmacro MUI_UNPAGE_FINISH
!insertmacro MUI_LANGUAGE "English"
!macro ExitST-GTK
push $1
ReadRegStr $1 HKCU SOFTWARE\${APP_NAME} 'InstallPath'
DetailPrint "Asking Syncthing-GTK to quit..."
ExecWait "$1\syncthing-gtk.exe --quit"
FindProcDLL::WaitProcEnd "syncthing-gtk.exe" -1
pop $1
!macroend
# Install
Section
# Check if app is already running
FindProcDLL::FindProc "syncthing-gtk.exe"
IntCmp $R0 1 0 NotRunning
!insertmacro ExitST-GTK
NotRunning:
# Set output path
SetOutPath $INSTDIR
# Install good stuff
File build\exe.win32-2.7\syncthing-gtk.exe
File build\exe.win32-2.7\syncthing-gtk-console.exe
File build\exe.win32-2.7\library.zip
File build\exe.win32-2.7\*.glade
File build\exe.win32-2.7\__version__
File /r build\exe.win32-2.7\icons
# Check if random file that should be part of libraries zip exists
# and download&extract zip if not
IfFileExists $INSTDIR\share\locale\vi\LC_MESSAGES\gtk30.mo SkipDownload DoDownload
DoDownload:
NSISdl::download ${LIBRARIES_URL} $TEMP\${LIBRARIES_FILE}
ZipDLL::extractall $TEMP\${LIBRARIES_FILE} $INSTDIR
SkipDownload:
# Write out installation location
WriteRegStr HKCU SOFTWARE\${APP_NAME} 'InstallPath' '$INSTDIR'
# Create shortcut
SetShellVarContext all
CreateShortCut "$SMPROGRAMS\Syncthing GTK.lnk" "$INSTDIR\syncthing-gtk.exe" ""
# Create uninstaller
WriteUninstaller $INSTDIR\uninstaller.exe
WriteRegStr HKLM "Software\Microsoft\Windows\CurrentVersion\Uninstall\SyncthingGTK" \
"DisplayName" "Syncthing GTK"
WriteRegStr HKLM "Software\Microsoft\Windows\CurrentVersion\Uninstall\SyncthingGTK" \
"UninstallString" "$INSTDIR\uninstaller.exe"
WriteRegStr HKLM "Software\Microsoft\Windows\CurrentVersion\Uninstall\SyncthingGTK" \
"DisplayIcon" "$INSTDIR\uninstaller.exe"
WriteRegStr HKLM "Software\Microsoft\Windows\CurrentVersion\Uninstall\SyncthingGTK" \
"Publisher" "Kozec"
WriteRegStr HKLM "Software\Microsoft\Windows\CurrentVersion\Uninstall\SyncthingGTK" \
"URLInfoAbout" "https://github.com/kozec/syncthing-gui/"
WriteRegDWORD HKLM "Software\Microsoft\Windows\CurrentVersion\Uninstall\SyncthingGTK" \
"NoRepair" 1
WriteRegDWORD HKLM "Software\Microsoft\Windows\CurrentVersion\Uninstall\SyncthingGTK" \
"NoModify" 1
WriteRegStr HKLM "Software\Microsoft\Windows\CurrentVersion\Uninstall\SyncthingGTK" \
"DisplayIcon" "$INSTDIR\icons\st-logo-128.ico"
SectionEnd
# Uninstall
Section "Uninstall"
FindProcDLL::FindProc "syncthing-gtk.exe"
IntCmp $R0 1 0 NotRunning
!insertmacro ExitST-GTK
NotRunning:
# Remove files
Delete $INSTDIR\uninstaller.exe
Delete $INSTDIR\*
RMDir /r $INSTDIR
# Remove shortcut
SetShellVarContext all
Delete "$SMPROGRAMS\Syncthing GTK.lnk"
# Remove uninstall entry
DeleteRegKey HKLM "Software\Microsoft\Windows\CurrentVersion\Uninstall\SyncthingGTK"
SectionEnd
|