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