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