-
Notifications
You must be signed in to change notification settings - Fork 3
/
package_win32.nsi
161 lines (128 loc) · 4.39 KB
/
package_win32.nsi
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
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
!ifndef MINGW_PATH
!define MINGW_PATH /usr/lib/gcc/i686-w64-mingw32/4.6/
!endif
!ifndef PTHREAD_PATH
!define PTHREAD_PATH /usr/i686-w64-mingw32/lib/
!endif
!ifndef OPENSSL_PATH
!define OPENSSL_PATH /opt/mingw32/mingw32/bin
!endif
!ifndef QT_PATH
!define QT_PATH /media/nib/Windows7_OS/Qt/4.8.4
!endif
# Define the path of the build directory
!ifndef BDIR
!define BDIR "build.w32"
!endif
SetCompressor /FINAL /SOLID lzma
;-------------------
; Include Modern UI
!include "MUI2.nsh"
!define MUI_ICON "./dnc/src/gui/rc/dnc.ico"
!define MUI_UNICON "./dnc/src/gui/rc/dnc.ico"
!define MUI_HEADERIMAGE
!define MUI_HEADERIMAGE_RIGH
!define MUI_HEADERIMAGE_BITMAP "./graphics/Header/orange-r.bmp"
!define MUI_HEADERIMAGE_UNBITMAP "./graphics/Header/orange-uninstall-r.bmp"
!define MUI_WELCOMEFINISHPAGE_BITMAP "./graphics/Wizard/orange.bmp"
!define MUI_UNWELCOMEFINISHPAGE_BITMAP "./graphics/Wizard/orange-uninstall.bmp"
; --------
; General
!include "x64.nsh"
!define /date NOW "%y.%m.%d"
Name "DynVPN Client"
OutFile "${BDIR}/dynvpn-client-${NOW}_x86.exe"
InstallDir $PROGRAMFILES\dynvpn-client
; Ask admin privileges
RequestExecutionLevel admin
ShowInstDetails show
ShowUninstDetails show
;-------
; Pages
; Install
!insertmacro MUI_PAGE_WELCOME
!insertmacro MUI_PAGE_COMPONENTS
!insertmacro MUI_PAGE_DIRECTORY
; Start Menu Folder Page Configuration
Var StartMenuFolder
!define MUI_STARTMENUPAGE_REGISTRY_ROOT "HKCU"
!define MUI_STARTMENUPAGE_REGISTRY_KEY "Software\dnc"
!define MUI_STARTMENUPAGE_REGISTRY_VALUENAME "Start Menu Folder"
!insertmacro MUI_PAGE_STARTMENU Application $StartMenuFolder
!insertmacro MUI_PAGE_INSTFILES
; Uninstall
!insertmacro MUI_UNPAGE_CONFIRM
!insertmacro MUI_UNPAGE_INSTFILES
;-----------
; Languages
!insertmacro MUI_LANGUAGE "English"
;-------------------
; Installer section
Section "DynVPN client" dncExe
setOutPath $INSTDIR
File ${BDIR}/dnc/src/dnc.exe
File udt4/src/libudt.dll
File libconfig-win32/lib/.libs/libconfig-9.dll
File tapcfg-win32/build/tapcfg.dll
File ${MINGW_PATH}/libgcc_s_sjlj-1.dll
File ${MINGW_PATH}/libstdc++-6.dll
File ${MINGW_PATH}/libssp-0.dll
File /usr/i686-w64-mingw32/lib/libwinpthread-1.dll
File ${PTHREAD_PATH}/pthreadGC2.dll
File ${OPENSSL_PATH}/libeay32.dll
File ${OPENSSL_PATH}/ssleay32.dll
File ${QT_PATH}/bin/libgcc_s_dw2-1.dll
File ${QT_PATH}/bin/mingwm10.dll
File ${QT_PATH}/bin/QtCore4.dll
File ${QT_PATH}/bin/QtGui4.dll
File ${QT_PATH}/bin/QtNetwork4.dll
CreateDirectory $INSTDIR\imageformats
setOutPath $INSTDIR\imageformats
File ${QT_PATH}/plugins/imageformats/qgif4.dll
File ${QT_PATH}/plugins/imageformats/qico4.dll
CreateDirectory $APPDATA\dynvpn
; Create uninstaller
WriteUninstaller "$INSTDIR\dnc-uninstall.exe"
!insertmacro MUI_STARTMENU_WRITE_BEGIN Application
CreateDirectory "$SMPROGRAMS\$StartMenuFolder"
CreateShortCut "$DESKTOP\dynvpn-client.lnk" "$INSTDIR\dnc.exe"
CreateShortCut "$SMPROGRAMS\$StartMenuFolder\dynvpn-client.lnk" "$INSTDIR\dnc.exe"
CreateShortCut "$SMPROGRAMS\$StartMenuFolder\dynvpn-client-uninstall.lnk" "$INSTDIR\dnc-uninstall.exe"
!insertmacro MUI_STARTMENU_WRITE_END
; Update icons cache
System::Call 'Shell32::SHChangeNotify(i 0x8000000, i 0, i 0, i 0)'
sectionEnd
Section "TAP Virtual Ethernet Adapter" SecTAP
SetOverwrite on
setOutPath "$TEMP\"
File /r tap-driver-32_64/
DetailPrint "TAP INSTALL (May need confirmation)"
${If} ${RunningX64}
setOutPath "$TEMP\64-bit\"
nsExec::ExecToLog '"deltapall.bat" /S /SELECT_UTILITIES=1'
nsExec::ExecToLog '"addtap.bat" /S /SELECT_UTILITIES=1'
${Else}
setOutPath "$TEMP\32-bit\"
nsExec::ExecToLog '"deltapall.bat" /S /SELECT_UTILITIES=1'
nsExec::ExecToLog '"addtap.bat" /S /SELECT_UTILITIES=1'
${EndIf}
sectionEnd
;---------------------
; Uninstaller section
Section "Uninstall"
Delete "$INSTDIR\imageformats\*"
RMDir "$INSTDIR\imageformats"
Delete "$INSTDIR\*"
RMDir "$INSTDIR"
Delete "$APPDATA\dynvpn\*"
RMDir "$APPDATA\dynvpn"
!insertmacro MUI_STARTMENU_GETFOLDER Application $StartMenuFolder
Delete "$DESKTOP\dynvpn-client.lnk"
Delete "$SMPROGRAMS\$StartMenuFolder\dynvpn-client.lnk"
Delete "$SMPROGRAMS\$StartMenuFolder\dynvpn-client-uninstall.lnk"
RMDir "$SMPROGRAMS\$StartMenuFolder"
StrCpy $2 $INSTDIR "" 3
Delete "$LOCALAPPDATA\VirtualStore\$2\*"
RMDir "$LOCALAPPDATA\VirtualStore\$2"
DeleteRegKey /ifempty HKCU "Software\dnc"
SectionEnd