Re: Help needed with new LibreOffice 4.0 download plz.

[ Thread Index | Date Index | More lists.tuxfamily.org/slitaz Archives ]


Thanks very much Mojo.

We found where to insert the changes you suggested.
It does indeed start downloading the basic LibO package, but
it appears that the name "LibO" in the script must be wrong, as it does
not lead us anywhere in the end...

When we changed it to "LibreOffice" in all places in the script, then
the whole thing started moving forward nicely.
But again, the script stopped wotking when it tried to download the
lang-pack.
We found that there was also a wrong name (langpack_rpm) of this
language package
and we changed it to "rpm_langpack", at which point the script
downloaded the full LibreOffice AND the lang-pack
but it eventually got stuck again at the stage of 'untar-ing' in tmp.

We are attaching the slightly changed script and we'll be grateful for
any further ideas...

Thanks

Constantine

PS.

Our efforts to promote a wider use of SliTaz in Greece find some
difficulty by the fact that there is not even a
Greek keyboard locale. Would it please be possible to take care of this??



On 11/02/2013 08:46 πμ, mojo wrote:
> On Fri, Feb 8, 2013 at 5:30 PM, Kostas Mousafiris <kvisitor@xxxxxxxxx> wrote:
>> I tried another couple of Slitaz new installations tonight with some
>> really old PCs :-)
>> I would have been pretty happy about how it went,
>> had it not been for a little problem with installing the new LibreOffice
>> edition 4.00
>>
>> The usual address that I was using for my previous installations does
>> not seem to work anymore...
>> I tried to fiddle around a bit by copying the download addresses taken
>> from the official LibO site:
>>
>> https://www.libreoffice.org/download/?type=rpm-x86&lang=en-US
>> and
>>
> https://www.libreoffice.org/download/?type=rpm-x86&lang=en-US&version=4.0.0
> Main Install Download Button:
> http://download.documentfoundation.org/libreoffice/stable/4.0.0/rpm/x86/LibreOffice_4.0.0_Linux_x86_rpm.tar.gz
>
> /usr/bin/get-LibreOffice:
> Change
> SUFFIX="Linux_x86_install-rpm_en-US.tar.gz"
> to
> SUFFIX="Linux_x86_rpm.tar.gz"
>

#!/bin/sh
# get-LibreOffice - install LibreOffice excl. KDE/Gnome integration & test suite.
#
# (C) 2010 SliTaz - GNU General Public License v3.
# Author : Ben Arnold <ben@xxxxxxxxxxxxxxxxxxxx>
#    via : get-OpenOffice3 (Eric Joseph-Alexandre <erjo@xxxxxxxxxx>)
#

PACKAGE="LibreOffice"
URL="http://www.libreoffice.org";
ROOT="$1"
DIR="stable"
SUFFIX="Linux_x86_rpm.tar.gz"
WGET_URL="http://download.documentfoundation.org/libreoffice/$DIR";

VERSION="$(basename $(wget -O - $WGET_URL/ 2> /dev/null | \
	sed '/href=\"[0-9]/!d;s/.*href=\"//;s/[/\">].*//' | tail -1))"
if [ -z "$VERSION" ]; then
	echo "Can't detect an appropriate version. The version numbering or URL may have changed. Aborted."
	exit 0
fi
VER="${VERSION/\-/}" # without hyphens


TARBALL="LibreOffice_${VER}_${SUFFIX}"

for LOC in ${LANG/_/-} ${LANG%_*}; do
	L_SUFFIX="Linux_x86_rpm_langpack_$LOC.tar.gz"
	L_TARBALL="LibreOffice_${VER}_${L_SUFFIX}"
	LANG_URL="$WGET_URL/${VERSION}/rpm/x86/${L_TARBALL}"
	busybox wget -s $LANG_URL 2> /dev/null || continue
	echo "Added $LANG ($LOC)."
	break
done
WGET_URL="$WGET_URL/${VERSION}/rpm/x86/${TARBALL}"

CUR_DIR=$(pwd)
TEMP_DIR="/tmp/$PACKAGE.$$"
SOURCE_DIR="/tmp/src.$$"
EXCLUDE="kde|gnome|test"
LOG="/tmp/$(basename $0 .sh).log"


# Status function with color (supported by Ash).
status()
{
	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
	 	return 0
	 else
	 	return 1
	 fi
}

# We need to be root
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

fi


# Check if we have the tarball before.
if [ ! -f $SOURCE_DIR/$TARBALL ]; then
	echo "Downloading LibreOffice 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
	if [ -n $L_TARBALL ] ; then # Are we localised?
		wget -c $LANG_URL -O $SOURCE_DIR/$L_TARBALL
	fi
	status
fi
if [ ! -f $SOURCE_DIR/$TARBALL ]; then
	rm -rf $SOURCE_DIR
	echo "Could not download $TARBALL. Exiting."
	exit 1
fi

echo -n "Extracting files (this may take a while): "

# Creates TEMP_DIR and extract tarball
mkdir -p $TEMP_DIR
for TB in $TARBALL $L_TARBALL ; do
	tar xvzf $SOURCE_DIR/$TB -C $TEMP_DIR > $LOG 2>&1 || \
	(echo "Failed to extract $TB" ; exit 1)
done

# Get version found in archive (often directory is still RC version when final is present)
ARCHIVED_VERSION=`find $TEMP_DIR -type d 2> /dev/null | grep LibreOffice | head -n 1 | sed 's/_/ /g' | awk '{print $2}'`
echo -n "(found v${VERSION})"

# Consolidate localisations into main package
if [ -n $L_TARBALL ] ; then # Are we localised?
	  TARBALL_NAME="${TARBALL/.tar.gz/}"
	L_TARBALL_NAME="${L_TARBALL/.tar.gz/}"
	mv -f $TEMP_DIR/${L_TARBALL_NAME/$VERSION}/RPMS/*.rpm $TEMP_DIR/${TARBALL_NAME/$VERSION}/RPMS/
fi
status

# Extracted pkg can be removed: Save RAM
rm -rf $SOURCE_DIR

# Extract everything from RPMS
cd $TEMP_DIR/${TARBALL_NAME/$VERSION}/RPMS
for i in *.rpm
do
	if (! echo $i | egrep -qi $EXCLUDE); then
		echo -n "."
		(rpm2cpio $i | cpio -id >> $LOG 2>&1 ) && rm  -f $i
	fi
done
rpm2cpio desktop-integration/*freedesktop*.rpm | cpio -id >> $LOG 2>&1

# extracted pkg can be removed: Save RAM
rm -f desktop-integration/*freedesktop*.rpm

status
echo -n "Preparing package... "

# Make the package
mkdir -p $PACKAGE-$VERSION/fs/usr/lib/libreoffice  \
         $PACKAGE-$VERSION/fs/usr/share

# use mv instead of 'cp -a' to save RAM
mv opt/libreoffice* $PACKAGE-$VERSION/fs/usr/lib
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 libexec directory
bin=$(ls $PACKAGE-$VERSION/fs/usr/bin/libreoffice???)
if [ -L $bin ]; then
	target=$(readlink $bin)
	rm -f $bin
	ln -s ${target/opt/usr\/lib\/libreoffice} $bin
else
	sed -i 's#/opt/#/usr/lib/libreoffice/#'  $bin
fi	

# Create receipt
cat > $PACKAGE-$VERSION/receipt <<EOT
# SliTaz package receipt.

PACKAGE="$PACKAGE"
VERSION="$VERSION"
CATEGORY="office"
SHORT_DESC="Productivity suite."
DEPENDS="java6-jre"
WEB_SITE="$URL"

post_install()
{
	cd /usr/share/applications
	ln -s /usr/lib/libreoffice?*/share/xdg/base.desktop          libreoffice-base.desktop
	ln -s /usr/lib/libreoffice?*/share/xdg/impress.desktop       libreoffice-impress.desktop
	ln -s /usr/lib/libreoffice?*/share/xdg/writer.desktop        libreoffice-writer.desktop
	ln -s /usr/lib/libreoffice?*/share/xdg/calc.desktop          libreoffice-calc.desktop
	ln -s /usr/lib/libreoffice?*/share/xdg/math.desktop          libreoffice-math.desktop
	ln -s /usr/lib/libreoffice?*/share/xdg/draw.desktop          libreoffice-draw.desktop
	ln -s /usr/lib/libreoffice?*/share/xdg/printeradmin.desktop libreoffice-printeradmin.desktop
	chmod +x /usr/lib/libreoffice?*/share/xdg/*.desktop

	cd /usr/bin
	ln -s /usr/lib/libreoffice?* /usr/lib/libreoffice
	ln -sf /usr/lib/libreoffice/program/soffice
}

post_remove()
{
	rm -f /usr/share/applications/libreoffice-*
}

EOT
status

# Pack
tazpkg pack $PACKAGE-$VERSION

# Clean to save RAM memory
rm -rf $PACKAGE-$VERSION

# Install pseudo package
tazpkg install $PACKAGE-$VERSION.tazpkg --root=$ROOT
case " $@ " in
*\ --k*) mv $PACKAGE-$VERSION.tazpkg $CUR_DIR ;;
esac

# Clean
cd $CUR_DIR
rm -rf $TEMP_DIR
#!/bin/sh
# get-LibreOffice - install LibreOffice excl. KDE/Gnome integration & test suite.
#
# (C) 2010 SliTaz - GNU General Public License v3.
# Author : Ben Arnold <ben@xxxxxxxxxxxxxxxxxxxx>
#    via : get-OpenOffice3 (Eric Joseph-Alexandre <erjo@xxxxxxxxxx>)
#

PACKAGE="LibreOffice"
URL="http://www.libreoffice.org";
ROOT="$1"
DIR="stable"
SUFFIX="Linux_x86_rpm.tar.gz"
WGET_URL="http://download.documentfoundation.org/libreoffice/$DIR";

VERSION="$(basename $(wget -O - $WGET_URL/ 2> /dev/null | \
	sed '/href=\"[0-9]/!d;s/.*href=\"//;s/[/\">].*//' | tail -1))"
if [ -z "$VERSION" ]; then
	echo "Can't detect an appropriate version. The version numbering or URL may have changed. Aborted."
	exit 0
fi
VER="${VERSION/\-/}" # without hyphens


TARBALL="LibreOffice_${VER}_${SUFFIX}"

for LOC in ${LANG/_/-} ${LANG%_*}; do
	L_SUFFIX="Linux_x86_rpm_langpack_$LOC.tar.gz"
	L_TARBALL="LibreOffice_${VER}_${L_SUFFIX}"
	LANG_URL="$WGET_URL/${VERSION}/rpm/x86/${L_TARBALL}"
	busybox wget -s $LANG_URL 2> /dev/null || continue
	echo "Added $LANG ($LOC)."
	break
done
WGET_URL="$WGET_URL/${VERSION}/rpm/x86/${TARBALL}"

CUR_DIR=$(pwd)
TEMP_DIR="/tmp/$PACKAGE.$$"
SOURCE_DIR="/tmp/src.$$"
EXCLUDE="kde|gnome|test"
LOG="/tmp/$(basename $0 .sh).log"


# Status function with color (supported by Ash).
status()
{
	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
	 	return 0
	 else
	 	return 1
	 fi
}

# We need to be root
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

fi


# Check if we have the tarball before.
if [ ! -f $SOURCE_DIR/$TARBALL ]; then
	echo "Downloading LibreOffice 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
	if [ -n $L_TARBALL ] ; then # Are we localised?
		wget -c $LANG_URL -O $SOURCE_DIR/$L_TARBALL
	fi
	status
fi
if [ ! -f $SOURCE_DIR/$TARBALL ]; then
	rm -rf $SOURCE_DIR
	echo "Could not download $TARBALL. Exiting."
	exit 1
fi

echo -n "Extracting files (this may take a while): "

# Creates TEMP_DIR and extract tarball
mkdir -p $TEMP_DIR
for TB in $TARBALL $L_TARBALL ; do
	tar xvzf $SOURCE_DIR/$TB -C $TEMP_DIR > $LOG 2>&1 || \
	(echo "Failed to extract $TB" ; exit 1)
done

# Get version found in archive (often directory is still RC version when final is present)
ARCHIVED_VERSION=`find $TEMP_DIR -type d 2> /dev/null | grep LibreOffice | head -n 1 | sed 's/_/ /g' | awk '{print $2}'`
echo -n "(found v${VERSION})"

# Consolidate localisations into main package
if [ -n $L_TARBALL ] ; then # Are we localised?
	  TARBALL_NAME="${TARBALL/.tar.gz/}"
	L_TARBALL_NAME="${L_TARBALL/.tar.gz/}"
	mv -f $TEMP_DIR/${L_TARBALL_NAME/$VERSION}/RPMS/*.rpm $TEMP_DIR/${TARBALL_NAME/$VERSION}/RPMS/
fi
status

# Extracted pkg can be removed: Save RAM
rm -rf $SOURCE_DIR

# Extract everything from RPMS
cd $TEMP_DIR/${TARBALL_NAME/$VERSION}/RPMS
for i in *.rpm
do
	if (! echo $i | egrep -qi $EXCLUDE); then
		echo -n "."
		(rpm2cpio $i | cpio -id >> $LOG 2>&1 ) && rm  -f $i
	fi
done
rpm2cpio desktop-integration/*freedesktop*.rpm | cpio -id >> $LOG 2>&1

# extracted pkg can be removed: Save RAM
rm -f desktop-integration/*freedesktop*.rpm

status
echo -n "Preparing package... "

# Make the package
mkdir -p $PACKAGE-$VERSION/fs/usr/lib/libreoffice  \
         $PACKAGE-$VERSION/fs/usr/share

# use mv instead of 'cp -a' to save RAM
mv opt/libreoffice* $PACKAGE-$VERSION/fs/usr/lib
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 libexec directory
bin=$(ls $PACKAGE-$VERSION/fs/usr/bin/libreoffice???)
if [ -L $bin ]; then
	target=$(readlink $bin)
	rm -f $bin
	ln -s ${target/opt/usr\/lib\/libreoffice} $bin
else
	sed -i 's#/opt/#/usr/lib/libreoffice/#'  $bin
fi	

# Create receipt
cat > $PACKAGE-$VERSION/receipt <<EOT
# SliTaz package receipt.

PACKAGE="$PACKAGE"
VERSION="$VERSION"
CATEGORY="office"
SHORT_DESC="Productivity suite."
DEPENDS="java6-jre"
WEB_SITE="$URL"

post_install()
{
	cd /usr/share/applications
	ln -s /usr/lib/libreoffice?*/share/xdg/base.desktop          libreoffice-base.desktop
	ln -s /usr/lib/libreoffice?*/share/xdg/impress.desktop       libreoffice-impress.desktop
	ln -s /usr/lib/libreoffice?*/share/xdg/writer.desktop        libreoffice-writer.desktop
	ln -s /usr/lib/libreoffice?*/share/xdg/calc.desktop          libreoffice-calc.desktop
	ln -s /usr/lib/libreoffice?*/share/xdg/math.desktop          libreoffice-math.desktop
	ln -s /usr/lib/libreoffice?*/share/xdg/draw.desktop          libreoffice-draw.desktop
	ln -s /usr/lib/libreoffice?*/share/xdg/printeradmin.desktop libreoffice-printeradmin.desktop
	chmod +x /usr/lib/libreoffice?*/share/xdg/*.desktop

	cd /usr/bin
	ln -s /usr/lib/libreoffice?* /usr/lib/libreoffice
	ln -sf /usr/lib/libreoffice/program/soffice
}

post_remove()
{
	rm -f /usr/share/applications/libreoffice-*
}

EOT
status

# Pack
tazpkg pack $PACKAGE-$VERSION

# Clean to save RAM memory
rm -rf $PACKAGE-$VERSION

# Install pseudo package
tazpkg install $PACKAGE-$VERSION.tazpkg --root=$ROOT
case " $@ " in
*\ --k*) mv $PACKAGE-$VERSION.tazpkg $CUR_DIR ;;
esac

# Clean
cd $CUR_DIR
rm -rf $TEMP_DIR


Mail converted by MHonArc 2.6.19+ http://listengine.tuxfamily.org/