get-scripts view openoffice3 @ rev 36

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