-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathinstaller.nsi
145 lines (128 loc) · 5.13 KB
/
installer.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
!include "FileFunc.nsh"
!include "LogicLib.nsh"
!include "MUI2.nsh"
RequestExecutionLevel admin
InstallDir "$PROGRAMFILES\Gaiascape"
#LicenseData "license.txt"
Name "Gaiascape"
Icon "media\icon.ico"
OutFile "Gaiascape-setup.exe"
!insertmacro MUI_PAGE_DIRECTORY
!insertmacro MUI_PAGE_INSTFILES
!insertmacro MUI_UNPAGE_CONFIRM
!insertmacro MUI_UNPAGE_INSTFILES
#Page license
#Page directory
#Page instfiles
!define APPNAME "Gaiascape"
!define DESCRIPTION "A short description goes here"
!macro VerifyUserIsAdmin
UserInfo::GetAccountType
pop $0
${If} $0 != "admin" ;Require admin rights on NT4+
MessageBox mb_iconstop "Administrator rights required!"
SetErrorLevel 740 ;ERROR_ELEVATION_REQUIRED
Quit
${EndIf}
!macroend
Function .onInit
SetShellVarContext all
!insertmacro VerifyUserIsAdmin
FunctionEnd
Section "install"
# Copy files...
SetOutPath $INSTDIR
File Gaiascape.exe
File lib\libgcc_s_dw2-1.dll
File lib\libstdc++-6.dll
File lib\libwinpthread-1.dll
File C:\Qt\4.8.6\bin\QtCore4.dll
File C:\Qt\4.8.6\bin\QtGui4.dll
File C:\Qt\4.8.6\bin\QtOpenGL4.dll
File lib\OgreMain.dll
File lib\OgrePaging.dll
File lib\OgreTerrain.dll
File lib\libboost_date_time-mgw48-mt-1_60.dll
File lib\libboost_system-mgw48-mt-1_60.dll
File lib\libboost_thread-mgw48-mt-1_60.dll
File media\icon.ico
File plugins.cfg
SetOutPath $INSTDIR\plugins
File plugins\RenderSystem_GL.dll
File plugins\Plugin_CgProgramManager.dll
File plugins\cg.dll
SetOutPath $INSTDIR\media\models
File media\models\sphere.mesh
SetOutPath $INSTDIR\media\textures
File media\textures\clouds.jpg
File media\textures\terrain.png
SetOutPath $INSTDIR\media\textures\nvidia
File media\textures\nvidia\dirt_grayrocky_diffusespecular.dds
File media\textures\nvidia\dirt_grayrocky_normalheight.dds
File media\textures\nvidia\grass_green-01_diffusespecular.dds
File media\textures\nvidia\grass_green-01_normalheight.dds
File media\textures\nvidia\growth_weirdfungus-03_diffusespecular.dds
File media\textures\nvidia\growth_weirdfungus-03_normalheight.dds
File media\textures\nvidia\TextureUsageAgreement.txt
# Create shortcuts and uninstaller
SetOutPath "$INSTDIR"
CreateShortCut "$SMPROGRAMS\Gaiascape.lnk" "$INSTDIR\Gaiascape.exe"
WriteUninstaller $INSTDIR\uninstaller.exe
# Write registry settings to add the program to the Add/Remove programs list in the Windows control panel
WriteRegStr HKLM "Software\Microsoft\Windows\CurrentVersion\Uninstall\${APPNAME}" "DisplayName" "${APPNAME}"
WriteRegStr HKLM "Software\Microsoft\Windows\CurrentVersion\Uninstall\${APPNAME}" "UninstallString" "$\"$INSTDIR\uninstaller.exe$\""
WriteRegStr HKLM "Software\Microsoft\Windows\CurrentVersion\Uninstall\${APPNAME}" "QuietUninstallString" "$\"$INSTDIR\uninstaller.exe$\" /S"
WriteRegStr HKLM "Software\Microsoft\Windows\CurrentVersion\Uninstall\${APPNAME}" "InstallLocation" "$\"$INSTDIR$\""
WriteRegStr HKLM "Software\Microsoft\Windows\CurrentVersion\Uninstall\${APPNAME}" "DisplayIcon" "$\"$INSTDIR\icon.ico$\""
${GetSize} "$INSTDIR" "/S=0K" $0 $1 $2
IntFmt $0 "0x%08X" $0
WriteRegDWORD HKLM "Software\Microsoft\Windows\CurrentVersion\Uninstall\${APPNAME}" "EstimatedSize" "$0"
SectionEnd
# Uninstaller
function un.onInit
SetShellVarContext all
#Verify the uninstaller - last chance to back out
MessageBox MB_OKCANCEL "Permanantly remove ${APPNAME}?" IDOK next
Abort
next:
!insertmacro VerifyUserIsAdmin
functionEnd
Section "uninstall"
Delete $INSTDIR\Gaiascape.exe
Delete $INSTDIR\libgcc_s_dw2-1.dll
Delete $INSTDIR\libstdc++-6.dll
Delete $INSTDIR\libwinpthread-1.dll
Delete $INSTDIR\QtCore4.dll
Delete $INSTDIR\QtGui4.dll
Delete $INSTDIR\QtOpenGL4.dll
Delete $INSTDIR\OgreMain.dll
Delete $INSTDIR\OgrePaging.dll
Delete $INSTDIR\OgreTerrain.dll
Delete $INSTDIR\libboost_date_time-mgw48-mt-1_60.dll
Delete $INSTDIR\libboost_thread-mgw48-mt-1_60.dll
Delete $INSTDIR\libboost_system-mgw48-mt-1_60.dll
Delete $INSTDIR\icon.ico
Delete $INSTDIR\plugins.cfg
Delete $INSTDIR\Plugins\RenderSystem_GL.dll
Delete $INSTDIR\Plugins\Plugin_CgProgramManager.dll
Delete $INSTDIR\Plugins\cg.dll
Delete $INSTDIR\media\models\sphere.mesh
Delete $INSTDIR\media\textures\clouds.jpg
Delete $INSTDIR\media\textures\terrain.png
Delete $INSTDIR\media\textures\nvidia\dirt_grayrocky_diffusespecular.dds
Delete $INSTDIR\media\textures\nvidia\dirt_grayrocky_normalheight.dds
Delete $INSTDIR\media\textures\nvidia\grass_green-01_diffusespecular.dds
Delete $INSTDIR\media\textures\nvidia\grass_green-01_normalheight.dds
Delete $INSTDIR\media\textures\nvidia\growth_weirdfungus-03_diffusespecular.dds
Delete $INSTDIR\media\textures\nvidia\growth_weirdfungus-03_normalheight.dds
Delete $INSTDIR\media\textures\nvidia\TextureUsageAgreement.txt
Delete $SMPROGRAMS\Gaiascape.lnk
RmDir $INSTDIR\media\textures\nvidia
RmDir $INSTDIR\media\textures
RmDir $INSTDIR\media\models
Rmdir $INSTDIR\media
RmDir $INSTDIR\plugins
Delete $INSTDIR\uninstaller.exe
RmDir $INSTDIR
DeleteRegKey HKLM "Software\Microsoft\Windows\CurrentVersion\Uninstall\${APPNAME}"
SectionEnd