xref: /aoo42x/main/sysui/desktop/debian/postinst (revision a2e6ca42)
1#!/bin/sh
2# *************************************************************
3#
4#  Licensed to the Apache Software Foundation (ASF) under one
5#  or more contributor license agreements.  See the NOTICE file
6#  distributed with this work for additional information
7#  regarding copyright ownership.  The ASF licenses this file
8#  to you under the Apache License, Version 2.0 (the
9#  "License"); you may not use this file except in compliance
10#  with the License.  You may obtain a copy of the License at
11#
12#    http://www.apache.org/licenses/LICENSE-2.0
13#
14#  Unless required by applicable law or agreed to in writing,
15#  software distributed under the License is distributed on an
16#  "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
17#  KIND, either express or implied.  See the License for the
18#  specific language governing permissions and limitations
19#  under the License.
20#
21# *************************************************************
22
23if [ "$1" = "configure" ] ; then  # first install
24  # update shared mime-info database
25  if [ -x /usr/bin/update-mime-database ]; then
26    update-mime-database /usr/share/mime
27  fi
28  # update desktop database
29  if [ -x /usr/bin/update-desktop-database ]; then
30    update-desktop-database -q /usr/share/applications
31  fi
32  # update debian style menus
33  if [ -x /usr/bin/update-menus ]; then
34    update-menus
35  fi
36  # update icon-cache if already present
37  for theme in gnome hicolor locolor; do
38    if [ -e /usr/share/icons/$theme/icon-theme.cache ] ; then
39      # touch it, just in case we cannot find the binary...
40      touch /usr/share/icons/$theme
41      if (which gtk-update-icon-cache); then
42        gtk-update-icon-cache /usr/share/icons/$theme
43      fi
44      # ignore errors (e.g. when there is a cache, but no index.theme)
45      true
46    fi
47  done
48fi
49
50# update /etc/mime.types
51# backing out existing entries to avoid duplicates
52sed '
53/application\/vnd\.oasis\.opendocument/d
54/application\/vnd\.sun/d
55/application\/vnd\.stardivision/d
56/application\/vnd\.openofficeorg/d
57' /etc/mime.types 2>/dev/null >> /etc/mime.types.tmp$$
58
59# now append our stuff to the temporary file
60cat >> /etc/mime.types.tmp$$ << END
61application/vnd.oasis.opendocument.text	odt
62application/vnd.oasis.opendocument.text-template ott
63application/vnd.oasis.opendocument.text-web oth
64application/vnd.oasis.opendocument.text-master odm
65application/vnd.oasis.opendocument.graphics odg
66application/vnd.oasis.opendocument.graphics-template otg
67application/vnd.oasis.opendocument.presentation odp
68application/vnd.oasis.opendocument.presentation-template otp
69application/vnd.oasis.opendocument.spreadsheet ods
70application/vnd.oasis.opendocument.spreadsheet-template ots
71application/vnd.oasis.opendocument.chart odc
72application/vnd.oasis.opendocument.formula odf
73application/vnd.oasis.opendocument.image odi
74application/vnd.sun.xml.writer sxw
75application/vnd.sun.xml.writer.template stw
76application/vnd.sun.xml.writer.global sxg
77application/vnd.stardivision.writer sdw vor
78application/vnd.stardivision.writer-global sgl
79application/vnd.sun.xml.calc sxc
80application/vnd.sun.xml.calc.template stc
81application/vnd.stardivision.calc sdc
82application/vnd.stardivision.chart sds
83application/vnd.sun.xml.impress sxi
84application/vnd.sun.xml.impress.template sti
85application/vnd.stardivision.impress sdd sdp
86application/vnd.sun.xml.draw sxd
87application/vnd.sun.xml.draw.template std
88application/vnd.stardivision.draw sda
89application/vnd.sun.xml.math sxm
90application/vnd.stardivision.math smf
91application/vnd.sun.xml.base odb
92application/vnd.openofficeorg.extension oxt
93END
94
95# and replace the original file
96mv -f /etc/mime.types.tmp$$ /etc/mime.types 2>/dev/null
97
98# update /etc/mailcap only at initial install
99if [ "$1" = "configure" ]
100then
101  # backing out existing entries to avoid duplicates
102  sed '
103/^# OpenOffice.org/d
104/^application\/vnd\.oasis\.opendocument/d
105/^application\/vnd\.openofficeorg/d
106/^application\/vnd\.sun/d
107/^application\/vnd\.stardivision/d
108/^application\/vnd\.ms-word/d
109/^application\/vnd\.ms-excel/d
110/^application\/vnd\.ms-powerpoint/d
111/^application\/x-star/d
112/excel/d
113/ms[-]*word/d
114/powerpoint/d
115' /etc/mailcap 2>/dev/null >> /etc/mailcap.tmp$$
116
117  # now append our stuff to the temporary file
118  cat >> /etc/mailcap.tmp$$ << END
119# Apache OpenOffice
120application/vnd.oasis.opendocument.text; %PREFIX -view %s
121application/vnd.oasis.opendocument.text-template; %PREFIX -view %s
122application/vnd.oasis.opendocument.text-web; %PREFIX -view %s
123application/vnd.oasis.opendocument.text-master; %PREFIX -view %s
124application/vnd.sun.xml.writer; %PREFIX -view %s
125application/vnd.sun.xml.writer.template; %PREFIX -view %s
126application/vnd.sun.xml.writer.global; %PREFIX -view %s
127application/vnd.stardivision.writer; %PREFIX -view %s
128application/vnd.stardivision.writer-global; %PREFIX -view %s
129application/x-starwriter; %PREFIX -view %s
130application/vnd.oasis.opendocument.formula; %PREFIX -view %s
131application/vnd.sun.xml.math; %PREFIX -view %s
132application/vnd.stardivision.math; %PREFIX -view %s
133application/x-starmath; %PREFIX -view %s
134application/msword; %PREFIX -view %s
135application/vnd.oasis.opendocument.spreadsheet; %PREFIX -view %s
136application/vnd.oasis.opendocument.spreadsheet-template; %PREFIX -view %s
137application/vnd.sun.xml.calc; %PREFIX -view %s
138application/vnd.sun.xml.calc.template; %PREFIX -view %s
139application/vnd.stardivision.calc; %PREFIX -view %s
140application/x-starcalc; %PREFIX -view %s
141application/vnd.stardivision.chart; %PREFIX -view %s
142application/x-starchart; %PREFIX -view %s
143application/excel; %PREFIX -view %s
144application/msexcel; %PREFIX -view %s
145application/vnd.ms-excel; %PREFIX -view %s
146application/x-msexcel; %PREFIX -view %s
147application/vnd.oasis.opendocument.presentation; %PREFIX -view %s
148application/vnd.oasis.opendocument.presentation-template; %PREFIX -view %s
149application/vnd.sun.xml.impress; %PREFIX -view %s
150application/vnd.sun.xml.impress.template; %PREFIX -view %s
151application/vnd.stardivision.impress; %PREFIX -view %s
152application/x-starimpress; %PREFIX -view %s
153application/powerpoint; %PREFIX -view %s
154application/mspowerpoint; %PREFIX -view %s
155application/vnd.ms-powerpoint; %PREFIX -view %s
156application/x-mspowerpoint; %PREFIX -view %s
157application/vnd.oasis.opendocument.graphics; %PREFIX -view %s
158application/vnd.oasis.opendocument.graphics-template; %PREFIX -view %s
159application/vnd.sun.xml.draw; %PREFIX -view %s
160application/vnd.sun.xml.draw.template; %PREFIX -view %s
161application/vnd.stardivision.draw; %PREFIX -view %s
162application/x-stardraw; %PREFIX -view %s
163application/vnd.oasis.opendocument.database; %PREFIX -view %s
164application/vnd.sun.xml.base; %PREFIX -view %s
165application/wordperfect5.1; %PREFIX -view %s
166application/x-wordperfect; %PREFIX -view %s
167application/wordperfect; %PREFIX -view %s
168application/wpwin; %PREFIX -view %s
169application/vnd.openofficeorg.extension; %PREFIX %s
170END
171
172  # and replace the original file
173  mv -f /etc/mailcap.tmp$$ /etc/mailcap
174fi
175
176exit 0
177