# HG changeset patch # User Hans-G?nter Theisgen # Date 1581089209 -3600 # Node ID be5fbd5b2c7ad8b13900195019b9651d78d52ebf # Parent d77b60725297057217bc3d5e9eb22f6383be0871 modified get-OpenOffice3 diff -r d77b60725297 -r be5fbd5b2c7a get-OpenOffice3/receipt --- a/get-OpenOffice3/receipt Fri Feb 07 16:15:46 2020 +0100 +++ b/get-OpenOffice3/receipt Fri Feb 07 16:26:49 2020 +0100 @@ -1,19 +1,24 @@ # SliTaz package receipt. PACKAGE="get-OpenOffice3" -VERSION="1.2" +VERSION="1.20" CATEGORY="office" -SHORT_DESC="Productivity suite" +TAGS="office word excel ppt openoffice" +SHORT_DESC="Productivity suite." MAINTAINER="erjo@slitaz.org" LICENSE="GPL3" -WEB_SITE="http://www.openoffice.org" -TAGS="office word excel ppt openoffice" +WEB_SITE="https://openoffice.org" # Rules to gen a SliTaz package suitable for Tazpkg. genpkg_rules() { mkdir -p $fs/usr/bin - install -o root -g root -m755 stuff/get-OpenOffice3 $fs/usr/bin + install -o root -g root -m755 stuff/get-OpenOffice3 $fs/usr/bin ln -s get-OpenOffice3 $fs/usr/bin/get-openoffice } +post_install() +{ + echo "Now you may enter: +get-openoffice" +} diff -r d77b60725297 -r be5fbd5b2c7a get-OpenOffice3/stuff/get-OpenOffice3 --- a/get-OpenOffice3/stuff/get-OpenOffice3 Fri Feb 07 16:15:46 2020 +0100 +++ b/get-OpenOffice3/stuff/get-OpenOffice3 Fri Feb 07 16:26:49 2020 +0100 @@ -1,159 +1,191 @@ #!/bin/sh # get-OpenOffice3, install everything for OpenOffice.org exept KDE/Gnome integration and testsuite. # -# (C) 2008 SliTaz - GNU General Public License v3. +# (C) 2020 SliTaz - GNU General Public License v3. # # Author : Eric Joseph-Alexandre +# modified by HGT on 2020-02-07 +# +# === Initialisations === +PKGS_DB="/var/lib/tazpkg" # packages database directory PACKAGE="OpenOffice3" -URL="http://www.openoffice.org" -ROOT="$1" +WEB_SITE="https://openoffice.org" +CATEGORY="office" +DEPENDS="java-jre" + PATTERN="Linux_x86_install-rpm" +EXCLUDE="kde|gnome|test" -for MIRROR in \ -http://mirror.switch.ch/ftp/mirror/OpenOffice \ -http://openoffice.cict.fr \ -http://wwwftp.ciril.fr/pub/openoffice \ -http://artfiles.org/openoffice.org \ -http://vesta.informatik.rwth-aachen.de/ftp/pub/mirror/OpenOffice \ -http://ftp.ntua.gr/pub/OpenOffice \ -http://ftp.iitm.ac.in/openoffice \ -http://www.ring.gr.jp/archives/misc/openoffice \ -http://ftp.nluug.nl/pub/office/openoffice \ +# Declare functions check_root, status, ... +. /lib/libtaz.sh +# and make commandline options (if any) available as variables -do - wget -O - $MIRROR/ 2> /dev/null | grep -q localized || continue - DIR="stable" - LOC=$(wget -O - $MIRROR/localized/ 2> /dev/null | \ - grep -E ">$LANG/|>${LANG/_/-}/|>${LANG%_*}/" | \ - head -1 | sed 's/.*href=\"\(.*\)\/\".*/\1/') - [ -n "$LOC" ] && DIR="localized/$LOC" - VERSION="$(basename $(wget -O - $MIRROR/$DIR/ 2> /dev/null | grep \ - href=\"[0-9] | tail -1 | sed 's/.*href=\"\(.*\)\".*/\1/') 2> /dev/null)" - [ -n "$VERSION" ] && break -done - -if [ -z "$VERSION" ]; then - echo "Can't find VERSION. Abort." - exit 0 -fi -echo "Selecting $DIR version $VERSION ..." -TARBALL="$(wget -O - $MIRROR/$DIR/$VERSION/ \ - 2> /dev/null | grep $PATTERN | tail -1 | sed 's/.*href=\"\(.*\)\".*/\1/')" -echo "Archive is $TARBALL ..." -WGET_URL=$MIRROR/$DIR/$VERSION/$TARBALL - -TEMP_DIR="/tmp/$PACKAGE.$$" -CUR_DIR=$(pwd) -SOURCE_DIR="/tmp/src.$$" -EXCLUDE="kde|gnome|test" -LOG="/tmp/$(basename $0 .sh).log" - -# Status function with color (supported by Ash). -status() +is_installed() { - local CHECK=$? - echo -en "\\033[70G[ " - if [ $CHECK = 0 ]; then - echo -en "\\033[1;33mOK" - else - echo -en "\\033[1;31mFailed" - fi - echo -e "\\033[0;39m ]" - return $CHECK -} - -# Check if user is root to install, or remove packages. -check_root() -{ - if test $(id -u) != 0 ; then - echo -e "\nYou must be root to run `basename $0` with this option." - echo -e "Please use 'su' and root password to become super-user.\n" - exit 0 - fi -} - -check_if_installed() -{ - # Avoid reinstall - if [ -d $ROOT/var/lib/tazpkg/installed/$PACKAGE ];then + if [ -d $ROOT$PKGS_DB/installed/$PACKAGE ] + then #package is deemed to be installed return 0 - else + else return 1 fi } -#We need to bee root +# Show commandline options, if requested by --help +if [ "$help" == "yes" ] + then + echo "Commandline options: + $0 + --version= + --root= + --install=yes|no|quick + --keep=no|yes + --tmpdir= + --logfile=" + exit +fi + +# Check for system administrator privileges check_root -#check if package already installed -if (check_if_installed $PACKAGE); then - echo "$PACKAGE is already installed." - [ -n "$ROOT" ] && exit 0 - echo -n "Would you like to remove and reinstall this package [y/n]? " - read answer - case "$answer" in - y|Y) - tazpkg remove $PACKAGE ;; - *) - exit 0 ;; - esac - +title "Package $PACKAGE will be build as SliTaz package and installed" + +# Fetch latest version, unless version is set by option --version +[ -z "$version" ] && version="latest" + +# Install SliTaz package, unless inhibited by option --install=no +[ -z "$install" ] && install="yes" + +# Delete SliTaz package file $PACKAGE-$VERSION.tazpkg after installation, +# unless option --keep=yes is given +[ -z "$keep" ] && keep="no" + +# Directory for temporary files +[ -z "$tempdir" ] && TMP_DIR="/tmp/get-$PACKAGE" + +# Logging file +[ -z "$logfile" ] && LOG=$TMP_DIR/get-$PACKAGE.log + +cat < /dev/null | grep -q localized || continue + DIR="stable" + LOC=$(wget -O - $MIRROR/localized/ 2> /dev/null | \ + grep -E ">$LANG<|>$LANG/<|>${LANG/_/-}<|>${LANG/_/-}/<|>${LANG%_*}<|>${LANG%_*}/<" | \ + head -1 | sed 's|.*href=\"\(.*\)/\".*|\1|') + [ -n "$LOC" ] && DIR="localized/$LOC" + VERSION="$(wget -O - $MIRROR/$DIR/ 2> /dev/null | \ + grep href=\"[0-9] | tail -1 | sed 's|.*href=\"\(.*\)/\".*|\1|' 2> /dev/null)" + [ -n "$VERSION" ] && break + done +TARBALL=$(wget -O - $MIRROR/$DIR/$VERSION/ 2> /dev/null | \ + grep $PATTERN | tail -1 | sed 's|.*href=\"\(.*\)\".*|\1|') +# bug in sed?: +TARBALL=${TARBALL%%\"*} +echo "Archive is $TARBALL ..." + +# Set VERSION, unless supplied by --version +if [ "$version" == "latest" ] + then + echo "Selecting $DIR version $VERSION from $MIRROR ..." + WGET_URL=$MIRROR/$DIR/$VERSION/$TARBALL + else + TARBALL=${TARBALL/$VERSION/$version} + VERSION=$version + WGET_URL="$MIRROR/$DIR/$VERSION/$TARBALL" fi - -# Check if we have the tarball before. -if [ ! -f $SOURCE_DIR/$TARBALL ]; then - echo "Downloading OppenOffice.org tarball (it's time to have a break)... " - #Check if $SOURCE_DIR exist - test -d $SOURCE_DIR || mkdir -p $SOURCE_DIR - # Get the file. - wget -c $WGET_URL -O $SOURCE_DIR/$TARBALL - status -fi -if [ ! -f $SOURCE_DIR/$TARBALL ]; then - rm -rf $SOURCE_DIR - echo "Could not download $TARBALL. Exiting." - exit 1 +# === Remove package, if installed === +if [ is_installed ] + then + action "Removing installed version..." + tazpkg remove $PACKAGE --root="$root/" + [ ! is_installed ] && + die "Can't remove installed version. Exiting." fi -# Creates TEMP_DIR and extract tarball -mkdir -p $TEMP_DIR -echo -n "Extract files from archive..." -busybox tar xvf $SOURCE_DIR/$TARBALL -C $TEMP_DIR > $LOG 2>&1 || \ +# === Fetch archive file, if not existing === + +CUR_DIR=$(pwd) +mkdir -p $TMP_DIR +cd $TMP_DIR +if [ -f $TARBALL ] + then + echo "Using existing archive file $TARBALL" + else + action "Fetching the archive" + newline + wget --no-check-certificate $WGET_URL + if [ ! -f $TARBALL ] + then + cd $CUR_DIR + rm -rf $TMP_DIR + echo "Could not transfer $TARBALL from $WGET_URL. Exiting." + exit 1 + fi +fi + +# === Extract files from archive === +action "Extracting the archive" +newline + +tar x -vf $TARBALL > $LOG 2>&1 || \ (echo "Failed to extract $TARBALL" ; exit 1) + status -# extracted pkg can be removed: Save RAM -rm -rf $SOURCE_DIR - -cd $TEMP_DIR/*/RPMS +# Remove archive file +rm -f $TARBALL # Extract everything from RPMS +cd $TMP_DIR/*/RPMS for i in *.rpm -do - if (! echo $i | egrep -qi $EXCLUDE); then - (rpm2cpio $i | cpio -id >> $LOG 2>&1 ) && rm -f $i + do + if (! echo $i | egrep -qi $EXCLUDE) + then + (rpm2cpio $i | cpio -id >> $LOG 2>&1 ) && + echo rm -f $i fi -done + done rpm2cpio desktop-integration/*freedesktop*.rpm | cpio -id >> $LOG 2>&1 -# extracted pkg can be removed: Save RAM +# extracted pkg can be removed rm -f desktop-integration/*freedesktop*.rpm +# Make the package +mkdir -p $PACKAGE-$VERSION/fs/usr/lib/openoffice +mkdir -p $PACKAGE-$VERSION/fs/usr/share -# Make the package -mkdir -p $PACKAGE-$VERSION/fs/usr/lib/openoffice \ - $PACKAGE-$VERSION/fs/usr/share - -# use mv instead of 'cp -a' to save RAM -mv opt/openoffice* $PACKAGE-$VERSION/fs/usr/lib/openoffice -mv usr/share/mime $PACKAGE-$VERSION/fs/usr/share -mv usr/share/icons $PACKAGE-$VERSION/fs/usr/share -mv usr/bin $PACKAGE-$VERSION/fs/usr +# use mv instead of 'cp -a' to save space +mv opt/openoffice* $PACKAGE-$VERSION/fs/usr/lib/openoffice +mv usr/share/mime $PACKAGE-$VERSION/fs/usr/share +mv usr/share/icons $PACKAGE-$VERSION/fs/usr/share +mv usr/bin $PACKAGE-$VERSION/fs/usr # relocalized OOo libexec directory -sed -i 's#/opt/#/usr/lib/openoffice/#' $PACKAGE-$VERSION/fs/usr/bin/openoffice* +sed -i 's#/opt/#/usr/lib/openoffice/#' \ + $PACKAGE-$VERSION/fs/usr/bin/openoffice* # Create receipt cat > $PACKAGE-$VERSION/receipt <> \ - $ROOT/var/lib/tazpkg/installed.md5 - [ -s $1/description.txt $ROOT/var/lib/tazpkg/installed/$PACKAGE + $root/var/lib/tazpkg/installed.md5 + [ -s $1/description.txt $root/var/lib/tazpkg/installed/$PACKAGE ( cd fs ; find *) | sed 's|^|/|' > \ - $ROOT/var/lib/tazpkg/installed/$PACKAGE/files.list - if grep -q ^CONFIG_FILES= $1/receipt ; then + $root/var/lib/tazpkg/installed/$PACKAGE/files.list + if grep -q ^CONFIG_FILES= $1/receipt + then cd fs - find $( . ./receipt ; echo " $CONFIG_FILES" | sed 's| /| |g') |\ + find $( . ./receipt ; echo " $CONFIG_FILES" | sed 's# /# #g') |\ cpio -o -H newc | gzip -9 > \ - $ROOT/var/lib/tazpkg/installed/$PACKAGE/volatile.cpio.gz - for i in $( . ./receipt ; echo $CONFIG_FILES) ; do - [ -e $ROOT$i ] && rm -rf .$i - done + $root/var/lib/tazpkg/installed/$PACKAGE/volatile.cpio.gz + for i in $( . ./receipt ; echo $CONFIG_FILES) + do + [ -e $root$i ] && rm -rf .$i + done cd .. fi sed -i "s/^PACKAGE=/UNPACKED_SIZE=\"$(du -chs $1 | sed '$!d;s/.total//')\"\n&/" \ $1/receipt - cp $1/receipt $ROOT/var/lib/tazpkg/installed/$PACKAGE + cp $1/receipt $root/var/lib/tazpkg/installed/$PACKAGE echo "Compute md5sum..." find fs -type f | xargs md5sum | sed 's| fs/| /|' > \ - $ROOT/var/lib/tazpkg/installed/$PACKAGE/md5sum + $root/var/lib/tazpkg/installed/$PACKAGE/md5sum echo "Move files..." - ( cd $1/fs ; find ) | while read file ; do - [ -e $1/fs/$file -a ! -e $ROOT/$file ] && - mv $1/fs/$file $(dirname $ROOT/$file) - done + ( cd $1/fs ; find ) | while read file + do + [ -e $1/fs/$file -a ! -e $root/$file ] && + mv $1/fs/$file $(dirname $root/$file) + done } -case " $@ " in -*\ --q*) # --quick - fake_install $PACKAGE-$VERSION ;; -*) - # Pack - tazpkg pack $PACKAGE-$VERSION +[ "$install" == "quick" ] && +fake_install $PACKAGE-$VERSION && return 0 - # Clean to save RAM memory - rm -rf $PACKAGE-$VERSION +# Pack +tazpkg pack $PACKAGE-$VERSION +# Remove package tree +rm -rf $PACKAGE-$VERSION - # Install pseudo package - tazpkg install $PACKAGE-$VERSION.tazpkg --root=$ROOT +# === Install the SliTaz package === +[ "$install" == "yes" ] && +tazpkg install $PACKAGE-$VERSION.tazpkg --root="$root" - echo " $@ " | grep -q ' --k' && - mv $PACKAGE-$VERSION.tazpkg $CUR_DIR - ;; -esac +# === Cleanup === +# Preserve package file, if requested +[ "$keep" == "yes" ] && +( mv $PACKAGE-$VERSION.tazpkg $CUR_DIR && + echo Saved $PACKAGE-$VERSION.tazpkg to $CUR_DIR ) +# Remove temporary build directory cd $CUR_DIR - -# Clean -rm -rf $TEMP_DIR +rm -rf $TMP_DIR