get-scripts annotate openoffice3 @ rev 70

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