xref: /aoo42x/main/sysui/desktop/debian/postinst (revision cdf0e10c)
1*cdf0e10cSrcweir#!/bin/sh
2*cdf0e10cSrcweir
3*cdf0e10cSrcweirif [ "$1" = "configure" ] ; then  # first install
4*cdf0e10cSrcweir  # update shared mime-info database
5*cdf0e10cSrcweir  if [ -x /usr/bin/update-mime-database ]; then
6*cdf0e10cSrcweir    update-mime-database /usr/share/mime
7*cdf0e10cSrcweir  fi
8*cdf0e10cSrcweir  # update desktop database
9*cdf0e10cSrcweir  if [ -x /usr/bin/update-desktop-database ]; then
10*cdf0e10cSrcweir    update-desktop-database -q /usr/share/applications
11*cdf0e10cSrcweir  fi
12*cdf0e10cSrcweir  # update debian style menus
13*cdf0e10cSrcweir  if [ -x /usr/bin/update-menus ]; then
14*cdf0e10cSrcweir    update-menus
15*cdf0e10cSrcweir  fi
16*cdf0e10cSrcweir  # update icon-cache if already present
17*cdf0e10cSrcweir  for theme in gnome hicolor locolor; do
18*cdf0e10cSrcweir    if [ -e /usr/share/icons/$theme/icon-theme.cache ] ; then
19*cdf0e10cSrcweir      # touch it, just in case we cannot find the binary...
20*cdf0e10cSrcweir      touch /usr/share/icons/$theme
21*cdf0e10cSrcweir      if (which gtk-update-icon-cache); then
22*cdf0e10cSrcweir        gtk-update-icon-cache /usr/share/icons/$theme
23*cdf0e10cSrcweir      fi
24*cdf0e10cSrcweir      # ignore errors (e.g. when there is a cache, but no index.theme)
25*cdf0e10cSrcweir      true
26*cdf0e10cSrcweir    fi
27*cdf0e10cSrcweir  done
28*cdf0e10cSrcweirfi
29*cdf0e10cSrcweir
30*cdf0e10cSrcweir# update /etc/mime.types
31*cdf0e10cSrcweir# backing out existing entries to avoid duplicates
32*cdf0e10cSrcweirsed '
33*cdf0e10cSrcweir/application\/vnd\.oasis\.opendocument/d
34*cdf0e10cSrcweir/application\/vnd\.sun/d
35*cdf0e10cSrcweir/application\/vnd\.stardivision/d
36*cdf0e10cSrcweir/application\/vnd\.openofficeorg/d
37*cdf0e10cSrcweir' /etc/mime.types 2>/dev/null >> /etc/mime.types.tmp$$
38*cdf0e10cSrcweir
39*cdf0e10cSrcweir# now append our stuff to the temporary file
40*cdf0e10cSrcweircat >> /etc/mime.types.tmp$$ << END
41*cdf0e10cSrcweirapplication/vnd.oasis.opendocument.text	odt
42*cdf0e10cSrcweirapplication/vnd.oasis.opendocument.text-template ott
43*cdf0e10cSrcweirapplication/vnd.oasis.opendocument.text-web oth
44*cdf0e10cSrcweirapplication/vnd.oasis.opendocument.text-master odm
45*cdf0e10cSrcweirapplication/vnd.oasis.opendocument.graphics odg
46*cdf0e10cSrcweirapplication/vnd.oasis.opendocument.graphics-template otg
47*cdf0e10cSrcweirapplication/vnd.oasis.opendocument.presentation odp
48*cdf0e10cSrcweirapplication/vnd.oasis.opendocument.presentation-template otp
49*cdf0e10cSrcweirapplication/vnd.oasis.opendocument.spreadsheet ods
50*cdf0e10cSrcweirapplication/vnd.oasis.opendocument.spreadsheet-template ots
51*cdf0e10cSrcweirapplication/vnd.oasis.opendocument.chart odc
52*cdf0e10cSrcweirapplication/vnd.oasis.opendocument.formula odf
53*cdf0e10cSrcweirapplication/vnd.oasis.opendocument.image odi
54*cdf0e10cSrcweirapplication/vnd.sun.xml.writer sxw
55*cdf0e10cSrcweirapplication/vnd.sun.xml.writer.template stw
56*cdf0e10cSrcweirapplication/vnd.sun.xml.writer.global sxg
57*cdf0e10cSrcweirapplication/vnd.stardivision.writer sdw vor
58*cdf0e10cSrcweirapplication/vnd.stardivision.writer-global sgl
59*cdf0e10cSrcweirapplication/vnd.sun.xml.calc sxc
60*cdf0e10cSrcweirapplication/vnd.sun.xml.calc.template stc
61*cdf0e10cSrcweirapplication/vnd.stardivision.calc sdc
62*cdf0e10cSrcweirapplication/vnd.stardivision.chart sds
63*cdf0e10cSrcweirapplication/vnd.sun.xml.impress sxi
64*cdf0e10cSrcweirapplication/vnd.sun.xml.impress.template sti
65*cdf0e10cSrcweirapplication/vnd.stardivision.impress sdd sdp
66*cdf0e10cSrcweirapplication/vnd.sun.xml.draw sxd
67*cdf0e10cSrcweirapplication/vnd.sun.xml.draw.template std
68*cdf0e10cSrcweirapplication/vnd.stardivision.draw sda
69*cdf0e10cSrcweirapplication/vnd.sun.xml.math sxm
70*cdf0e10cSrcweirapplication/vnd.stardivision.math smf
71*cdf0e10cSrcweirapplication/vnd.sun.xml.base odb
72*cdf0e10cSrcweirapplication/vnd.openofficeorg.extension oxt
73*cdf0e10cSrcweirEND
74*cdf0e10cSrcweir
75*cdf0e10cSrcweir# and replace the original file
76*cdf0e10cSrcweirmv -f /etc/mime.types.tmp$$ /etc/mime.types 2>/dev/null
77*cdf0e10cSrcweir
78*cdf0e10cSrcweir# update /etc/mailcap only at initial install
79*cdf0e10cSrcweirif [ "$1" = "configure" ]
80*cdf0e10cSrcweirthen
81*cdf0e10cSrcweir  # backing out existing entries to avoid duplicates
82*cdf0e10cSrcweir  sed '
83*cdf0e10cSrcweir/^# OpenOffice.org/d
84*cdf0e10cSrcweir/^application\/vnd\.oasis\.opendocument/d
85*cdf0e10cSrcweir/^application\/vnd\.openofficeorg/d
86*cdf0e10cSrcweir/^application\/vnd\.sun/d
87*cdf0e10cSrcweir/^application\/vnd\.stardivision/d
88*cdf0e10cSrcweir/^application\/vnd\.ms-word/d
89*cdf0e10cSrcweir/^application\/vnd\.ms-excel/d
90*cdf0e10cSrcweir/^application\/vnd\.ms-powerpoint/d
91*cdf0e10cSrcweir/^application\/x-star/d
92*cdf0e10cSrcweir/excel/d
93*cdf0e10cSrcweir/ms[-]*word/d
94*cdf0e10cSrcweir/powerpoint/d
95*cdf0e10cSrcweir' /etc/mailcap 2>/dev/null >> /etc/mailcap.tmp$$
96*cdf0e10cSrcweir
97*cdf0e10cSrcweir  # now append our stuff to the temporary file
98*cdf0e10cSrcweir  cat >> /etc/mailcap.tmp$$ << END
99*cdf0e10cSrcweir# OpenOffice.org
100*cdf0e10cSrcweirapplication/vnd.oasis.opendocument.text; %PREFIX -view %s
101*cdf0e10cSrcweirapplication/vnd.oasis.opendocument.text-template; %PREFIX -view %s
102*cdf0e10cSrcweirapplication/vnd.oasis.opendocument.text-web; %PREFIX -view %s
103*cdf0e10cSrcweirapplication/vnd.oasis.opendocument.text-master; %PREFIX -view %s
104*cdf0e10cSrcweirapplication/vnd.sun.xml.writer; %PREFIX -view %s
105*cdf0e10cSrcweirapplication/vnd.sun.xml.writer.template; %PREFIX -view %s
106*cdf0e10cSrcweirapplication/vnd.sun.xml.writer.global; %PREFIX -view %s
107*cdf0e10cSrcweirapplication/vnd.stardivision.writer; %PREFIX -view %s
108*cdf0e10cSrcweirapplication/vnd.stardivision.writer-global; %PREFIX -view %s
109*cdf0e10cSrcweirapplication/x-starwriter; %PREFIX -view %s
110*cdf0e10cSrcweirapplication/vnd.oasis.opendocument.formula; %PREFIX -view %s
111*cdf0e10cSrcweirapplication/vnd.sun.xml.math; %PREFIX -view %s
112*cdf0e10cSrcweirapplication/vnd.stardivision.math; %PREFIX -view %s
113*cdf0e10cSrcweirapplication/x-starmath; %PREFIX -view %s
114*cdf0e10cSrcweirapplication/msword; %PREFIX -view %s
115*cdf0e10cSrcweirapplication/vnd.oasis.opendocument.spreadsheet; %PREFIX -view %s
116*cdf0e10cSrcweirapplication/vnd.oasis.opendocument.spreadsheet-template; %PREFIX -view %s
117*cdf0e10cSrcweirapplication/vnd.sun.xml.calc; %PREFIX -view %s
118*cdf0e10cSrcweirapplication/vnd.sun.xml.calc.template; %PREFIX -view %s
119*cdf0e10cSrcweirapplication/vnd.stardivision.calc; %PREFIX -view %s
120*cdf0e10cSrcweirapplication/x-starcalc; %PREFIX -view %s
121*cdf0e10cSrcweirapplication/vnd.stardivision.chart; %PREFIX -view %s
122*cdf0e10cSrcweirapplication/x-starchart; %PREFIX -view %s
123*cdf0e10cSrcweirapplication/excel; %PREFIX -view %s
124*cdf0e10cSrcweirapplication/msexcel; %PREFIX -view %s
125*cdf0e10cSrcweirapplication/vnd.ms-excel; %PREFIX -view %s
126*cdf0e10cSrcweirapplication/x-msexcel; %PREFIX -view %s
127*cdf0e10cSrcweirapplication/vnd.oasis.opendocument.presentation; %PREFIX -view %s
128*cdf0e10cSrcweirapplication/vnd.oasis.opendocument.presentation-template; %PREFIX -view %s
129*cdf0e10cSrcweirapplication/vnd.sun.xml.impress; %PREFIX -view %s
130*cdf0e10cSrcweirapplication/vnd.sun.xml.impress.template; %PREFIX -view %s
131*cdf0e10cSrcweirapplication/vnd.stardivision.impress; %PREFIX -view %s
132*cdf0e10cSrcweirapplication/x-starimpress; %PREFIX -view %s
133*cdf0e10cSrcweirapplication/powerpoint; %PREFIX -view %s
134*cdf0e10cSrcweirapplication/mspowerpoint; %PREFIX -view %s
135*cdf0e10cSrcweirapplication/vnd.ms-powerpoint; %PREFIX -view %s
136*cdf0e10cSrcweirapplication/x-mspowerpoint; %PREFIX -view %s
137*cdf0e10cSrcweirapplication/vnd.oasis.opendocument.graphics; %PREFIX -view %s
138*cdf0e10cSrcweirapplication/vnd.oasis.opendocument.graphics-template; %PREFIX -view %s
139*cdf0e10cSrcweirapplication/vnd.sun.xml.draw; %PREFIX -view %s
140*cdf0e10cSrcweirapplication/vnd.sun.xml.draw.template; %PREFIX -view %s
141*cdf0e10cSrcweirapplication/vnd.stardivision.draw; %PREFIX -view %s
142*cdf0e10cSrcweirapplication/x-stardraw; %PREFIX -view %s
143*cdf0e10cSrcweirapplication/vnd.oasis.opendocument.database; %PREFIX -view %s
144*cdf0e10cSrcweirapplication/vnd.sun.xml.base; %PREFIX -view %s
145*cdf0e10cSrcweirapplication/vnd.writerperfect; %PREFIX -view %s
146*cdf0e10cSrcweirapplication/wordperfect5.1; %PREFIX -view %s
147*cdf0e10cSrcweirapplication/x-wordperfect; %PREFIX -view %s
148*cdf0e10cSrcweirapplication/wordperfect; %PREFIX -view %s
149*cdf0e10cSrcweirapplication/wpwin; %PREFIX -view %s
150*cdf0e10cSrcweirapplication/vnd.openofficeorg.extension; %PREFIX %s
151*cdf0e10cSrcweirEND
152*cdf0e10cSrcweir
153*cdf0e10cSrcweir  # and replace the original file
154*cdf0e10cSrcweir  mv -f /etc/mailcap.tmp$$ /etc/mailcap
155*cdf0e10cSrcweirfi
156*cdf0e10cSrcweir
157*cdf0e10cSrcweirexit 0
158