wok annotate get-OpenOffice3/stuff/get-OpenOffice3 @ rev 21807

Up vlc (3.0.6) again
author Pascal Bellard <pascal.bellard@slitaz.org>
date Fri Aug 16 08:34:09 2019 +0200 (2019-08-16)
parents 05c57ff37237
children c07aaa614a02
rev   line source
erjo@1694 1 #!/bin/sh
erjo@1694 2 # get-OpenOffice3, install everything for OpenOffice.org exept KDE/Gnome integration and testsuite.
erjo@1694 3 #
erjo@1694 4 # (C) 2008 SliTaz - GNU General Public License v3.
erjo@1694 5 #
erjo@1694 6 # Author : Eric Joseph-Alexandre <erjo@slitaz.org>
erjo@1694 7
erjo@1694 8 PACKAGE="OpenOffice3"
erjo@1694 9 URL="http://www.openoffice.org"
pascal@1713 10 ROOT="$1"
pascal@6699 11 PATTERN="Linux_x86_install-rpm"
erjo@1694 12
pascal@7542 13 for MIRROR in \
pascal@7542 14 http://mirror.switch.ch/ftp/mirror/OpenOffice \
pascal@7542 15 http://openoffice.cict.fr \
pascal@7542 16 http://wwwftp.ciril.fr/pub/openoffice \
pascal@7542 17 http://artfiles.org/openoffice.org \
pascal@7542 18 http://vesta.informatik.rwth-aachen.de/ftp/pub/mirror/OpenOffice \
pascal@7542 19 http://ftp.ntua.gr/pub/OpenOffice \
pascal@7542 20 http://ftp.iitm.ac.in/openoffice \
pascal@7542 21 http://www.ring.gr.jp/archives/misc/openoffice \
pascal@7542 22 http://ftp.nluug.nl/pub/office/openoffice \
pascal@7542 23
pascal@13705 24 do
pascal@13705 25 wget -O - $MIRROR/ 2> /dev/null | grep -q localized || continue
pascal@13705 26 DIR="stable"
pascal@13705 27 LOC=$(wget -O - $MIRROR/localized/ 2> /dev/null | \
pascal@13705 28 grep -E ">$LANG/|>${LANG/_/-}/|>${LANG%_*}/" | \
pascal@13705 29 head -1 | sed 's/.*href=\"\(.*\)\/\".*/\1/')
pascal@13705 30 [ -n "$LOC" ] && DIR="localized/$LOC"
pascal@13710 31 VERSION="$(basename $(wget -O - $MIRROR/$DIR/ 2> /dev/null | grep \
pascal@13710 32 href=\"[0-9] | tail -1 | sed 's/.*href=\"\(.*\)\".*/\1/') 2> /dev/null)"
pascal@13705 33 [ -n "$VERSION" ] && break
pascal@13705 34 done
pascal@7542 35
pascal@2203 36 if [ -z "$VERSION" ]; then
pascal@2203 37 echo "Can't find VERSION. Abort."
pascal@2203 38 exit 0
pascal@2203 39 fi
pascal@6699 40 echo "Selecting $DIR version $VERSION ..."
pascal@7542 41 TARBALL="$(wget -O - $MIRROR/$DIR/$VERSION/ \
pascal@6699 42 2> /dev/null | grep $PATTERN | tail -1 | sed 's/.*href=\"\(.*\)\".*/\1/')"
pascal@6699 43 echo "Archive is $TARBALL ..."
pascal@7542 44 WGET_URL=$MIRROR/$DIR/$VERSION/$TARBALL
erjo@1694 45
jozee@2965 46 TEMP_DIR="/tmp/$PACKAGE.$$"
pascal@13705 47 CUR_DIR=$(pwd)
pascal@3893 48 SOURCE_DIR="/tmp/src.$$"
erjo@1694 49 EXCLUDE="kde|gnome|test"
erjo@1694 50 LOG="/tmp/$(basename $0 .sh).log"
erjo@1694 51
erjo@1694 52 # Status function with color (supported by Ash).
erjo@1694 53 status()
erjo@1694 54 {
erjo@1694 55 local CHECK=$?
erjo@1694 56 echo -en "\\033[70G[ "
erjo@1694 57 if [ $CHECK = 0 ]; then
erjo@1694 58 echo -en "\\033[1;33mOK"
erjo@1694 59 else
erjo@1694 60 echo -en "\\033[1;31mFailed"
erjo@1694 61 fi
erjo@1694 62 echo -e "\\033[0;39m ]"
erjo@1694 63 return $CHECK
erjo@1694 64 }
erjo@1694 65
erjo@1694 66 # Check if user is root to install, or remove packages.
erjo@1694 67 check_root()
erjo@1694 68 {
erjo@1694 69 if test $(id -u) != 0 ; then
erjo@1694 70 echo -e "\nYou must be root to run `basename $0` with this option."
erjo@1694 71 echo -e "Please use 'su' and root password to become super-user.\n"
erjo@1694 72 exit 0
erjo@1694 73 fi
erjo@1694 74 }
erjo@1694 75
erjo@1694 76 check_if_installed()
erjo@1694 77 {
erjo@1694 78 # Avoid reinstall
pascal@1713 79 if [ -d $ROOT/var/lib/tazpkg/installed/$PACKAGE ];then
erjo@1694 80 return 0
erjo@1694 81 else
erjo@1694 82 return 1
erjo@1694 83 fi
erjo@1694 84 }
erjo@1694 85
erjo@1694 86 #We need to bee root
erjo@1694 87 check_root
erjo@1694 88
erjo@1694 89 #check if package already installed
erjo@1694 90 if (check_if_installed $PACKAGE); then
erjo@1694 91 echo "$PACKAGE is already installed."
pascal@1713 92 [ -n "$ROOT" ] && exit 0
erjo@1694 93 echo -n "Would you like to remove and reinstall this package [y/n]? "
erjo@1694 94 read answer
erjo@1694 95 case "$answer" in
erjo@1694 96 y|Y)
erjo@1694 97 tazpkg remove $PACKAGE ;;
erjo@1694 98 *)
erjo@1694 99 exit 0 ;;
erjo@1694 100 esac
erjo@1694 101
erjo@1694 102 fi
erjo@1694 103
erjo@1694 104
erjo@1694 105 # Check if we have the tarball before.
erjo@1694 106 if [ ! -f $SOURCE_DIR/$TARBALL ]; then
erjo@1694 107 echo "Downloading OppenOffice.org tarball (it's time to have a break)... "
erjo@1694 108 #Check if $SOURCE_DIR exist
erjo@1694 109 test -d $SOURCE_DIR || mkdir -p $SOURCE_DIR
erjo@1694 110 # Get the file.
erjo@1694 111 wget -c $WGET_URL -O $SOURCE_DIR/$TARBALL
jozee@4986 112 status
erjo@1694 113 fi
pascal@3893 114 if [ ! -f $SOURCE_DIR/$TARBALL ]; then
pascal@3893 115 rm -rf $SOURCE_DIR
pascal@3893 116 echo "Could not download $TARBALL. Exiting."
pascal@3893 117 exit 1
pascal@3893 118 fi
erjo@1694 119
pascal@2203 120 # Creates TEMP_DIR and extract tarball
erjo@1694 121 mkdir -p $TEMP_DIR
erjo@1694 122 echo -n "Extract files from archive..."
erjo@1694 123 tar xvzf $SOURCE_DIR/$TARBALL -C $TEMP_DIR > $LOG 2>&1 || \
erjo@1694 124 (echo "Failed to extract $TARBALL" ; exit 1)
erjo@1694 125 status
erjo@1694 126
jozee@5011 127 # extracted pkg can be removed: Save RAM
jozee@5011 128 rm -rf $SOURCE_DIR
jozee@5011 129
erjo@1694 130 cd $TEMP_DIR/*/RPMS
erjo@1694 131
erjo@1694 132 # Extract everything from RPMS
erjo@1694 133 for i in *.rpm
erjo@1694 134 do
erjo@1694 135 if (! echo $i | egrep -qi $EXCLUDE); then
jozee@5012 136 (rpm2cpio $i | cpio -id >> $LOG 2>&1 ) && rm -f $i
erjo@1694 137 fi
erjo@1694 138 done
erjo@1694 139 rpm2cpio desktop-integration/*freedesktop*.rpm | cpio -id >> $LOG 2>&1
erjo@1694 140
jozee@4984 141 # extracted pkg can be removed: Save RAM
jozee@4984 142 rm -f desktop-integration/*freedesktop*.rpm
jozee@5011 143
jozee@4984 144
erjo@1694 145 # Make the package
erjo@1694 146 mkdir -p $PACKAGE-$VERSION/fs/usr/lib/openoffice \
erjo@1694 147 $PACKAGE-$VERSION/fs/usr/share
jozee@5011 148
jozee@5011 149 # use mv instead of 'cp -a' to save RAM
jozee@5011 150 mv opt/openoffice* $PACKAGE-$VERSION/fs/usr/lib/openoffice
jozee@5011 151 mv usr/share/mime $PACKAGE-$VERSION/fs/usr/share
jozee@5011 152 mv usr/share/icons $PACKAGE-$VERSION/fs/usr/share
jozee@5011 153 mv usr/bin $PACKAGE-$VERSION/fs/usr
erjo@1694 154
erjo@1694 155 # relocalized OOo libexec directory
erjo@1698 156 sed -i 's#/opt/#/usr/lib/openoffice/#' $PACKAGE-$VERSION/fs/usr/bin/openoffice*
erjo@1694 157
erjo@1694 158 # Create receipt
erjo@1694 159 cat > $PACKAGE-$VERSION/receipt <<EOT
erjo@1694 160 # SliTaz package receipt.
erjo@1694 161
erjo@1694 162 PACKAGE="$PACKAGE"
erjo@1694 163 VERSION="$VERSION"
erjo@1694 164 CATEGORY="office"
erjo@1694 165 SHORT_DESC="Productivity suite."
pascal@13705 166 DEPENDS="java-jre"
erjo@1694 167 WEB_SITE="$URL"
erjo@1694 168
erjo@1694 169 post_install()
erjo@1694 170 {
pascal@13706 171 cd \$1/usr/share/applications
erjo@1694 172 ln -s /usr/lib/openoffice/openoffice.org3/share/xdg/base.desktop openoffice.org3-base.desktop
erjo@1694 173 ln -s /usr/lib/openoffice/openoffice.org3/share/xdg/impress.desktop openoffice.org3-impress.desktop
erjo@1694 174 ln -s /usr/lib/openoffice/openoffice.org3/share/xdg/writer.desktop openoffice.org3-writer.desktop
erjo@1694 175 ln -s /usr/lib/openoffice/openoffice.org3/share/xdg/calc.desktop openoffice.org3-calc.desktop
erjo@1694 176 ln -s /usr/lib/openoffice/openoffice.org3/share/xdg/math.desktop openoffice.org3-math.desktop
erjo@1694 177 ln -s /usr/lib/openoffice/openoffice.org3/share/xdg/draw.desktop openoffice.org3-draw.desktop
erjo@1694 178 ln -s /usr/lib/openoffice/openoffice.org3/share/xdg/printeradmin.desktop openoffice.org3-printeradmin.desktop
erjo@1694 179
pascal@13706 180 cd \$1/usr/bin
erjo@1694 181 ln -sf /usr/lib/openoffice/openoffice.org3/program/soffice
erjo@1694 182 }
erjo@1694 183
erjo@1694 184 post_remove()
erjo@1694 185 {
pascal@13706 186 rm -f \$1/usr/share/applications/openoffice.org3-*
erjo@1694 187 }
erjo@1694 188
erjo@1694 189 EOT
erjo@1694 190
pascal@13706 191 fake_install()
pascal@13706 192 {
pascal@13706 193 mkdir -p $ROOT/var/lib/tazpkg/installed/$PACKAGE
pascal@13706 194 echo "00000000000000000000000000000000 $PACKAGE-$VERSION.tazpkg" >> \
pascal@13706 195 $ROOT/var/lib/tazpkg/installed.md5
pascal@13706 196 [ -s $1/description.txt $ROOT/var/lib/tazpkg/installed/$PACKAGE
pascal@13706 197 ( cd fs ; find *) | sed 's|^|/|' > \
pascal@13706 198 $ROOT/var/lib/tazpkg/installed/$PACKAGE/files.list
pascal@13706 199 if grep -q ^CONFIG_FILES= $1/receipt ; then
pascal@13706 200 cd fs
pascal@13706 201 find $( . ./receipt ; echo " $CONFIG_FILES" | sed 's| /| |g') |\
pascal@13706 202 cpio -o -H newc | gzip -9 > \
pascal@13706 203 $ROOT/var/lib/tazpkg/installed/$PACKAGE/volatile.cpio.gz
pascal@13706 204 for i in $( . ./receipt ; echo $CONFIG_FILES) ; do
pascal@13706 205 [ -e $ROOT$i ] && rm -rf .$i
pascal@13706 206 done
pascal@13706 207 cd ..
pascal@13706 208 fi
pascal@13706 209 sed -i "s/^PACKAGE=/UNPACKED_SIZE=\"$(du -chs $1 | sed '$!d;s/.total//')\"\n&/" \
pascal@13706 210 $1/receipt
pascal@13706 211 cp $1/receipt $ROOT/var/lib/tazpkg/installed/$PACKAGE
pascal@13706 212 echo "Compute md5sum..."
pascal@13710 213 find fs -type f | xargs md5sum | sed 's| fs/| /|' > \
pascal@13706 214 $ROOT/var/lib/tazpkg/installed/$PACKAGE/md5sum
pascal@13706 215 echo "Move files..."
pascal@13706 216 ( cd $1/fs ; find ) | while read file ; do
pascal@13706 217 [ -e $1/fs/$file -a ! -e $ROOT/$file ] &&
pascal@13706 218 mv $1/fs/$file $(dirname $ROOT/$file)
pascal@13706 219 done
pascal@13706 220 }
erjo@1694 221
pascal@13706 222 case " $@ " in
pascal@13706 223 *\ --q*) # --quick
pascal@13706 224 fake_install $PACKAGE-$VERSION ;;
pascal@13706 225 *)
pascal@13706 226 # Pack
pascal@13706 227 tazpkg pack $PACKAGE-$VERSION
jozee@4984 228
pascal@13706 229 # Clean to save RAM memory
pascal@13706 230 rm -rf $PACKAGE-$VERSION
pascal@13706 231
pascal@13706 232 # Install pseudo package
pascal@13706 233 tazpkg install $PACKAGE-$VERSION.tazpkg --root=$ROOT
pascal@13706 234
pascal@13706 235 echo " $@ " | grep -q ' --k' &&
pascal@13706 236 mv $PACKAGE-$VERSION.tazpkg $CUR_DIR
pascal@13706 237 ;;
pascal@13705 238 esac
erjo@1694 239
pascal@13706 240 cd $CUR_DIR
pascal@13706 241
erjo@1694 242 # Clean
pascal@13706 243 rm -rf $TEMP_DIR