wok view get-OpenOffice3/stuff/get-OpenOffice3 @ rev 7525

Fixed thunderbird-langpkg-de to save de.xpi as thunderbird-langpkg-de-VERSION.xpi in src repo folder.
author Christopher Rogers <slaxemulator@gmail.com>
date Sun Dec 05 21:17:30 2010 +0000 (2010-12-05)
parents e2384da86879
children b41ed6ae8b6b
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 URL="http://www.openoffice.org"
10 ROOT="$1"
11 PATTERN="Linux_x86_install-rpm"
13 DIR="stable"
14 LOC=$(wget -O - http://openofficeorg.secsup.org/localized/ 2> /dev/null \
15 | grep -E ">$LANG/|>${LANG/_/-}/|>${LANG%_*}/" | head -1 | sed 's/.*href=\"\(.*\)\/\".*/\1/')
16 [ -n "$LOC" ] && DIR="localized/$LOC"
18 VERSION="$(basename $(wget -O - http://openofficeorg.secsup.org/$DIR/ \
19 2> /dev/null | grep href=\"[0-9] | tail -1 | sed 's/.*href=\"\(.*\)\".*/\1/'))"
20 if [ -z "$VERSION" ]; then
21 echo "Can't find VERSION. Abort."
22 exit 0
23 fi
24 echo "Selecting $DIR version $VERSION ..."
25 TARBALL="$(wget -O - http://openofficeorg.secsup.org/$DIR/$VERSION/ \
26 2> /dev/null | grep $PATTERN | tail -1 | sed 's/.*href=\"\(.*\)\".*/\1/')"
27 echo "Archive is $TARBALL ..."
28 WGET_URL=ftp://ftp.proxad.net/mirrors/ftp.openoffice.org/$DIR/$VERSION/$TARBALL
30 TEMP_DIR="/tmp/$PACKAGE.$$"
31 SOURCE_DIR="/tmp/src.$$"
32 EXCLUDE="kde|gnome|test"
33 LOG="/tmp/$(basename $0 .sh).log"
35 # Status function with color (supported by Ash).
36 status()
37 {
38 local CHECK=$?
39 echo -en "\\033[70G[ "
40 if [ $CHECK = 0 ]; then
41 echo -en "\\033[1;33mOK"
42 else
43 echo -en "\\033[1;31mFailed"
44 fi
45 echo -e "\\033[0;39m ]"
46 return $CHECK
47 }
49 # Check if user is root to install, or remove packages.
50 check_root()
51 {
52 if test $(id -u) != 0 ; then
53 echo -e "\nYou must be root to run `basename $0` with this option."
54 echo -e "Please use 'su' and root password to become super-user.\n"
55 exit 0
56 fi
57 }
59 check_if_installed()
60 {
61 # Avoid reinstall
62 if [ -d $ROOT/var/lib/tazpkg/installed/$PACKAGE ];then
63 return 0
64 else
65 return 1
66 fi
67 }
69 #We need to bee root
70 check_root
72 #check if package already installed
73 if (check_if_installed $PACKAGE); then
74 echo "$PACKAGE is already installed."
75 [ -n "$ROOT" ] && exit 0
76 echo -n "Would you like to remove and reinstall this package [y/n]? "
77 read answer
78 case "$answer" in
79 y|Y)
80 tazpkg remove $PACKAGE ;;
81 *)
82 exit 0 ;;
83 esac
85 fi
88 # Check if we have the tarball before.
89 if [ ! -f $SOURCE_DIR/$TARBALL ]; then
90 echo "Downloading OppenOffice.org tarball (it's time to have a break)... "
91 #Check if $SOURCE_DIR exist
92 test -d $SOURCE_DIR || mkdir -p $SOURCE_DIR
93 # Get the file.
94 wget -c $WGET_URL -O $SOURCE_DIR/$TARBALL
95 status
96 fi
97 if [ ! -f $SOURCE_DIR/$TARBALL ]; then
98 rm -rf $SOURCE_DIR
99 echo "Could not download $TARBALL. Exiting."
100 exit 1
101 fi
103 # Creates TEMP_DIR and extract tarball
104 mkdir -p $TEMP_DIR
105 echo -n "Extract files from archive..."
106 tar xvzf $SOURCE_DIR/$TARBALL -C $TEMP_DIR > $LOG 2>&1 || \
107 (echo "Failed to extract $TARBALL" ; exit 1)
108 status
110 # extracted pkg can be removed: Save RAM
111 rm -rf $SOURCE_DIR
113 cd $TEMP_DIR/*/RPMS
115 # Extract everything from RPMS
116 for i in *.rpm
117 do
118 if (! echo $i | egrep -qi $EXCLUDE); then
119 (rpm2cpio $i | cpio -id >> $LOG 2>&1 ) && rm -f $i
120 fi
121 done
122 rpm2cpio desktop-integration/*freedesktop*.rpm | cpio -id >> $LOG 2>&1
124 # extracted pkg can be removed: Save RAM
125 rm -f desktop-integration/*freedesktop*.rpm
128 # Make the package
129 mkdir -p $PACKAGE-$VERSION/fs/usr/lib/openoffice \
130 $PACKAGE-$VERSION/fs/usr/share
132 # use mv instead of 'cp -a' to save RAM
133 mv opt/openoffice* $PACKAGE-$VERSION/fs/usr/lib/openoffice
134 mv usr/share/mime $PACKAGE-$VERSION/fs/usr/share
135 mv usr/share/icons $PACKAGE-$VERSION/fs/usr/share
136 mv usr/bin $PACKAGE-$VERSION/fs/usr
138 # relocalized OOo libexec directory
139 sed -i 's#/opt/#/usr/lib/openoffice/#' $PACKAGE-$VERSION/fs/usr/bin/openoffice*
141 # Create receipt
142 cat > $PACKAGE-$VERSION/receipt <<EOT
143 # SliTaz package receipt.
145 PACKAGE="$PACKAGE"
146 VERSION="$VERSION"
147 CATEGORY="office"
148 SHORT_DESC="Productivity suite."
149 DEPENDS=""
150 WEB_SITE="$URL"
152 post_install()
153 {
154 cd /usr/share/applications
155 ln -s /usr/lib/openoffice/openoffice.org3/share/xdg/base.desktop openoffice.org3-base.desktop
156 ln -s /usr/lib/openoffice/openoffice.org3/share/xdg/impress.desktop openoffice.org3-impress.desktop
157 ln -s /usr/lib/openoffice/openoffice.org3/share/xdg/writer.desktop openoffice.org3-writer.desktop
158 ln -s /usr/lib/openoffice/openoffice.org3/share/xdg/calc.desktop openoffice.org3-calc.desktop
159 ln -s /usr/lib/openoffice/openoffice.org3/share/xdg/math.desktop openoffice.org3-math.desktop
160 ln -s /usr/lib/openoffice/openoffice.org3/share/xdg/draw.desktop openoffice.org3-draw.desktop
161 ln -s /usr/lib/openoffice/openoffice.org3/share/xdg/printeradmin.desktop openoffice.org3-printeradmin.desktop
163 cd /usr/bin
164 ln -sf /usr/lib/openoffice/openoffice.org3/program/soffice
165 }
167 post_remove()
168 {
169 rm -f /usr/share/applications/openoffice.org3-*
170 }
172 EOT
174 # Pack
175 tazpkg pack $PACKAGE-$VERSION
177 # Clean to save RAM memory
178 rm -rf $PACKAGE-$VERSION
180 # Install pseudo package
181 tazpkg install $PACKAGE-$VERSION.tazpkg --root=$ROOT
183 # Clean
184 rm -rf $TEMP_DIR