Welcome to mirror list, hosted at ThFree Co, Russian Federation.

windows_installer.nsi « Windows Installer « tools - github.com/apache/directory-studio.git - Unnamed repository; edit this file 'description' to name the repository.
summaryrefslogtreecommitdiff
blob: d421ad174d4951e40164ed61e2d88921cf06f346 (plain)
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
160
161
162
163
164
165
166
167
168
169
170
171
172
173
174
175
176
177
178
179
180
181
182
183
184
185
186
187
188
189
190
191
192
193
194
195
196
197
198
199
200
201
202
203
204
205
206
207
208
209
210
211
212
213
214
215
216
217
218
219
220
221
222
223
224
225
226
227
228
229
230
231
232
233
#
#  Licensed to the Apache Software Foundation (ASF) under one
#  or more contributor license agreements.  See the NOTICE file
#  distributed with this work for additional information
#  regarding copyright ownership.  The ASF licenses this file
#  to you under the Apache License, Version 2.0 (the
#  "License"); you may not use this file except in compliance
#  with the License.  You may obtain a copy of the License at
#
#    http://www.apache.org/licenses/LICENSE-2.0
#
#  Unless required by applicable law or agreed to in writing,
#  software distributed under the License is distributed on an
#  "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
#  KIND, either express or implied.  See the License for the
#  specific language governing permissions and limitations
#  under the License.
#

#
# Constants and variables
#
    !define Application "Apache Directory Studio"
    !define Version "1.4.0.v20090407"
    !define Icon "utils\studio-installer.ico"
    !define WelcomeImage "utils\welcome_studio.bmp"
    !define HeaderImage "utils\header_studio.bmp"
    !define OutFile "ApacheDirectoryStudio-win32-${Version}.exe"
    !define SourceFolder "release"
    !define INSTDIR_REG_ROOT "HKLM"
    !define INSTDIR_REG_KEY "Software\Microsoft\Windows\CurrentVersion\Uninstall\${Application}"

#
# Modules inclusions
#
    # Modern UI module
    !include "MUI.nsh"
    
    # Uninstall log module
    !include AdvUninstLog.nsh
    
#
# Configuration
#
    # Name of the application
    Name "${Application}"
    
    # Output installer file
    OutFile "${OutFile}"
    
    # Default install directory
    InstallDir "$PROGRAMFILES\${Application}"
    
    # Branding text
    BrandingText "${Application} - ${Version}"

    # Activating XPStyle
    XPStyle on

    # Installer icon
    !define MUI_ICON "${Icon}"
    
    # Uninstaller icon
    !define MUI_UNICON "${Icon}"
    
    # Welcome image
    !define MUI_WELCOMEFINISHPAGE_BITMAP "${WelcomeImage}"
    
    # Activating header image
    !define MUI_HEADERIMAGE
    !define MUI_HEADERIMAGE_BITMAP "${HeaderImage}"

    # Activating small description for the components page
    !define MUI_COMPONENTSPAGE_SMALLDESC
    
    # Activating a confirmation when aborting the installation
    !define MUI_ABORTWARNING
    
    # Unattended uninstallation
    !insertmacro UNATTENDED_UNINSTALL

#
# Pages
#
    #
    # Installer pages
    #
    
    # Welcome page
    !insertmacro MUI_PAGE_WELCOME
    
    # License page
    !insertmacro MUI_PAGE_LICENSE "release\LICENSE.txt"
    
    # Components page
    #!insertmacro MUI_PAGE_COMPONENTS
    
    # Directory page
    #!define MUI_DIRECTORYPAGE_VARIABLE $APPLICATION_HOME_DIR
    !insertmacro MUI_PAGE_DIRECTORY
    
    # Installation page
    !insertmacro MUI_PAGE_INSTFILES
    
    # Finish page
    !insertmacro MUI_PAGE_FINISH
    
    #
    # Uninstaller pages
    #
    
    # Confirmation page
    !insertmacro MUI_UNPAGE_CONFIRM
    
    # Uninstallation page
    !insertmacro MUI_UNPAGE_INSTFILES

#
# Languages (the first one is the default one)
#
    !insertmacro MUI_LANGUAGE "English"
    !insertmacro MUI_LANGUAGE "French"
    !insertmacro MUI_LANGUAGE "German"
    
#
# Functions
#
    # Internationalized strings
    LangString message ${LANG_ENGLISH} "${Application} is already installed.$\n$\nClick 'OK' to remove the previous version$\nor 'Cancel' to cancel this installation."
    LangString message ${LANG_FRENCH} "${Application} est déjà installé.$\n$\nCliquez sur 'OK' pour supprimer la version précédente$\nou sur 'Annuler' pour annuler cette installation."
    LangString message ${LANG_GERMAN} "${Application} ist bereits installiert.$\n$\nKlicke 'OK' um die frühere Version zu entfernen$\noder 'Abbruch' um die Installation abzubrechen."

    # onInit function
    Function .onInit
        # Preventing the window to close automatically at the end of the (un)installation
        SetAutoClose false
    
        # Verifying if the application is already installed
        ReadRegStr $R0 "${INSTDIR_REG_ROOT}" "${INSTDIR_REG_KEY}" "UninstallString"
        StrCmp $R0 "" done
        
        # Getting install location
        ReadRegStr $R1 "${INSTDIR_REG_ROOT}" "SOFTWARE\${Application}" "InstallDir"
        StrCmp $R1 "" done
    
        # The application is already installed
        # Asking before running the uninstaller
        MessageBox MB_OKCANCEL|MB_ICONEXCLAMATION "$(message)" \
        IDOK uninst
        Abort
      
        # Running the uninstaller
        uninst:
            ExecWait '$R0 _?=$R1'
            
        done:
            # Preparing the uninstall log
            !insertmacro UNINSTALL.LOG_PREPARE_INSTALL
    FunctionEnd

    # onInstSuccess function
    Function .onInstSuccess
         # Updating the uninstall log
         !insertmacro UNINSTALL.LOG_UPDATE_INSTALL
    FunctionEnd
    
    # UN.onInit function
    Function UN.onInit 
         # Begin uninstall
         !insertmacro UNINSTALL.LOG_BEGIN_UNINSTALL
    FunctionEnd

#
# Sections
#
    # Installer section
    Section
        SetOutPath "$INSTDIR"
        
        # Opening uninstall log
        !insertmacro UNINSTALL.LOG_OPEN_INSTALL
        
        # Adding installer source files
        File /r "${SourceFolder}\*"
        
        # Storing install location
        WriteRegStr "${INSTDIR_REG_ROOT}" "SOFTWARE\${Application}" "InstallDir" $INSTDIR

        # Creating directories in the start menu
        CreateDirectory "$SMPROGRAMS\Apache Directory Studio"
        
        # Creating a shortcut to the application
        CreateShortCut "$SMPROGRAMS\Apache Directory Studio\Apache Directory Studio.lnk" "$INSTDIR\Apache Directory Studio.exe" "" "$INSTDIR\Apache Directory Studio.exe" 0
        
        # Creating an internet shortcut to the documentation
        WriteINIStr "$SMPROGRAMS\Apache Directory Studio\Documentation.url" "InternetShortcut" "URL" "http://directory.apache.org/studio/users-guide.html"

        # Configuring registries for the uninstaller
        WriteRegStr "${INSTDIR_REG_ROOT}" "${INSTDIR_REG_KEY}" "DisplayName" "${Application} - (remove only)"
        WriteRegStr "${INSTDIR_REG_ROOT}" "${INSTDIR_REG_KEY}" "DisplayIcon" "$INSTDIR\uninstall.exe"
        WriteRegStr "${INSTDIR_REG_ROOT}" "${INSTDIR_REG_KEY}" "UninstallString" '"$INSTDIR\uninstall.exe"'
        WriteRegDWORD "${INSTDIR_REG_ROOT}" "${INSTDIR_REG_KEY}" "NoModify" "1"
        WriteRegDWORD "${INSTDIR_REG_ROOT}" "${INSTDIR_REG_KEY}" "NoRepair" "1"

        # Creating the uninstaller
        WriteUninstaller "$INSTDIR\Uninstall.exe"
        
        # Creating a shortcut to the uninstaller
        CreateShortCut "$SMPROGRAMS\Apache Directory Studio\Uninstall.lnk" "$INSTDIR\Uninstall.exe" "" "$INSTDIR\Uninstall.exe" 0
        
        # Closing uninstall log
        !insertmacro UNINSTALL.LOG_CLOSE_INSTALL
    SectionEnd
    
    # Uninstaller section
    Section Uninstall
        # Removing installed files (one line per directory is mandatory)
        !insertmacro UNINSTALL.LOG_UNINSTALL "$INSTDIR"
        !insertmacro UNINSTALL.LOG_UNINSTALL "$INSTDIR\configuration"
        !insertmacro UNINSTALL.LOG_UNINSTALL "$INSTDIR\plugins"
        !insertmacro UNINSTALL.LOG_UNINSTALL "$INSTDIR\features"
        Delete "$INSTDIR\Uninstall.exe"
         
        # Finishing uninstall
        !insertmacro UNINSTALL.LOG_END_UNINSTALL
        
        # Remove shortcuts and folders in the start menu
        RMDir /r "$SMPROGRAMS\Apache Directory Studio"
        
        # Removing registry keys
        DeleteRegKey "${INSTDIR_REG_ROOT}" "${INSTDIR_REG_KEY}"
        DeleteRegKey "${INSTDIR_REG_ROOT}" "SOFTWARE\${Application}" "InstallDir"
    SectionEnd