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