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
  
' 
' $Id$ 
' 
' Companion file to RoxenUI.wxs with custom actions. 
' 
' 2004-11-29 Henrik Grubbström 
' 
 
' At call time the CustomActionData property has been set to [TARGETDIR]. 
' 
' Remove any previously installed service. 
Function RemoveOldService() 
  Dim WshShell, serverdir 
 
  targetdir = Session.Property("CustomActionData") 
 
  Set WshShell = CreateObject("WScript.Shell") 
  WshShell.CurrentDirectory = targetdir 
 
  WshShell.Run """" & targetdir & "ntstart"" --remove", 0, True 
 
  RemoveOldService = 1 
End Function 
 
' Start the Roxen Service. 
' 
' This kludge is needed to delay the start of the service until 
' after COMMIT, which is needed to allow the side-by-side assemblies 
' to complete installation before we try to use them. 
' 
' Why couldn't MS do the senisible thing and have inodes instead of 
' having kludges upon kludges to work around their design bugs? 
' Both side-by-side assemblies and their activation after COMMIT 
' are kludges around the lack of inodes. 
Function StartRoxenService() 
  Dim WshShell 
 
  Set WshShell = CreateObject("WScript.Shell") 
 
  WshShell.Run "NET START RoxenService", 0, True 
 
  StartRoxenService = 1 
End Function 
 
' At call time the CustomActionData property has been set to 
' [SERVERDIR];[MYSQLBASE];[MYSQLDEXE];[MYISAMCHKEXE];[MYSQLADMINEXE]. 
' 
' Creates "[SERVERDIR]mysql-location.txt" with the 
' content "basedir=[MYSQLBASE]" 
'         "mysqld=[MYSQLDEXE]" 
'         "myisamchk=[MYISAMCHKEXE]" 
'         "mysqladmin=[MYSQLADMINEXE]" 
Function CreateMysqlLocation() 
  Dim re, matches, match, fso, tf, serverdir, mysqlbase, mysqld, myisamchk, i 
  Dim rest 
 
  serverdir = "" 
  mysqlbase = "" 
  mysqld = "" 
  myisamchk = "" 
  mysqladmin = "" 
 
  rest = "" 
 
  Set re = New RegExp 
  re.Pattern = "[^;]*" 
  re.Global = True 
  Set matches = re.Execute(Session.Property("CustomActionData")) 
  i = 0 
  For Each match in matches 
    ' NOTE: For some reason we get an empty match after each true match. 
    '       Therefore we only look at the matches where i is even. 
    If i = 0 Then 
      serverdir = match.Value 
    Else 
      If i = 2 Then 
        mysqlbase = match.Value 
      Else 
        If i = 4 Then 
          mysqld = match.Value 
        Else 
          If i = 6 Then 
            myisamchk = match.Value 
          Else 
            If i = 8 Then 
              mysqladmin = match.Value 
            Else 
              rest = rest & ";" & match.Value 
            End If 
          End If 
        End If 
      End If 
    End If 
    i = i + 1 
  Next 
 
  Set fso = CreateObject("Scripting.FileSystemObject") 
 
  Set tf = fso.CreateTextFile(serverdir & "mysql-location.txt", True) 
  tf.writeLine("# Created by $Id$") 
  tf.writeLine("# DEBUG: " & Session.Property("CustomActionData")) 
  tf.writeLine("# DEBUG: " & rest & ";") 
  tf.writeLine("") 
  tf.writeLine("# Configuration file for locating the MySQL installation.") 
  tf.writeLine("") 
  tf.writeLine("# Note that the keys are case-sensitive and must be") 
  tf.writeLine("# provided in lower-case.") 
  tf.writeLine("") 
  tf.writeLine("# basedir is the base directory for the MySQL installation.") 
  tf.writeLine("basedir=" & mysqlbase) 
  tf.writeLine("# mysqld is the full path to the mysqld binary.") 
  If mysqld <> "" Then 
    tf.writeLine("mysqld=" & mysqld) 
  Else 
    tf.writeLine("#mysqld=") 
  End If 
  tf.writeLine("# myisamchk is the full path to the myisamchk binary.") 
  If myisamchk <> "" Then 
    tf.writeLine("myisamchk=" & myisamchk) 
  Else 
    tf.writeLine("#myisamchk=") 
  End If 
  tf.writeLine("# mysqladmin is the full path to the mysqladmin binary.") 
  If mysqladmin <> "" Then 
    tf.writeLine("mysqladmin=" & mysqladmin) 
  Else 
    tf.writeLine("#mysqladmin=") 
  End If 
  tf.Close 
 
  CreateMysqlLocation = 1 
End Function 
 
' At call time the CustomActionData property has been set to [SERVERDIR]. 
' 
' Creates "[SERVERDIR]pikelocation.txt" with the 
' content "[SERVERDIR]pike\bin\pike" 
Function CreatePikeLocation() 
  Dim fso, tf, serverdir 
  Set fso = CreateObject("Scripting.FileSystemObject") 
 
  serverdir = Session.Property("CustomActionData") 
 
  Set tf = fso.CreateTextFile(serverdir & "pikelocation.txt", True) 
  tf.WriteLine(serverdir & "pike\bin\pike") 
  tf.Close 
 
  CreatePikeLocation = 1 
End Function 
 
' At call time the CustomActionData property has been set to 
' [SERVERDIR];[SERVER_NAME];[SERVER_PROTOCOL];[SERVER_PORT];[ADM_USER];[ADM_PASS1] 
' 
' Create a new configinterface. 
Function CreateConfigInterface() 
  Dim re, matches, match, WshShell, serverdir 
  Set re = New RegExp 
  re.Pattern = "[^;]*" 
  re.Global = False 
  Set matches = re.Execute(Session.Property("CustomActionData")) 
  For Each match in matches 
    serverdir = match.Value 
  Next 
 
  Set WshShell = CreateObject("WScript.Shell") 
  WshShell.Run """" & serverdir & "pike\bin\pike"" """ & serverdir &_ 
    "bin\create_configif.pike"" --batch __semicolon_separated__ """ &_ 
    Session.Property("CustomActionData") & """ ok y update n", 0, True 
 
  CreateConfigInterface = 1 
End Function 
 
Function CreateEnvironment() 
  Dim envfile, fso, tf 
  Set fso = CreateObject("Scripting.FileSystemObject") 
 
  envfile = Session.Property("CustomActionData") 
 
  If (Not fso.FileExists(envfile)) Then 
    Set tf = fso.CreateTextFile(envfile, True) 
    tf.WriteLine("[Parameters]") 
    tf.WriteLine("default= ") 
    tf.WriteLine("[Environment]") 
    tf.WriteLine("_JAVA_OPTIONS=-Xmx256M") 
    tf.Close 
  End If 
End Function