get-scripts view OpenOffice3 @ rev 2

Add dropbox
author Pascal Bellard <pascal.bellard@slitaz.org>
date Sun Feb 16 18:12:54 2014 +0000 (2014-02-16)
parents 1b9497240a07
children
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 PATTERN="Linux_x86_install-rpm"
12 for MIRROR in \
13 http://mirror.switch.ch/ftp/mirror/OpenOffice \
14 http://openoffice.cict.fr \
15 http://wwwftp.ciril.fr/pub/openoffice \
16 http://artfiles.org/openoffice.org \
17 http://vesta.informatik.rwth-aachen.de/ftp/pub/mirror/OpenOffice \
18 http://ftp.ntua.gr/pub/OpenOffice \
19 http://ftp.iitm.ac.in/openoffice \
20 http://www.ring.gr.jp/archives/misc/openoffice \
21 http://ftp.nluug.nl/pub/office/openoffice \
23 do
24 wget -O - $MIRROR/ 2> /dev/null | grep -q localized || continue
25 DIR="stable"
26 LOC=$(wget -O - $MIRROR/localized/ 2> /dev/null | \
27 grep -E ">$LANG/|>${LANG/_/-}/|>${LANG%_*}/" | \
28 head -1 | sed 's/.*href=\"\(.*\)\/\".*/\1/')
29 [ -n "$LOC" ] && DIR="localized/$LOC"
30 VERSION="$(basename $(wget -O - $MIRROR/$DIR/ 2> /dev/null | grep \
31 href=\"[0-9] | tail -1 | sed 's/.*href=\"\(.*\)\".*/\1/') 2> /dev/null)"
32 [ -n "$VERSION" ] && break
33 done
35 if [ -z "$VERSION" ]; then
36 abort_package "Can't find VERSION. Abort."
37 fi
38 echo "Selecting $DIR version $VERSION ..."
39 TARBALL="$(wget -O - $MIRROR/$DIR/$VERSION/ \
40 2> /dev/null | grep $PATTERN | tail -1 | sed 's/.*href=\"\(.*\)\".*/\1/')"
41 echo "Archive is $TARBALL ..."
42 WGET_URL=$MIRROR/$DIR/$VERSION/$TARBALL
44 TEMP_DIR="/tmp/$PACKAGE.$$"
45 CUR_DIR=$(pwd)
46 SOURCE_DIR="/tmp/src.$$"
47 EXCLUDE="kde|gnome|test"
48 LOG="/tmp/$(basename $0 .sh).log"
50 # Check if we have the tarball before.
51 if [ ! -f $SOURCE_DIR/$TARBALL ]; then
52 echo "Downloading OppenOffice.org tarball (it's time to have a break)... "
53 #Check if $SOURCE_DIR exist
54 test -d $SOURCE_DIR || mkdir -p $SOURCE_DIR
55 # Get the file.
56 wget -c $WGET_URL -O $SOURCE_DIR/$TARBALL
57 status
58 fi
59 if [ ! -f $SOURCE_DIR/$TARBALL ]; then
60 rm -rf $SOURCE_DIR
61 abort_package "Could not download $TARBALL. Exiting."
62 fi
64 # Creates TEMP_DIR and extract tarball
65 mkdir -p $TEMP_DIR
66 echo -n "Extract files from archive..."
67 tar xvzf $SOURCE_DIR/$TARBALL -C $TEMP_DIR > $LOG 2>&1 ||
68 abort_package "Failed to extract $TARBALL"
69 status
71 # extracted pkg can be removed: Save RAM
72 rm -rf $SOURCE_DIR
74 cd $TEMP_DIR/*/RPMS
76 # Extract everything from RPMS
77 for i in *.rpm
78 do
79 if (! echo $i | egrep -qi $EXCLUDE); then
80 (rpm2cpio $i | cpio -id >> $LOG 2>&1 ) && rm -f $i
81 fi
82 done
83 rpm2cpio desktop-integration/*freedesktop*.rpm | cpio -id >> $LOG 2>&1
85 # extracted pkg can be removed: Save RAM
86 rm -f desktop-integration/*freedesktop*.rpm
89 # Make the package
90 mkdir -p $PACKAGE-$VERSION/fs/usr/lib/openoffice \
91 $PACKAGE-$VERSION/fs/usr/share
93 # use mv instead of 'cp -a' to save RAM
94 mv opt/openoffice* $PACKAGE-$VERSION/fs/usr/lib/openoffice
95 mv usr/share/mime $PACKAGE-$VERSION/fs/usr/share
96 mv usr/share/icons $PACKAGE-$VERSION/fs/usr/share
97 mv usr/bin $PACKAGE-$VERSION/fs/usr
99 # relocalized OOo libexec directory
100 sed -i 's#/opt/#/usr/lib/openoffice/#' $PACKAGE-$VERSION/fs/usr/bin/openoffice*
102 # Create receipt
103 cat > $PACKAGE-$VERSION/receipt <<EOT
104 # SliTaz package receipt.
106 PACKAGE="$PACKAGE"
107 VERSION="$VERSION"
108 CATEGORY="office"
109 SHORT_DESC="Productivity suite."
110 DEPENDS="java-jre"
111 WEB_SITE="$URL"
113 post_install()
114 {
115 cd \$1/usr/share/applications
116 ln -s /usr/lib/openoffice/openoffice.org3/share/xdg/base.desktop openoffice.org3-base.desktop
117 ln -s /usr/lib/openoffice/openoffice.org3/share/xdg/impress.desktop openoffice.org3-impress.desktop
118 ln -s /usr/lib/openoffice/openoffice.org3/share/xdg/writer.desktop openoffice.org3-writer.desktop
119 ln -s /usr/lib/openoffice/openoffice.org3/share/xdg/calc.desktop openoffice.org3-calc.desktop
120 ln -s /usr/lib/openoffice/openoffice.org3/share/xdg/math.desktop openoffice.org3-math.desktop
121 ln -s /usr/lib/openoffice/openoffice.org3/share/xdg/draw.desktop openoffice.org3-draw.desktop
122 ln -s /usr/lib/openoffice/openoffice.org3/share/xdg/printeradmin.desktop openoffice.org3-printeradmin.desktop
124 cd \$1/usr/bin
125 ln -sf /usr/lib/openoffice/openoffice.org3/program/soffice
126 }
128 post_remove()
129 {
130 rm -f \$1/usr/share/applications/openoffice.org3-*
131 }
133 EOT
135 fake_install()
136 {
137 mkdir -p $ROOT/var/lib/tazpkg/installed/$PACKAGE
138 echo "00000000000000000000000000000000 $PACKAGE-$VERSION.tazpkg" >> \
139 $ROOT/var/lib/tazpkg/installed.md5
140 [ -s $1/description.txt $ROOT/var/lib/tazpkg/installed/$PACKAGE
141 ( cd fs ; find *) | sed 's|^|/|' > \
142 $ROOT/var/lib/tazpkg/installed/$PACKAGE/files.list
143 if grep -q ^CONFIG_FILES= $1/receipt ; then
144 cd fs
145 find $( . ./receipt ; echo " $CONFIG_FILES" | sed 's| /| |g') |\
146 cpio -o -H newc | gzip -9 > \
147 $ROOT/var/lib/tazpkg/installed/$PACKAGE/volatile.cpio.gz
148 for i in $( . ./receipt ; echo $CONFIG_FILES) ; do
149 [ -e $ROOT$i ] && rm -rf .$i
150 done
151 cd ..
152 fi
153 sed -i "s/^PACKAGE=/UNPACKED_SIZE=\"$(du -chs $1 | sed '$!d;s/.total//')\"\n&/" \
154 $1/receipt
155 cp $1/receipt $ROOT/var/lib/tazpkg/installed/$PACKAGE
156 echo "Compute md5sum..."
157 find fs -type f | xargs md5sum | sed 's| fs/| /|' > \
158 $ROOT/var/lib/tazpkg/installed/$PACKAGE/md5sum
159 echo "Move files..."
160 ( cd $1/fs ; find ) | while read file ; do
161 [ -e $1/fs/$file -a ! -e $ROOT/$file ] &&
162 mv $1/fs/$file $(dirname $ROOT/$file)
163 done
164 }
165 set +e