1# version and release passed by command-line 2Version: %version 3Release: %release 4Summary: %productname desktop integration 5Name: %pkgprefix-redhat-menus 6Group: Office 7License: LGPL 8Vendor: OpenOffice.org 9AutoReqProv: no 10BuildArch: noarch 11Requires: redhat-release 12Provides: openoffice.org3-desktop-integration 13%define _unpackaged_files_terminate_build 0 14%define _binary_filedigest_algorithm 1 15%define _binary_payload w9.gzdio 16%description 17%productname desktop integration 18 19%install 20# hack/workaround to make SuSE's brp-symlink-script happy. It wants the targets of all links 21# to be present on the build-system/the buildroot. But the point is that we generate stale 22# links intentionally (until we find a better solution) #46226 23export NO_BRP_STALE_LINK_ERROR=yes 24 25mkdir -p $RPM_BUILD_ROOT 26 27# set parameters for the create_tree script 28export DESTDIR=$RPM_BUILD_ROOT 29export KDEMAINDIR=/usr 30export GNOMEDIR=/usr 31export GNOME_MIME_THEME=hicolor 32 33./create_tree.sh 34 35# legacy redhat KDE location for .desktop files 36mkdir -p $RPM_BUILD_ROOT/usr/share/applnk-redhat/Office 37for i in `cat launcherlist`; do 38 ln -sf /opt/%unixfilename/share/xdg/$i $RPM_BUILD_ROOT/usr/share/applnk-redhat/Office/%unixfilename-$i 39done 40 41%clean 42rm -rf $RPM_BUILD_ROOT 43 44%triggerin -- %pkgprefix, %pkgprefix-writer, %pkgprefix-calc, %pkgprefix-draw, %pkgprefix-impress, %pkgprefix-base, %pkgprefix-math 45if [ -x /usr/bin/update-desktop-database ]; then 46 update-desktop-database -q /usr/share/applications 47fi 48 49%triggerun -- %pkgprefix, %pkgprefix-writer, %pkgprefix-calc, %pkgprefix-draw, %pkgprefix-impress, %pkgprefix-base, %pkgprefix-math 50if [ "$1" = "0" ] ; then 51 # the menu-package gets uninstalled/updated - postun will run the command 52 exit 0 53fi 54if [ "$2" = "0" ] ; then 55 # the triggering package gets removed 56 if [ -x /usr/bin/update-desktop-database ]; then 57 update-desktop-database -q /usr/share/applications 58 fi 59fi 60 61%post 62# run always, since there are versions of this package that did not include 63# a shared-mime-info xml file 64if [ -x /usr/bin/update-mime-database ]; then 65 update-mime-database /usr/share/mime 66fi 67 68# run only on first install, since postun is run when updating 69# post would be run before the old files are removed 70if [ "$1" = "1" ] ; then # first install 71 for theme in gnome hicolor locolor; do 72 if [ -e /usr/share/icons/$theme/icon-theme.cache ] ; then 73 # touch it, just in case we cannot find the binary... 74 touch /usr/share/icons/$theme 75 if (which gtk-update-icon-cache); then 76 gtk-update-icon-cache /usr/share/icons/$theme 77 fi 78 # ignore errors (e.g. when there is a cache, but no index.theme) 79 true 80 fi 81 done 82fi 83 84# update /etc/mime.types 85# backing out existing entries to avoid duplicates 86sed ' 87/application\/vnd\.oasis\.opendocument/d 88/application\/vnd\.openofficeorg/d 89/application\/vnd\.sun/d 90/application\/vnd\.stardivision/d 91' /etc/mime.types 2>/dev/null >> /etc/mime.types.tmp$$ 92 93# now append our stuff to the temporary file 94cat >> /etc/mime.types.tmp$$ << END 95application/vnd.oasis.opendocument.text odt 96application/vnd.oasis.opendocument.text-template ott 97application/vnd.oasis.opendocument.text-web oth 98application/vnd.oasis.opendocument.text-master odm 99application/vnd.oasis.opendocument.graphics odg 100application/vnd.oasis.opendocument.graphics-template otg 101application/vnd.oasis.opendocument.presentation odp 102application/vnd.oasis.opendocument.presentation-template otp 103application/vnd.oasis.opendocument.spreadsheet ods 104application/vnd.oasis.opendocument.spreadsheet-template ots 105application/vnd.oasis.opendocument.chart odc 106application/vnd.oasis.opendocument.formula odf 107application/vnd.oasis.opendocument.image odi 108application/vnd.sun.xml.writer sxw 109application/vnd.sun.xml.writer.template stw 110application/vnd.sun.xml.writer.global sxg 111application/vnd.stardivision.writer sdw vor 112application/vnd.stardivision.writer-global sgl 113application/vnd.sun.xml.calc sxc 114application/vnd.sun.xml.calc.template stc 115application/vnd.stardivision.calc sdc 116application/vnd.stardivision.chart sds 117application/vnd.sun.xml.impress sxi 118application/vnd.sun.xml.impress.template sti 119application/vnd.stardivision.impress sdd sdp 120application/vnd.sun.xml.draw sxd 121application/vnd.sun.xml.draw.template std 122application/vnd.stardivision.draw sda 123application/vnd.sun.xml.math sxm 124application/vnd.stardivision.math smf 125application/vnd.sun.xml.base odb 126application/vnd.openofficeorg.extension oxt 127application/vnd.openxmlformats-officedocument.wordprocessingml.document docx 128application/vnd.ms-word.document.macroenabled.12 docm 129application/vnd.openxmlformats-officedocument.wordprocessingml.template dotx 130application/vnd.ms-word.template.macroenabled.12 dotm 131application/vnd.openxmlformats-officedocument.spreadsheetml.sheet xlsx 132application/vnd.ms-excel.sheet.macroenabled.12 xlsm 133application/vnd.openxmlformats-officedocument.spreadsheetml.template xltx 134application/vnd.ms-excel.template.macroenabled.12 xltm 135application/vnd.openxmlformats-officedocument.presentationml.presentation pptx 136application/vnd.ms-powerpoint.presentation.macroenabled.12 pptm 137application/vnd.openxmlformats-officedocument.presentationml.template potx 138application/vnd.ms-powerpoint.template.macroenabled.12 potm 139END 140 141# and replace the original file 142mv -f /etc/mime.types.tmp$$ /etc/mime.types 2>/dev/null 143 144# update /etc/mailcap only at initial install 145if [ "$1" = 1 ] 146then 147 # backing out existing entries to avoid duplicates 148 sed ' 149/^# OpenOffice.org/d 150/^application\/vnd\.oasis\.opendocument/d 151/^application\/vnd\.openofficeorg/d 152/^application\/vnd\.sun/d 153/^application\/vnd\.stardivision/d 154/^application\/vnd\.ms-word/d 155/^application\/vnd\.ms-excel/d 156/^application\/vnd\.ms-powerpoint/d 157/^application\/x-star/d 158/excel/d 159/ms[-]*word/d 160/powerpoint/d 161' /etc/mailcap 2>/dev/null >> /etc/mailcap.tmp$$ 162 163 # now append our stuff to the temporary file 164 cat >> /etc/mailcap.tmp$$ << END 165# OpenOffice.org 166application/vnd.oasis.opendocument.text; %unixfilename -view %s 167application/vnd.oasis.opendocument.text-template; %unixfilename -view %s 168application/vnd.oasis.opendocument.text-web; %unixfilename -view %s 169application/vnd.oasis.opendocument.text-master; %unixfilename -view %s 170application/vnd.sun.xml.writer; %unixfilename -view %s 171application/vnd.sun.xml.writer.template; %unixfilename -view %s 172application/vnd.sun.xml.writer.global; %unixfilename -view %s 173application/vnd.stardivision.writer; %unixfilename -view %s 174application/vnd.stardivision.writer-global; %unixfilename -view %s 175application/x-starwriter; %unixfilename -view %s 176application/vnd.oasis.opendocument.formula; %unixfilename -view %s 177application/vnd.sun.xml.math; %unixfilename -view %s 178application/vnd.stardivision.math; %unixfilename -view %s 179application/x-starmath; %unixfilename -view %s 180application/msword; %unixfilename -view %s 181application/vnd.oasis.opendocument.spreadsheet; %unixfilename -view %s 182application/vnd.oasis.opendocument.spreadsheet-template; %unixfilename -view %s 183application/vnd.sun.xml.calc; %unixfilename -view %s 184application/vnd.sun.xml.calc.template; %unixfilename -view %s 185application/vnd.stardivision.calc; %unixfilename -view %s 186application/x-starcalc; %unixfilename -view %s 187application/vnd.stardivision.chart; %unixfilename -view %s 188application/x-starchart; %unixfilename -view %s 189application/excel; %unixfilename -view %s 190application/msexcel; %unixfilename -view %s 191application/vnd.ms-excel; %unixfilename -view %s 192application/x-msexcel; %unixfilename -view %s 193application/vnd.oasis.opendocument.presentation; %unixfilename -view %s 194application/vnd.oasis.opendocument.presentation-template; %unixfilename -view %s 195application/vnd.sun.xml.impress; %unixfilename -view %s 196application/vnd.sun.xml.impress.template; %unixfilename -view %s 197application/vnd.stardivision.impress; %unixfilename -view %s 198application/x-starimpress; %unixfilename -view %s 199application/powerpoint; %unixfilename -view %s 200application/mspowerpoint; %unixfilename -view %s 201application/vnd.ms-powerpoint; %unixfilename -view %s 202application/x-mspowerpoint; %unixfilename -view %s 203application/vnd.oasis.opendocument.graphics; %unixfilename -view %s 204application/vnd.oasis.opendocument.graphics-template; %unixfilename -view %s 205application/vnd.sun.xml.draw; %unixfilename -view %s 206application/vnd.sun.xml.draw.template; %unixfilename -view %s 207application/vnd.stardivision.draw; %unixfilename -view %s 208application/x-stardraw; %unixfilename -view %s 209application/vnd.oasis.opendocument.database; %unixfilename -view %s 210application/vnd.sun.xml.base; %unixfilename -view %s 211application/vnd.writerperfect; %unixfilename -view %s 212application/wordperfect5.1; %unixfilename -view %s 213application/x-wordperfect; %unixfilename -view %s 214application/wordperfect; %unixfilename -view %s 215application/wpwin; %unixfilename -view %s 216application/vnd.openofficeorg.extension; %unixfilename %s 217application/vnd.openxmlformats-officedocument.wordprocessingml.document; %unixfilename -view %s 218application/vnd.ms-word.document.macroenabled.12;%unixfilename -view %s 219application/vnd.openxmlformats-officedocument.wordprocessingml.template; %unixfilename -view %s 220application/vnd.ms-word.template.macroenabled.12; %unixfilename -view %s 221application/vnd.openxmlformats-officedocument.spreadsheetml.sheet; %unixfilename -view %s 222application/vnd.ms-excel.sheet.macroenabled.12; %unixfilename -view %s 223application/vnd.openxmlformats-officedocument.spreadsheetml.template; %unixfilename -view %s 224application/vnd.ms-excel.template.macroenabled.12; %unixfilename -view %s 225application/vnd.openxmlformats-officedocument.presentationml.presentation; %unixfilename -view %s 226application/vnd.ms-powerpoint.presentation.macroenabled.12; %unixfilename -view %s 227application/vnd.openxmlformats-officedocument.presentationml.template; %unixfilename -view %s 228application/vnd.ms-powerpoint.template.macroenabled.12; %unixfilename -view %s 229END 230 231 # and replace the original file 232 mv -f /etc/mailcap.tmp$$ /etc/mailcap 233fi 234 235%preun 236# remove from /etc/mailcap only on de-install 237if [ "$1" = 0 ] 238then 239 # backing all entries pointing to our binary 240 sed '/%unixfilename/d' /etc/mailcap 2>/dev/null >> /etc/mailcap.tmp$$ 241 242 # and replace the original file 243 mv -f /etc/mailcap.tmp$$ /etc/mailcap 244fi 245 246%postun 247# run only when erasing this package, since %post of the new package ran 248# previously or updates already handled by triggers. 249if [ "$1" = 0 ] ; then 250 if [ -x /usr/bin/update-desktop-database ]; then 251 update-desktop-database -q /usr/share/applications 252 fi 253 if [ -x /usr/bin/update-mime-database ]; then 254 update-mime-database /usr/share/mime 255 fi 256fi 257#run always 258for theme in gnome hicolor locolor; do 259 if [ -e /usr/share/icons/$theme/icon-theme.cache ] ; then 260 # touch it, just in case we cannot find the binary... 261 touch /usr/share/icons/$theme 262 if (which gtk-update-icon-cache); then 263 gtk-update-icon-cache /usr/share/icons/$theme 264 fi 265 # ignore errors (e.g. when there is a cache, but no index.theme) 266 true 267 fi 268done 269 270%files 271%attr(0755,root,root) /usr/bin/soffice 272%attr(0755,root,root) %verify(not size md5) /usr/bin/%unixfilename 273%attr(0755,root,root) /usr/bin/%unixfilename-printeradmin 274%defattr(0644, root, root) 275/usr/share/application-registry/*.applications 276/usr/share/applications/%unixfilename-writer.desktop 277/usr/share/applications/%unixfilename-calc.desktop 278/usr/share/applications/%unixfilename-draw.desktop 279/usr/share/applications/%unixfilename-impress.desktop 280/usr/share/applications/%unixfilename-math.desktop 281/usr/share/applications/%unixfilename-base.desktop 282/usr/share/applications/%unixfilename-printeradmin.desktop 283/usr/share/applications/%unixfilename-startcenter.desktop 284/usr/share/applications/%unixfilename-javafilter.desktop 285/usr/share/applnk-redhat/Office/%unixfilename-writer.desktop 286/usr/share/applnk-redhat/Office/%unixfilename-calc.desktop 287/usr/share/applnk-redhat/Office/%unixfilename-draw.desktop 288/usr/share/applnk-redhat/Office/%unixfilename-impress.desktop 289/usr/share/applnk-redhat/Office/%unixfilename-math.desktop 290/usr/share/applnk-redhat/Office/%unixfilename-base.desktop 291/usr/share/applnk-redhat/Office/%unixfilename-printeradmin.desktop 292/usr/share/applnk-redhat/Office/%unixfilename-startcenter.desktop 293/usr/share/applnk-redhat/Office/%unixfilename-javafilter.desktop 294/usr/share/mime-info/*.keys 295/usr/share/mime-info/*.mime 296/usr/share/mimelnk/application/*.desktop 297/usr/share/icons/gnome/*/apps/*png 298/usr/share/icons/gnome/*/mimetypes/*png 299/usr/share/icons/hicolor/*/apps/*png 300/usr/share/icons/hicolor/*/mimetypes/*png 301/usr/share/icons/locolor/*/apps/*png 302/usr/share/icons/locolor/*/mimetypes/*png 303/usr/share/mime/packages/* 304