get-scripts view openoffice3 @ rev 74

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