-
Notifications
You must be signed in to change notification settings - Fork 139
/
syncthing-gtk-full.nsis
85 lines (76 loc) · 2.72 KB
/
syncthing-gtk-full.nsis
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
# Required plugins: NSISdl, ZipDLL, FindProcDLL (by hnedka)
## Initial stuff
!include MUI2.nsh
!define APP_NAME SyncthingGTK
!define MUI_FINISHPAGE_RUN "$INSTDIR\syncthing-gtk.exe"
!include "build\version.nsh"
OutFile "${APP_NAME}-${VERSION}-full-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 everything
File /r build\exe.win32-2.7\*
# 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