wok-current rev 1692
Add: get-OpenOffice3.sh
author | Eric Joseph-Alexandre <erjo@slitaz.org> |
---|---|
date | Tue Nov 11 12:20:46 2008 +0100 (2008-11-11) |
parents | 33a264004dde |
children | 720da62b7024 |
files | get-OpenOffice3/receipt get-OpenOffice3/stuff/get-OpenOffice3.sh |
line diff
1.1 --- /dev/null Thu Jan 01 00:00:00 1970 +0000 1.2 +++ b/get-OpenOffice3/receipt Tue Nov 11 12:20:46 2008 +0100 1.3 @@ -0,0 +1,16 @@ 1.4 +# SliTaz package receipt. 1.5 + 1.6 +PACKAGE="get-OpenOffice3" 1.7 +VERSION="1.0" 1.8 +CATEGORY="office" 1.9 +SHORT_DESC="Productivity suite" 1.10 +MAINTAINER="erjo@slitaz.org" 1.11 +WEB_SITE="http://www.openoffice.org" 1.12 + 1.13 +# Rules to gen a SliTaz package suitable for Tazpkg. 1.14 +genpkg_rules() 1.15 +{ 1.16 + mkdir -p $fs/usr/bin 1.17 + install -o root -g root -m755 stuff/get-OpenOffice3.sh $fs/usr/bin 1.18 +} 1.19 +
2.1 --- /dev/null Thu Jan 01 00:00:00 1970 +0000 2.2 +++ b/get-OpenOffice3/stuff/get-OpenOffice3.sh Tue Nov 11 12:20:46 2008 +0100 2.3 @@ -0,0 +1,160 @@ 2.4 +#!/bin/sh 2.5 +# get-OpenOffice3, install everything for OpenOffice.org exept KDE/Gnome integration and testsuite. 2.6 +# 2.7 +# (C) 2008 SliTaz - GNU General Public License v3. 2.8 +# 2.9 +# Author : Eric Joseph-Alexandre <erjo@slitaz.org> 2.10 + 2.11 +PACKAGE="OpenOffice" 2.12 +VERSION="3.0.0" 2.13 +URL="http://www.openoffice.org" 2.14 + 2.15 +if [ "$LANG" = "fr_FR" ]; then 2.16 + TARBALL="OOo_${VERSION}_LinuxIntel_install_fr.tar.gz" 2.17 + WGET_URL="ftp://ftp.proxad.net/mirrors/ftp.openoffice.org/localized/fr/${VERSION}/${TARBALL}" 2.18 +else 2.19 + TARBALL="OOo_${VERSION}_LinuxIntel_install_en-US.tar.gz" 2.20 + WGET_URL="ftp://ftp.proxad.net/mirrors/ftp.openoffice.org/stable/${VERSION}/${TARBALL}" 2.21 +fi 2.22 + 2.23 +TEMP_DIR="/home/slitaz/build/$PACKAGE.$$" 2.24 +SOURCE_DIR="/home/slitaz/src" 2.25 +EXCLUDE="kde|gnome|test" 2.26 +LOG="/tmp/$(basename $0 .sh).log" 2.27 + 2.28 +# Status function with color (supported by Ash). 2.29 +status() 2.30 +{ 2.31 + local CHECK=$? 2.32 + echo -en "\\033[70G[ " 2.33 + if [ $CHECK = 0 ]; then 2.34 + echo -en "\\033[1;33mOK" 2.35 + else 2.36 + echo -en "\\033[1;31mFailed" 2.37 + fi 2.38 + echo -e "\\033[0;39m ]" 2.39 + return $CHECK 2.40 +} 2.41 + 2.42 +# Check if user is root to install, or remove packages. 2.43 +check_root() 2.44 +{ 2.45 + if test $(id -u) != 0 ; then 2.46 + echo -e "\nYou must be root to run `basename $0` with this option." 2.47 + echo -e "Please use 'su' and root password to become super-user.\n" 2.48 + exit 0 2.49 + fi 2.50 +} 2.51 + 2.52 +check_if_installed() 2.53 +{ 2.54 + # Avoid reinstall 2.55 + if [ -d /var/lib/tazpkg/installed/$PACKAGE ];then 2.56 + return 0 2.57 + else 2.58 + return 1 2.59 + fi 2.60 +} 2.61 + 2.62 +#We need to bee root 2.63 +check_root 2.64 + 2.65 +#check if package already installed 2.66 +if (check_if_installed $PACKAGE); then 2.67 + echo "$PACKAGE is already installed." 2.68 + echo -n "Would you like to remove and reinstall this package [y/n]? " 2.69 + read answer 2.70 + case "$answer" in 2.71 + y|Y) 2.72 + tazpkg remove $PACKAGE ;; 2.73 + *) 2.74 + exit 0 ;; 2.75 + esac 2.76 + 2.77 +fi 2.78 + 2.79 + 2.80 +# Check if we have the tarball before. 2.81 +if [ ! -f $SOURCE_DIR/$TARBALL ]; then 2.82 + echo "Downloading OppenOffice.org tarball (it's time to have a break)... " 2.83 + #Check if $SOURCE_DIR exist 2.84 + test -d $SOURCE_DIR || mkdir -p $SOURCE_DIR 2.85 + # Get the file. 2.86 + wget -c $WGET_URL -O $SOURCE_DIR/$TARBALL 2.87 + status 2.88 +fi 2.89 + 2.90 + 2.91 + 2.92 +# Creates TEM_DIR and extract tarball 2.93 +mkdir -p $TEMP_DIR 2.94 +echo -n "Extract files from archive..." 2.95 +tar xvzf $SOURCE_DIR/$TARBALL -C $TEMP_DIR > $LOG 2>&1 || \ 2.96 + (echo "Failed to extract $TARBALL" ; exit 1) 2.97 +status 2.98 + 2.99 +cd $TEMP_DIR/*/RPMS 2.100 + 2.101 +# Extract everything from RPMS 2.102 +for i in *.rpm 2.103 +do 2.104 + if (! echo $i | egrep -qi $EXCLUDE); then 2.105 + rpm2cpio $i | cpio -id >> $LOG 2>&1 2.106 + fi 2.107 +done 2.108 +rpm2cpio desktop-integration/*freedesktop*.rpm | cpio -id >> $LOG 2>&1 2.109 + 2.110 +# Make the package 2.111 +mkdir -p $PACKAGE-$VERSION/fs/usr/lib/openoffice \ 2.112 + $PACKAGE-$VERSION/fs/usr/share 2.113 + 2.114 +cp -a opt/openoffice* $PACKAGE-$VERSION/fs/usr/lib/openoffice 2.115 +cp -a usr/share/mime $PACKAGE-$VERSION/fs/usr/share 2.116 +cp -a usr/share/icons $PACKAGE-$VERSION/fs/usr/share 2.117 +cp -a usr/bin $PACKAGE-$VERSION/fs/usr 2.118 + 2.119 +# relocalized OOo libexec directory 2.120 +sed -i 's#/opt/#/usr/lib/openoffice/#' $PACKAGE-$VERSION/fs/usr/openoffice* 2.121 + 2.122 +# Create receipt 2.123 +cat > $PACKAGE-$VERSION/receipt <<EOT 2.124 +# SliTaz package receipt. 2.125 + 2.126 +PACKAGE="$PACKAGE" 2.127 +VERSION="$VERSION" 2.128 +CATEGORY="office" 2.129 +SHORT_DESC="Productivity suite." 2.130 +DEPENDS="" 2.131 +WEB_SITE="$URL" 2.132 + 2.133 +post_install() 2.134 +{ 2.135 + cd /usr/share/applications 2.136 + ln -s /usr/lib/openoffice/openoffice.org3/share/xdg/base.desktop openoffice.org3-base.desktop 2.137 + ln -s /usr/lib/openoffice/openoffice.org3/share/xdg/impress.desktop openoffice.org3-impress.desktop 2.138 + ln -s /usr/lib/openoffice/openoffice.org3/share/xdg/writer.desktop openoffice.org3-writer.desktop 2.139 + ln -s /usr/lib/openoffice/openoffice.org3/share/xdg/calc.desktop openoffice.org3-calc.desktop 2.140 + ln -s /usr/lib/openoffice/openoffice.org3/share/xdg/math.desktop openoffice.org3-math.desktop 2.141 + ln -s /usr/lib/openoffice/openoffice.org3/share/xdg/draw.desktop openoffice.org3-draw.desktop 2.142 + ln -s /usr/lib/openoffice/openoffice.org3/share/xdg/printeradmin.desktop openoffice.org3-printeradmin.desktop 2.143 + 2.144 + cd /usr/bin 2.145 + ln -sf /usr/lib/openoffice/openoffice.org3/program/soffice 2.146 +} 2.147 + 2.148 +post_remove() 2.149 +{ 2.150 + rm -f /usr/share/applications/openoffice.org3-* 2.151 +} 2.152 + 2.153 +EOT 2.154 + 2.155 +# Pack 2.156 +tazpkg pack $PACKAGE-$VERSION 2.157 + 2.158 +# Install pseudo package 2.159 +tazpkg install $PACKAGE-$VERSION.tazpkg 2.160 + 2.161 +# Clean 2.162 +rm -rf $TEMP_DIR 2.163 +rm -rf $PACKAGE-$VERSION