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