-
-
Notifications
You must be signed in to change notification settings - Fork 52
/
makeMsi.sh
executable file
·201 lines (183 loc) · 6.46 KB
/
makeMsi.sh
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
# Build an MSI installer from a compiled Minsky
# Must be run from the toplevel directory of Minsky
PATH=$PATH:/c/cygwin/bin
productId=`uuidgen`
componentId=`uuidgen`
version=`cut -f3 -d' ' minskyVersion.h|head -1|tr -d '"'`
if [ $version = 'unknown' ]; then
version=1.1.1
fi
minskyWxs=`pwd`/minsky.wxs
# determine release or beta depending on the number of fields separated by '-' in the version string
numFields=`echo $version|tr - ' '|wc -w`
if [ $numFields -le 1 ]; then
msiVersion=$version
if [ -f gui-tk/libravel.dll ]; then
upgradeId=a39ca2a9-a0e7-4dec-a0db-ae954d11a929
productName=Ravel
license=ravelLicense.rtf
else
upgradeId=01a8458a-5fb5-49e6-a459-531a16e2ea01
productName=Minsky
license=license_.rtf
fi
else
# remove last digit, and add in beta
betaNo=${version##*.}
# add 1000 for release candidates
if [ ${version##*-} = rc.$betaNo ]; then
betaNo=$[$betaNo+1000]
fi
msiVersion=${version%.*-*}.$betaNo
if [ -f gui-tk/libravel.dll ]; then
upgradeId=66649e83-9109-4566-9dbe-68cc6a0ceea0
productName=RavelBeta
license=ravelLicense.rtf
else
upgradeId=cba7e03a-c692-400d-9c75-2da0307c3efc
productName=MinskyBeta
license=license_.rtf
fi
fi
echo $productName: version=$version, msiVersion=$msiVersion
cat >$minskyWxs <<EOF
<?xml version='1.0' encoding='windows-1252'?>
<Wix xmlns='http://schemas.microsoft.com/wix/2006/wi'>
<Product Name='$productName' Id='$productId' UpgradeCode='$upgradeId'
Language='1033' Codepage='1252' Version='$msiVersion' Manufacturer='High Performance Coders'>
<Package Id='*' Keywords='Installer' Description="Minsky's Installer"
Comments='Minsky is copyright Steve Keen, and licensed under GPL3' Manufacturer='High Performance Coders'
InstallerVersion='100' Languages='1033' Compressed='yes' SummaryCodepage='1252' />
<Upgrade Id='$upgradeId'>
<UpgradeVersion OnlyDetect='no' Property='PREVIOUSFOUND'
Minimum='0.0.0' IncludeMinimum='yes'
Maximum='100.0.0' IncludeMaximum='no' />
</Upgrade>
<InstallExecuteSequence>
<RemoveExistingProducts Before='InstallInitialize'/>
</InstallExecuteSequence>
<Media Id='1' Cabinet='minsky.cab' EmbedCab='yes'/>
<Directory Id='TARGETDIR' Name='SourceDir'>
<Directory Id='ProgramFilesFolder'>
<Directory Id='Minsky' Name='$productName'>
<Directory Id='INSTALLDIR'>
<Component Id='MinskyFiles' Guid='$componentId' UninstallWhenSuperseded='yes'>
<RemoveFile Id="removePreviousFiles" Name="*" On="install"/>
<File Id='MinskyEXE' Name='minsky.exe' Source='gui-tk/minsky.exe' KeyPath='yes'>
<Shortcut Id="startmenuMinsky" Directory="ProgramMenuDir" Name="$productName" WorkingDirectory='INSTALLDIR' Icon="minsky.exe" IconIndex="0" Advertise="yes">
</Shortcut>
<Shortcut Id="desktopMinsky" Directory="DesktopFolder" Name="$productName" WorkingDirectory='INSTALLDIR' Icon="minsky.exe" IconIndex="0" Advertise="yes" />
</File>
EOF
# TODO - when Ravel 1.1 is released, switch this to ravel, not ravel beta
if [ $productName = "Minsky" -o $productName = "Ravel" -o $productName = "RavelBeta" ]; then
if [ $productName = "Minsky" ]; then
echo "<ProgId Id='MinskyData' Description='Minsky Project File' Icon='MinskyEXE'>" >>$minskyWxs
echo "<Extension Id='mky' ContentType='application/minsky'>" >>$minskyWxs
else
echo "<ProgId Id='RavelData' Description='Ravel Project File' Icon='MinskyEXE'>" >>$minskyWxs
echo "<Extension Id='rvl' ContentType='application/ravel'>" >>$minskyWxs
fi
cat >>$minskyWxs <<EOF
<Verb Id='open' Command='Open' TargetFile='MinskyEXE' Argument='"%1"'/>
</Extension>
</ProgId>
EOF
fi
id=0
fid=0
# add in plain files
pushd RESTService
for i in *.exe; do
if [ -f $i -a ! -d $i ]; then
let fid++
cat >>$minskyWxs <<EOF
<File Id='fid$fid' Source='RESTService/$i' Name='$i' KeyPath='no' />
EOF
fi
done
popd
pushd gui-tk
for i in *.tcl *.dll accountingRules; do
if [ -f $i -a ! -d $i -a $i != "minsky.exe" ]; then
let fid++
cat >>$minskyWxs <<EOF
<File Id='fid$fid' Source='gui-tk/$i' Name='$i' KeyPath='no' />
EOF
fi
done
echo " </Component>">> $minskyWxs
builddir ()
{
dir=${1##*/}
pushd $dir
let d++
echo "<Directory Id='id$d' Name='$dir'>" >>$minskyWxs
# first process files into a single component
j=0
for i in *; do
if [ -f $i ]; then
let fid++
if [ $j -eq 0 ]; then
let id++
echo "<Component Id='id$id' Guid='`uuidgen`'>">>$minskyWxs
echo "<File Id='fid$fid' Source='gui-tk/$1/$i' Name='$i' KeyPath='yes' />">>$minskyWxs
else
echo "<File Id='fid$fid' Source='gui-tk/$1/$i' Name='$i' KeyPath='no' />">>$minskyWxs
fi
let j++
fi
done
if [ $j -gt 0 ]; then
echo "</Component>">>$minskyWxs
fi
# then process subdirectories
for i in *; do
if [ -d $i ]; then
builddir $1/$i
fi
done
echo "</Directory>">>$minskyWxs
popd
}
builddir library
builddir icons
popd
cat >>$minskyWxs <<EOF
</Directory>
</Directory>
</Directory>
<Directory Id="ProgramMenuFolder" Name="Programs">
<Directory Id="ProgramMenuDir" Name="$productName">
<Component Id="ProgramMenuDir" Guid="40e1115c-9edf-4ae9-b4d3-6508f1921f51">
<RemoveFolder Id='ProgramMenuDir' On='uninstall' />
<RegistryValue Root='HKCU' Key='Software\[Manufacturer]\[ProductName]' Type='string' Value='' KeyPath='yes' />
</Component>
</Directory>
</Directory>
<Directory Id="DesktopFolder" Name="Desktop" />
</Directory>
<Feature Id='Complete' Level='1'>
<ComponentRef Id='MinskyFiles' />
<ComponentRef Id='ProgramMenuDir' />
EOF
i=0
while [ $i -lt $id ]; do
let i++
echo "<ComponentRef Id='id$i' />">>$minskyWxs
done
cat >>$minskyWxs <<EOF
</Feature>
<Icon Id="minsky.exe" SourceFile="gui-tk/minsky.exe" />
<UI>
<UIRef Id='WixUI_InstallDir'/>
</UI>
<Property Id="WIXUI_INSTALLDIR" Value="INSTALLDIR"/>
</Product>
</Wix>
EOF
candle minsky.wxs
echo "light minsky.wixobj"
light -ext WixUIExtension -dWixUILicenseRtf=$license minsky.wixobj
signtool sign -t http://timestamp.sectigo.com minsky.msi
mv minsky.msi $productName-$version-win-dist.msi