get-scripts view openoffice3 @ rev 56

Update wifi firmware scripts (again)
author Pascal Bellard <pascal.bellard@slitaz.org>
date Sat Apr 23 17:50:46 2016 +0200 (2016-04-23)
parents 2cdf3e534506
children 62d94e6800db
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" ] || continue
37 [ "$1" == "--get-version" ] && echo $VERSION && exit
38 break
39 done
41 if [ -z "$VERSION" ]; then
42 abort_package "Can't find VERSION. Abort."
43 fi
44 echo "Selecting $DIR version $VERSION ..."
45 TARBALL="$(wget -O - $MIRROR/$DIR/$VERSION/ \
46 2> /dev/null | grep $PATTERN | tail -1 | sed 's/.*href=\"\(.*\)\".*/\1/')"
47 echo "Archive is $TARBALL ..."
48 WGET_URL=$MIRROR/$DIR/$VERSION/$TARBALL
50 TEMP_DIR="/tmp/$PACKAGE.$$"
51 CUR_DIR=$(pwd)
52 SOURCE_DIR="/tmp/src.$$"
53 EXCLUDE="kde|gnome|test"
54 LOG="/tmp/$(basename $0 .sh).log"
56 # Check if we have the tarball before.
57 if [ ! -f $SOURCE_DIR/$TARBALL ]; then
58 echo "Downloading OppenOffice.org tarball (it's time to have a break)... "
59 #Check if $SOURCE_DIR exist
60 test -d $SOURCE_DIR || mkdir -p $SOURCE_DIR
61 # Get the file.
62 wget -c $WGET_URL -O $SOURCE_DIR/$TARBALL
63 status
64 fi
65 if [ ! -f $SOURCE_DIR/$TARBALL ]; then
66 rm -rf $SOURCE_DIR
67 abort_package "Could not download $TARBALL. Exiting."
68 fi
70 # Creates TEMP_DIR and extract tarball
71 mkdir -p $TEMP_DIR
72 echo -n "Extract files from archive..."
73 tar xvzf $SOURCE_DIR/$TARBALL -C $TEMP_DIR > $LOG 2>&1 ||
74 abort_package "Failed to extract $TARBALL"
75 status
77 # extracted pkg can be removed: Save RAM
78 rm -rf $SOURCE_DIR
80 cd $TEMP_DIR/*/RPMS
82 # Extract everything from RPMS
83 for i in *.rpm
84 do
85 if (! echo $i | egrep -qi $EXCLUDE); then
86 (rpm2cpio $i | cpio -id >> $LOG 2>&1 ) && rm -f $i
87 fi
88 done
89 rpm2cpio desktop-integration/*freedesktop*.rpm | cpio -id >> $LOG 2>&1
91 # extracted pkg can be removed: Save RAM
92 rm -f desktop-integration/*freedesktop*.rpm
95 # Make the package
96 mkdir -p $PACKAGE-$VERSION/fs/usr/lib/openoffice \
97 $PACKAGE-$VERSION/fs/usr/share
99 # use mv instead of 'cp -a' to save RAM
100 mv opt/openoffice* $PACKAGE-$VERSION/fs/usr/lib/openoffice
101 mv usr/share/mime $PACKAGE-$VERSION/fs/usr/share
102 mv usr/share/icons $PACKAGE-$VERSION/fs/usr/share
103 mv usr/bin $PACKAGE-$VERSION/fs/usr
105 # relocalized OOo libexec directory
106 sed -i 's#/opt/#/usr/lib/openoffice/#' $PACKAGE-$VERSION/fs/usr/bin/openoffice*
108 # Create receipt
109 cat > $PACKAGE-$VERSION/receipt <<EOT
110 # SliTaz package receipt.
112 PACKAGE="$PACKAGE"
113 VERSION="$VERSION"
114 CATEGORY="$CATEGORY"
115 SHORT_DESC="$SHORT_DESC"
116 DEPENDS="java-jre"
117 WEB_SITE="$WEB_SITE"
119 post_install()
120 {
121 cd \$1/usr/share/applications
122 ln -s /usr/lib/openoffice/openoffice.org3/share/xdg/base.desktop openoffice.org3-base.desktop
123 ln -s /usr/lib/openoffice/openoffice.org3/share/xdg/impress.desktop openoffice.org3-impress.desktop
124 ln -s /usr/lib/openoffice/openoffice.org3/share/xdg/writer.desktop openoffice.org3-writer.desktop
125 ln -s /usr/lib/openoffice/openoffice.org3/share/xdg/calc.desktop openoffice.org3-calc.desktop
126 ln -s /usr/lib/openoffice/openoffice.org3/share/xdg/math.desktop openoffice.org3-math.desktop
127 ln -s /usr/lib/openoffice/openoffice.org3/share/xdg/draw.desktop openoffice.org3-draw.desktop
128 ln -s /usr/lib/openoffice/openoffice.org3/share/xdg/printeradmin.desktop openoffice.org3-printeradmin.desktop
130 cd \$1/usr/bin
131 ln -sf /usr/lib/openoffice/openoffice.org3/program/soffice
132 }
134 post_remove()
135 {
136 rm -f \$1/usr/share/applications/openoffice.org3-*
137 }
139 EOT
141 fake_install()
142 {
143 mkdir -p $ROOT/var/lib/tazpkg/installed/$PACKAGE
144 echo "00000000000000000000000000000000 $PACKAGE-$VERSION.tazpkg" >> \
145 $ROOT/var/lib/tazpkg/installed.md5
146 [ -s $1/description.txt $ROOT/var/lib/tazpkg/installed/$PACKAGE
147 ( cd fs ; find *) | sed 's|^|/|' > \
148 $ROOT/var/lib/tazpkg/installed/$PACKAGE/files.list
149 if grep -q ^CONFIG_FILES= $1/receipt ; then
150 cd fs
151 find $( . ./receipt ; echo " $CONFIG_FILES" | sed 's| /| |g') |\
152 cpio -o -H newc | gzip -9 > \
153 $ROOT/var/lib/tazpkg/installed/$PACKAGE/volatile.cpio.gz
154 for i in $( . ./receipt ; echo $CONFIG_FILES) ; do
155 [ -e $ROOT$i ] && rm -rf .$i
156 done
157 cd ..
158 fi
159 sed -i "s/^PACKAGE=/UNPACKED_SIZE=\"$(du -chs $1 | sed '$!d;s/.total//')\"\n&/" \
160 $1/receipt
161 cp $1/receipt $ROOT/var/lib/tazpkg/installed/$PACKAGE
162 echo "Compute md5sum..."
163 find fs -type f | xargs md5sum | sed 's| fs/| /|' > \
164 $ROOT/var/lib/tazpkg/installed/$PACKAGE/md5sum
165 echo "Move files..."
166 ( cd $1/fs ; find ) | while read file ; do
167 [ -e $1/fs/$file -a ! -e $ROOT/$file ] &&
168 mv $1/fs/$file $(dirname $ROOT/$file)
169 done
170 }
171 [ "$PWD" != "$tmp_dir" ] && mv $PACKAGE-$VERSION $tmp_dir || true
172 cd $tmp_dir