Project

General

Profile

Download (6.33 KB) Statistics
| Branch: | Tag: | Revision:
1
# Auto-generated by EclipseNSIS Script Wizard
2
# 28.10.2010 13:58:54
3

    
4
# TODO : preserve $INSTDIR/.cdmLibrary from being deleted if the user desides to keep it, or just warn the user.
5
#
6
#  Wiki: http://nsis.sourceforge.net/Main_Page
7
#  see http://nsis.sourceforge.net/Docs/Chapter5.html for Compile Time Command reference
8
#
9

    
10

    
11
Name "EDIT CDM-Server"
12

    
13
# General Symbol Definitions
14
!define /date BUILD_TIMESTAMP "%Y%m%d-%H%M%S"
15
!define REGKEY "SOFTWARE\$(^Name)"
16
!define VERSION ${project.version}
17
!define COMPANY "EDIT - European Distributed Institute of Taxonomy"
18
!define EDIT_PLATFORM "EDIT Platform for Cybertaxonomy"
19
!define URL http://wp5.e-taxonomy.eu/
20
!define URL-EDIT http://www.e-taxonomy.eu/
21

    
22
# Included files
23
!include Sections.nsh
24

    
25
# Files and Folders
26
!define OUT_FOLDER "${project.build.directory}"
27
!define JAR_FILE_NAME "cdm-server-${VERSION}.jar"
28
!define JAR_FILE "${project.build.directory}\${JAR_FILE_NAME}"
29
!define CDMLIBRARY_TEMPLATE "${project.build.directory}\installer\templates\.cdmLibrary"
30

    
31
# Reserved Files
32
ReserveFile "${NSISDIR}\Plugins\StartMenu.dll"
33

    
34
# Variables
35
Var StartMenuGroup
36

    
37
# Installer pages
38
Page license
39
Page directory
40
Page custom StartMenuGroupSelect "" ": Start Menu Folder"
41
Page instfiles
42

    
43
# Installer attributes
44
OutFile "${OUT_FOLDER}\EDIT CDM-Server-${VERSION}-${BUILD_TIMESTAMP}.exe"
45
InstallDir "$PROGRAMFILES\EDIT CDM-Server"
46
CRCCheck on
47
XPStyle on
48
Icon "${NSISDIR}\Contrib\Graphics\Icons\modern-install.ico"
49
ShowInstDetails show
50
AutoCloseWindow false
51
LicenseData ${project.basedir}\LICENSE.TXT
52
VIProductVersion 3.0.0.0
53
VIAddVersionKey ProductName "$(^Name)"
54
VIAddVersionKey ProductVersion "${VERSION}"
55
VIAddVersionKey CompanyName "${COMPANY}"
56
VIAddVersionKey CompanyWebsite "${URL}"
57
VIAddVersionKey FileVersion "${VERSION}"
58
VIAddVersionKey FileDescription ""
59
VIAddVersionKey LegalCopyright ""
60
InstallDirRegKey HKLM "${REGKEY}" Path
61
UninstallIcon "${NSISDIR}\Contrib\Graphics\Icons\modern-uninstall.ico"
62
ShowUninstDetails show
63

    
64
# Installer sections
65
Section -Main SEC0000
66
    SetOutPath $INSTDIR
67
    SetOverwrite on
68
    File /r /x .svn /x *.log /x *.jar program-folder\*
69
    SetOutPath "$INSTDIR\lib"
70
    File ${JAR_FILE}
71
    # last but not least the .cdmLibrary folder unlesses it already exists
72
    SetOverwrite off
73
    SetOutPath $INSTDIR
74
    File /r /x .svn ${CDMLIBRARY_TEMPLATE}
75
    WriteRegStr HKLM "${REGKEY}\Components" Main 1
76
SectionEnd
77

    
78
Section -post SEC0001
79
    WriteRegStr HKLM "${REGKEY}" Path $INSTDIR
80
    WriteRegStr HKLM "${REGKEY}" StartMenuGroup $StartMenuGroup
81
    SetOutPath $INSTDIR
82
    WriteUninstaller $INSTDIR\uninstall.exe
83
    SetOutPath $SMPROGRAMS\$StartMenuGroup
84
    CreateShortcut "$SMPROGRAMS\$StartMenuGroup\Uninstall $(^Name).lnk" $INSTDIR\uninstall.exe
85
    WriteRegStr HKLM "SOFTWARE\Microsoft\Windows\CurrentVersion\Uninstall\$(^Name)" DisplayName "$(^Name)"
86
    WriteRegStr HKLM "SOFTWARE\Microsoft\Windows\CurrentVersion\Uninstall\$(^Name)" DisplayVersion "${VERSION}"
87
    WriteRegStr HKLM "SOFTWARE\Microsoft\Windows\CurrentVersion\Uninstall\$(^Name)" Publisher "${COMPANY}"
88
    WriteRegStr HKLM "SOFTWARE\Microsoft\Windows\CurrentVersion\Uninstall\$(^Name)" URLInfoAbout "${URL}"
89
    WriteRegStr HKLM "SOFTWARE\Microsoft\Windows\CurrentVersion\Uninstall\$(^Name)" DisplayIcon $INSTDIR\uninstall.exe
90
    WriteRegStr HKLM "SOFTWARE\Microsoft\Windows\CurrentVersion\Uninstall\$(^Name)" UninstallString $INSTDIR\uninstall.exe
91
    WriteRegDWORD HKLM "SOFTWARE\Microsoft\Windows\CurrentVersion\Uninstall\$(^Name)" NoModify 1
92
    WriteRegDWORD HKLM "SOFTWARE\Microsoft\Windows\CurrentVersion\Uninstall\$(^Name)" NoRepair 1
93

    
94
    ExecWait '"$INSTDIR\CDMServer.exe" --install "$INSTDIR\etc\CDMServer.conf$\"'
95
    ExecWait '"$INSTDIR\CDMServer.exe" --start "$INSTDIR\etc\CDMServer.conf$\"'
96
SectionEnd
97

    
98
Section -AdditionalIcons  SEC0003
99
  SetOutPath $INSTDIR
100
  WriteIniStr "$INSTDIR\${EDIT_PLATFORM}.url" "InternetShortcut" "URL" "${URL}"
101
  WriteIniStr "$INSTDIR\${COMPANY}.url" "InternetShortcut" "URL" "${URL-EDIT}"
102
  CreateDirectory "$SMPROGRAMS\$(^Name)"
103
  CreateShortCut "$SMPROGRAMS\$(^Name)\${EDIT_PLATFORM}.lnk" "$INSTDIR\${EDIT_PLATFORM}.url"
104
  CreateShortCut "$SMPROGRAMS\$(^Name)\${COMPANY}.lnk" "$INSTDIR\${COMPANY}.url"
105
  CreateShortCut "$SMPROGRAMS\$(^Name)\Uninstall $(^Name).lnk" "$INSTDIR\uninstall.exe"
106
  CreateShortCut "$SMPROGRAMS\$(^Name)\Start $(^Name).lnk" "$INSTDIR\start-service.bat"
107
  CreateShortCut "$SMPROGRAMS\$(^Name)\Stop $(^Name).lnk" "$INSTDIR\stop-service.bat"
108
SectionEnd
109

    
110
# Macro for selecting uninstaller sections
111
!macro SELECT_UNSECTION SECTION_NAME UNSECTION_ID
112
    Push $R0
113
    ReadRegStr $R0 HKLM "${REGKEY}\Components" "${SECTION_NAME}"
114
    StrCmp $R0 1 0 next${UNSECTION_ID}
115
    !insertmacro SelectSection "${UNSECTION_ID}"
116
    GoTo done${UNSECTION_ID}
117
next${UNSECTION_ID}:
118
    !insertmacro UnselectSection "${UNSECTION_ID}"
119
done${UNSECTION_ID}:
120
    Pop $R0
121
!macroend
122

    
123
# Uninstaller sections
124
Section /o -un.Main UNSEC0000
125
    ExecWait '"$INSTDIR\CDMServer.exe" --remove "$INSTDIR\etc\CDMServer.conf$\"'
126
    RmDir /r /REBOOTOK $INSTDIR
127
    DeleteRegValue HKLM "${REGKEY}\Components" Main
128
SectionEnd
129

    
130
Section -un.post UNSEC0001
131
    DeleteRegKey HKLM "SOFTWARE\Microsoft\Windows\CurrentVersion\Uninstall\$(^Name)"
132
    Delete /REBOOTOK "$SMPROGRAMS\$StartMenuGroup\Uninstall $(^Name).lnk"
133
    Delete /REBOOTOK $INSTDIR\uninstall.exe
134
    DeleteRegValue HKLM "${REGKEY}" StartMenuGroup
135
    DeleteRegValue HKLM "${REGKEY}" Path
136
    DeleteRegKey /IfEmpty HKLM "${REGKEY}\Components"
137
    DeleteRegKey /IfEmpty HKLM "${REGKEY}"
138
    RmDir /REBOOTOK $SMPROGRAMS\$StartMenuGroup
139
    RmDir /REBOOTOK $INSTDIR
140
SectionEnd
141

    
142
# Installer functions
143
Function StartMenuGroupSelect
144
    Push $R1
145
    StartMenu::Select /autoadd /text "Select the Start Menu folder in which to create the program's shortcuts:" /lastused $StartMenuGroup "$(^Name)"
146
    Pop $R1
147
    StrCmp $R1 success success
148
    StrCmp $R1 cancel done
149
    MessageBox MB_OK $R1
150
    Goto done
151
success:
152
    Pop $StartMenuGroup
153
done:
154
    Pop $R1
155
FunctionEnd
156

    
157
Function .onInstSuccess
158

    
159
FunctionEnd
160

    
161
Function .onInit
162
    InitPluginsDir
163
FunctionEnd
164

    
165
# Uninstaller functions
166
Function un.onInit
167
    ReadRegStr $INSTDIR HKLM "${REGKEY}" Path
168
    ReadRegStr $StartMenuGroup HKLM "${REGKEY}" StartMenuGroup
169
    !insertmacro SELECT_UNSECTION Main ${UNSEC0000}
170
FunctionEnd
171

    
    (1-1/1)