wok annotate get-OpenOffice3/stuff/get-OpenOffice3 @ rev 1694

Fix: get-OpenOffice3 package name.
author Eric Joseph-Alexandre <erjo@slitaz.org>
date Tue Nov 11 21:59:57 2008 +0100 (2008-11-11)
parents
children 81afad9999f9
rev   line source
erjo@1694 1 #!/bin/sh
erjo@1694 2 # get-OpenOffice3, install everything for OpenOffice.org exept KDE/Gnome integration and testsuite.
erjo@1694 3 #
erjo@1694 4 # (C) 2008 SliTaz - GNU General Public License v3.
erjo@1694 5 #
erjo@1694 6 # Author : Eric Joseph-Alexandre <erjo@slitaz.org>
erjo@1694 7
erjo@1694 8 PACKAGE="OpenOffice3"
erjo@1694 9 VERSION="3.0.0"
erjo@1694 10 URL="http://www.openoffice.org"
erjo@1694 11
erjo@1694 12 if [ "$LANG" = "fr_FR" ]; then
erjo@1694 13 TARBALL="OOo_${VERSION}_LinuxIntel_install_fr.tar.gz"
erjo@1694 14 WGET_URL="ftp://ftp.proxad.net/mirrors/ftp.openoffice.org/localized/fr/${VERSION}/${TARBALL}"
erjo@1694 15 else
erjo@1694 16 TARBALL="OOo_${VERSION}_LinuxIntel_install_en-US.tar.gz"
erjo@1694 17 WGET_URL="ftp://ftp.proxad.net/mirrors/ftp.openoffice.org/stable/${VERSION}/${TARBALL}"
erjo@1694 18 fi
erjo@1694 19
erjo@1694 20 TEMP_DIR="/home/slitaz/build/$PACKAGE.$$"
erjo@1694 21 SOURCE_DIR="/home/slitaz/src"
erjo@1694 22 EXCLUDE="kde|gnome|test"
erjo@1694 23 LOG="/tmp/$(basename $0 .sh).log"
erjo@1694 24
erjo@1694 25 # Status function with color (supported by Ash).
erjo@1694 26 status()
erjo@1694 27 {
erjo@1694 28 local CHECK=$?
erjo@1694 29 echo -en "\\033[70G[ "
erjo@1694 30 if [ $CHECK = 0 ]; then
erjo@1694 31 echo -en "\\033[1;33mOK"
erjo@1694 32 else
erjo@1694 33 echo -en "\\033[1;31mFailed"
erjo@1694 34 fi
erjo@1694 35 echo -e "\\033[0;39m ]"
erjo@1694 36 return $CHECK
erjo@1694 37 }
erjo@1694 38
erjo@1694 39 # Check if user is root to install, or remove packages.
erjo@1694 40 check_root()
erjo@1694 41 {
erjo@1694 42 if test $(id -u) != 0 ; then
erjo@1694 43 echo -e "\nYou must be root to run `basename $0` with this option."
erjo@1694 44 echo -e "Please use 'su' and root password to become super-user.\n"
erjo@1694 45 exit 0
erjo@1694 46 fi
erjo@1694 47 }
erjo@1694 48
erjo@1694 49 check_if_installed()
erjo@1694 50 {
erjo@1694 51 # Avoid reinstall
erjo@1694 52 if [ -d /var/lib/tazpkg/installed/$PACKAGE ];then
erjo@1694 53 return 0
erjo@1694 54 else
erjo@1694 55 return 1
erjo@1694 56 fi
erjo@1694 57 }
erjo@1694 58
erjo@1694 59 #We need to bee root
erjo@1694 60 check_root
erjo@1694 61
erjo@1694 62 #check if package already installed
erjo@1694 63 if (check_if_installed $PACKAGE); then
erjo@1694 64 echo "$PACKAGE is already installed."
erjo@1694 65 echo -n "Would you like to remove and reinstall this package [y/n]? "
erjo@1694 66 read answer
erjo@1694 67 case "$answer" in
erjo@1694 68 y|Y)
erjo@1694 69 tazpkg remove $PACKAGE ;;
erjo@1694 70 *)
erjo@1694 71 exit 0 ;;
erjo@1694 72 esac
erjo@1694 73
erjo@1694 74 fi
erjo@1694 75
erjo@1694 76
erjo@1694 77 # Check if we have the tarball before.
erjo@1694 78 if [ ! -f $SOURCE_DIR/$TARBALL ]; then
erjo@1694 79 echo "Downloading OppenOffice.org tarball (it's time to have a break)... "
erjo@1694 80 #Check if $SOURCE_DIR exist
erjo@1694 81 test -d $SOURCE_DIR || mkdir -p $SOURCE_DIR
erjo@1694 82 # Get the file.
erjo@1694 83 wget -c $WGET_URL -O $SOURCE_DIR/$TARBALL
erjo@1694 84 status
erjo@1694 85 fi
erjo@1694 86
erjo@1694 87
erjo@1694 88
erjo@1694 89 # Creates TEM_DIR and extract tarball
erjo@1694 90 mkdir -p $TEMP_DIR
erjo@1694 91 echo -n "Extract files from archive..."
erjo@1694 92 tar xvzf $SOURCE_DIR/$TARBALL -C $TEMP_DIR > $LOG 2>&1 || \
erjo@1694 93 (echo "Failed to extract $TARBALL" ; exit 1)
erjo@1694 94 status
erjo@1694 95
erjo@1694 96 cd $TEMP_DIR/*/RPMS
erjo@1694 97
erjo@1694 98 # Extract everything from RPMS
erjo@1694 99 for i in *.rpm
erjo@1694 100 do
erjo@1694 101 if (! echo $i | egrep -qi $EXCLUDE); then
erjo@1694 102 rpm2cpio $i | cpio -id >> $LOG 2>&1
erjo@1694 103 fi
erjo@1694 104 done
erjo@1694 105 rpm2cpio desktop-integration/*freedesktop*.rpm | cpio -id >> $LOG 2>&1
erjo@1694 106
erjo@1694 107 # Make the package
erjo@1694 108 mkdir -p $PACKAGE-$VERSION/fs/usr/lib/openoffice \
erjo@1694 109 $PACKAGE-$VERSION/fs/usr/share
erjo@1694 110
erjo@1694 111 cp -a opt/openoffice* $PACKAGE-$VERSION/fs/usr/lib/openoffice
erjo@1694 112 cp -a usr/share/mime $PACKAGE-$VERSION/fs/usr/share
erjo@1694 113 cp -a usr/share/icons $PACKAGE-$VERSION/fs/usr/share
erjo@1694 114 cp -a usr/bin $PACKAGE-$VERSION/fs/usr
erjo@1694 115
erjo@1694 116 # relocalized OOo libexec directory
erjo@1694 117 sed -i 's#/opt/#/usr/lib/openoffice/#' $PACKAGE-$VERSION/fs/usr/openoffice*
erjo@1694 118
erjo@1694 119 # Create receipt
erjo@1694 120 cat > $PACKAGE-$VERSION/receipt <<EOT
erjo@1694 121 # SliTaz package receipt.
erjo@1694 122
erjo@1694 123 PACKAGE="$PACKAGE"
erjo@1694 124 VERSION="$VERSION"
erjo@1694 125 CATEGORY="office"
erjo@1694 126 SHORT_DESC="Productivity suite."
erjo@1694 127 DEPENDS=""
erjo@1694 128 WEB_SITE="$URL"
erjo@1694 129
erjo@1694 130 post_install()
erjo@1694 131 {
erjo@1694 132 cd /usr/share/applications
erjo@1694 133 ln -s /usr/lib/openoffice/openoffice.org3/share/xdg/base.desktop openoffice.org3-base.desktop
erjo@1694 134 ln -s /usr/lib/openoffice/openoffice.org3/share/xdg/impress.desktop openoffice.org3-impress.desktop
erjo@1694 135 ln -s /usr/lib/openoffice/openoffice.org3/share/xdg/writer.desktop openoffice.org3-writer.desktop
erjo@1694 136 ln -s /usr/lib/openoffice/openoffice.org3/share/xdg/calc.desktop openoffice.org3-calc.desktop
erjo@1694 137 ln -s /usr/lib/openoffice/openoffice.org3/share/xdg/math.desktop openoffice.org3-math.desktop
erjo@1694 138 ln -s /usr/lib/openoffice/openoffice.org3/share/xdg/draw.desktop openoffice.org3-draw.desktop
erjo@1694 139 ln -s /usr/lib/openoffice/openoffice.org3/share/xdg/printeradmin.desktop openoffice.org3-printeradmin.desktop
erjo@1694 140
erjo@1694 141 cd /usr/bin
erjo@1694 142 ln -sf /usr/lib/openoffice/openoffice.org3/program/soffice
erjo@1694 143 }
erjo@1694 144
erjo@1694 145 post_remove()
erjo@1694 146 {
erjo@1694 147 rm -f /usr/share/applications/openoffice.org3-*
erjo@1694 148 }
erjo@1694 149
erjo@1694 150 EOT
erjo@1694 151
erjo@1694 152 # Pack
erjo@1694 153 tazpkg pack $PACKAGE-$VERSION
erjo@1694 154
erjo@1694 155 # Install pseudo package
erjo@1694 156 tazpkg install $PACKAGE-$VERSION.tazpkg
erjo@1694 157
erjo@1694 158 # Clean
erjo@1694 159 rm -rf $TEMP_DIR
erjo@1694 160 rm -rf $PACKAGE-$VERSION