blob: e57427d0354e147eceb4f48abe3488c884c6c35c (
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
234
235
236
237
238
239
240
241
242
243
244
245
246
247
248
249
250
251
252
253
254
255
256
257
258
259
260
261
262
263
264
265
266
267
268
269
270
271
272
273
274
275
276
277
278
279
280
281
282
|
post_install() {
echo "Creating menus and file associations, please wait..."
# set variable to configure the actions of the postinst-script from codeweavers
action="configure"
oldver=""
# -- start of code from codeweavers postinst script --
CX_ROOT="/opt/cxoffice"
export CX_ROOT
if [ "$mode" = "install" ]
then
if [ -z "$CX_PRODUCT_ID" ]
then
CX_PRODUCT_ID="cxoffice"
fi
elif [ -f "$CX_ROOT/.productid" ]
then
CX_PRODUCT_ID=`cat "$CX_ROOT/.productid"`
else
CX_PRODUCT_ID="cxoffice"
fi
productid="$CX_PRODUCT_ID"
package="deb:$DPKG_MAINTSCRIPT_PACKAGE"
if [ "$action" = "configure" ]
then
if [ -n "$oldver" -o -f "$CX_ROOT/etc/$productid.conf" ]
then
mode="upgrade"
else
mode="install"
fi
# This script expects package, CX_ROOT, productid, mode and oldver to be set
builtin_product_id="cxoffice"
if [ "$mode" = "install" ]
then
if [ "$productid" != "$builtin_product_id" ]
then
echo "$productid" >"$CX_ROOT/.productid"
else
rm -f "$CX_ROOT/.productid"
fi
fi
uid=`perl -e 'print $>'`
unset HOME
# These files are no longer needed (were used by version 4.x)
if [ "$uid" = "0" -a -f "/sbin/conf.d/SuSEconfig.zz$productid-vfolders" ]
then
rm -f "/sbin/conf.d/SuSEconfig.zz$productid-vfolders"
fi
rm -f "$CX_ROOT/lib/xml/libperl.so.5.8"
# Icons have moved to share/icons
rm -f "$CX_ROOT"/support/*.png
# We don't need the 2007 DST bottle hook anymore
rm -f "$CX_ROOT"/support/scripts.d/??.dst2007patch
rmdir "$CX_ROOT"/support/scripts.d 2>/dev/null || true
# Try to set up the security context if possible (especially for Fedora).
# Do so before potentially trying to upgrade bottles.
setup_selinux()
{
# Note that this may or may not work depending on obscure system settings.
# So try chcon on the landmark file and don't abort if that fails.
if chcon system_u:object_r:bin_t:s0 "$CX_ROOT"/bin/cxmenu
then
( cd "$CX_ROOT"/bin && find * -type d -prune -o -type f \
-exec chcon system_u:object_r:bin_t:s0 {} \; )
( cd "$CX_ROOT"/lib && find * -type d -prune -o -type f \
-exec chcon system_u:object_r:lib_t:s0 {} \; )
if chcon system_u:object_r:wine_exec_t:s0 "$CX_ROOT"/bin/wine-preloader
then
chcon system_u:object_r:wine_exec_t:s0 "$CX_ROOT"/bin/wineloader
fi
if chcon system_u:object_r:textrel_shlib_t:s0 "$CX_ROOT"/lib/wine/ntdll.dll.so
then
setype="textrel_shlib_t"
else
setype="lib_t"
fi
( cd "$CX_ROOT"/lib/wine && find * -type d -prune -o -type f \
-exec chcon system_u:object_r:$setype:s0 {} \; )
fi
}
if [ -z "$CX_LOG" ]
then
setup_selinux 2>/dev/null
else
setup_selinux
fi
# Update wineserver symlink as appropriate
if [ -L "$CX_ROOT/bin/wineserver" ]
then
rm "$CX_ROOT/bin/wineserver"
if "$CX_ROOT/bin/wineserver64" -v >/dev/null 2>/dev/null
then
ln -s wineserver64 "$CX_ROOT/bin/wineserver"
else
ln -s wineserver32 "$CX_ROOT/bin/wineserver"
fi
fi
# Create or upgrade the configuration file and more
if [ -f "$CX_ROOT/.uninstalled" ]
then
rm -f "$CX_ROOT/.uninstalled"
install_bottles="--install-bottles"
else
install_bottles=""
fi
# Replace '/usr/bin/perl' in all the perl scripts with '/app/bin/perl' for Flatpak
if [ -n "$CX_FLATPAK_ID" ]
then
sed -i 's/\/usr\/bin\/perl/\/app\/bin\/perl/' `grep -Ril /usr/bin/perl $CX_ROOT`
fi
"$CX_ROOT/lib/cxupgrade" --package "$package" --productid "$productid" --old-version "" $install_bottles
"$CX_ROOT/bin/cxtie" --register
if [ "$mode" = "install" -a "$uid" = "0" ]
then
chmod 0644 "$CX_ROOT/etc/$productid.conf"
fi
fi
# -- end of code from codeweavers postinst script --
echo "Done!"
echo
echo "This is the demo version, to fully activate it you need to obtain a license."
echo "More information about this process here:"
echo "https://www.codeweavers.com/crossover"
}
post_upgrade() {
post_install
}
pre_remove() {
echo "Removing menus and file associations, please wait..."
#/opt/cxoffice/bin/cxmenu --crossover --uninstall
#/opt/cxoffice/bin/cxassoc --crossover --uninstall
# set variable to configure the actions of the prerm-script from codeweavers
action="remove"
# -- start of code from codeweavers prerm script --
CX_ROOT="/opt/cxoffice"
export CX_ROOT
if [ -f "$CX_ROOT/.productid" ]
then
productid=`cat "$CX_ROOT/.productid"`
else
productid="cxoffice"
fi
if [ "$action" = "remove" ]
then
CX_PURGE="desktopdata"
# This script expects CX_ROOT and productid to be set
# Note: this script may also be called in case the installation is aborted
builtin_product_id="cxoffice"
if [ -z "$CX_PURGE" ]
then
CX_PURGE="all"
fi
if [ "$CX_PURGE" = "desktopdata" -o "$CX_PURGE" = "all" ]
then
"$CX_ROOT/bin/cxtie" --unregister
scope="managed"
if [ -x "$CX_ROOT/bin/cxmenu" ]
then
"$CX_ROOT/bin/cxmenu" --removeall --pattern "$productid-" --scope $scope --ignorelist ""
fi
if [ -x "$CX_ROOT/bin/cxassoc" ]
then
"$CX_ROOT/bin/cxassoc" --removeall --pattern "$productid-" --scope $scope --ignorelist ""
fi
rm -f "$CX_ROOT"/share/icons/*.png
fi
rm -f "$CX_ROOT/lib/python"/*.pyc
rm -f "$CX_ROOT/lib/wine/winewrapper.exe.so.bak"
fi
# -- end of code from codeweavers prerm script --
echo "Done!"
}
post_remove() {
echo "Performing additional clean up, please wait..."
# set variable to configure the actions of the postrm-script from codeweavers
action="remove"
# -- start of code from codeweavers postrm script --
CX_ROOT="/opt/cxoffice"
export CX_ROOT
if [ -f "$CX_ROOT/.productid" ]
then
productid=`cat "$CX_ROOT/.productid"`
else
productid="cxoffice"
fi
if [ \( "$action" = "purge" -o "$action" = "remove" \) -a ! -f "$CX_ROOT/bin/cxmenu" ]
then
if [ "$action" = "purge" ]
then
CX_PURGE="all"
else
CX_PURGE="desktopdata"
fi
# We cannot do this bit before because prerm does not know whether
# the administrator is doing a 'dpkg --purge' or a 'dpkg --remove'.
# It does mean we have some extra directories to remove manually.
# This script expects CX_ROOT and productid to be set
if [ -z "$CX_PURGE" ]
then
CX_PURGE="all"
fi
if [ "$CX_PURGE" = "desktopdata" -o "$CX_PURGE" = "all" ]
then
rm -rf "$CX_ROOT"/lib/python/__pycache__
rm -rf "$CX_ROOT"/support/desktopdata
fi
if [ "$CX_PURGE" = "all" ]
then
rm -f "$CX_ROOT/etc/$productid".conf*
rm -f "$CX_ROOT/etc/license.txt" "$CX_ROOT/etc/license.sig"
rm -f "$CX_ROOT"/support/default
rm -rf "$CX_ROOT"/support/installers
rm -f "$CX_ROOT"/.uninstalled
# Delete bottles.
ls -d "$CX_ROOT"/support/*/cxbottle.conf 2>/dev/null | while read bottlefile
do
dir=`dirname "$bottlefile"`
rm -rf "$dir"
done
rmdir "$CX_ROOT"/support 2>/dev/null || true
rm -f "$CX_ROOT/.productid"
elif [ -d "$CX_ROOT" ]
then
touch "$CX_ROOT/.uninstalled"
fi
rmdir "$CX_ROOT/etc" 2>/dev/null || true
rmdir "$CX_ROOT/support" 2>/dev/null || true
rmdir "$CX_ROOT" 2>/dev/null || true
fi
# -- end of code from codeweavers postrm script --
# additional clean up
rmdir "$CX_ROOT"/lib/python
rmdir "$CX_ROOT"/lib
echo "Done!"
}
|