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