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