wok diff get-OpenOffice/stuff/get-OpenOffice @ rev 25466
Update some web_site
author | Pascal Bellard <pascal.bellard@slitaz.org> |
---|---|
date | Sat Oct 01 09:32:27 2022 +0000 (21 months ago) |
parents | |
children |
line diff
1.1 --- /dev/null Thu Jan 01 00:00:00 1970 +0000 1.2 +++ b/get-OpenOffice/stuff/get-OpenOffice Sat Oct 01 09:32:27 2022 +0000 1.3 @@ -0,0 +1,241 @@ 1.4 +#!/bin/sh 1.5 +# get-OpenOffice, install everything for OpenOffice except KDE and Gnome integration and testsuite. 1.6 +# 1.7 +# (C) 2022 SliTaz - GNU General Public License v3. 1.8 +# 1.9 +# Author : HGT 1.10 +# 1.11 + 1.12 +# === Initialisations === 1.13 + 1.14 +PKGS_DB="/var/lib/tazpkg" # packages database directory 1.15 +PACKAGE="OpenOffice" 1.16 +CATEGORY="office" 1.17 +SHORT_DESC="Productivity suite." 1.18 +MAINTAINER="nobody@slitaz.org" 1.19 +LICENSE="Apache" 1.20 +WEB_SITE="https://www.openoffice.org" 1.21 + 1.22 +EXCLUDE="kde|gnome|test|onlineupdate" 1.23 + 1.24 +# Declare functions check_root, status, ... 1.25 +. /lib/libtaz.sh 1.26 +# and make commandline options (if any) available as variables 1.27 + 1.28 +is_installed() 1.29 +{ 1.30 + if [ -d $ROOT$PKGS_DB/installed/$PACKAGE ] 1.31 + then #package is deemed to be installed 1.32 + return 0 1.33 + else 1.34 + return 1 1.35 + fi 1.36 +} 1.37 + 1.38 +# Show commandline options, if requested by --help 1.39 +if [ "$help" == "yes" ] 1.40 + then 1.41 + echo "Commandline options: 1.42 + $0 1.43 + --version=<version> 1.44 + --lang=<language> 1.45 + --root=<path-to-root> 1.46 + --install=yes|no 1.47 + --keep=no|yes 1.48 + --tmpdir=<directory-to-build-package> 1.49 + --logfile=<logging-file>" 1.50 + exit 1.51 +fi 1.52 + 1.53 +# Check for system administrator privileges 1.54 +check_root 1.55 + 1.56 +title "Package $PACKAGE will be build as SliTaz package and installed" 1.57 + 1.58 +# Fetch latest version 1.59 +# unless version is set by option --version 1.60 +[ -z "$version" ] && version="latest" 1.61 + 1.62 +# Fetch RPM package for english language 1.63 +# unless language is set by option --lang 1.64 +[ -z "$lang" ] && lang="en-GB" 1.65 + 1.66 +# Install SliTaz package 1.67 +# unless inhibited by option --install=no 1.68 +[ -z "$install" ] && install="yes" 1.69 + 1.70 +# Delete SliTaz package file $PACKAGE-$VERSION.tazpkg after installation 1.71 +# unless option --keep=yes is given 1.72 +[ -z "$keep" ] && keep="no" 1.73 + 1.74 +# Directory for temporary files 1.75 +TMP_DIR="$tmpdir" 1.76 +[ -z "$tmpdir" ] && TMP_DIR="/tmp/get-$PACKAGE" 1.77 + 1.78 +# Logging file 1.79 +LOG="$logfile" 1.80 +[ -z "$logfile" ] && LOG=$TMP_DIR/get-$PACKAGE.log 1.81 + 1.82 +cat <<EOT 1.83 +Options in use: 1.84 + root : $root/ 1.85 + version : $version 1.86 + lang : $lang 1.87 + install package: $install 1.88 + keep tazpkg : $keep 1.89 + build directory: $TMP_DIR 1.90 + logging file : $LOG 1.91 + 1.92 +EOT 1.93 + 1.94 +separator; newline 1.95 + 1.96 +# Set VERSION, unless supplied by --version 1.97 +if [ "$version" == "latest" ] 1.98 + then 1.99 + echo "Selecting latest version from $WEB_SITE ..." 1.100 + VERSION=$(wget -O - $WEB_SITE 2>/dev/null | sed '/Released: Apache OpenOffice /!d;s|.* OpenOffice ||;s|</a></div>||') 1.101 + else 1.102 + VERSION=$version 1.103 +fi 1.104 + 1.105 +MV=${VERSION%%.*} # main version 1.106 + 1.107 +TARBALL=Apache_OpenOffice_${VERSION}_Linux_x86_install-rpm_${lang}.tar.gz 1.108 +echo "Archive is $TARBALL ..." 1.109 +WGET_URL=https://archive.apache.org/dist/openoffice/$VERSION/binaries/$lang/$TARBALL 1.110 + 1.111 +# === Remove package, if installed === 1.112 +if is_installed 1.113 + then 1.114 + echo "$PACKAGE is already installed." 1.115 + echo -n "Would you like to remove and reinstall this package [y/n]? " 1.116 + read answer 1.117 + case "$answer" in 1.118 + (y|Y) 1.119 + action "Removing installed version..." 1.120 + newline 1.121 + tazpkg remove $PACKAGE --root="$root/" 1.122 + [ ! is_installed ] && 1.123 + die "Can't remove installed version. Exiting." 1.124 + ;; 1.125 + (*) 1.126 + echo "Leaving $PACKAGE untouched." 1.127 + exit 0 1.128 + ;; 1.129 + esac 1.130 +fi 1.131 + 1.132 +# === Fetch archive file, if not existing === 1.133 + 1.134 +CUR_DIR=$(pwd) 1.135 +mkdir -p $TMP_DIR 1.136 +cd $TMP_DIR 1.137 +if [ -f $TARBALL ] 1.138 + then 1.139 + echo "Using existing archive file $TARBALL" 1.140 + else 1.141 + action "Fetching the archive" 1.142 + newline 1.143 + wget --no-check-certificate $WGET_URL 1.144 + if [ ! -f $TARBALL ] 1.145 + then 1.146 + cd $CUR_DIR 1.147 + rm -rf $TMP_DIR 1.148 + echo "Could not transfer $TARBALL from $WGET_URL. Exiting." 1.149 + exit 1 1.150 + fi 1.151 +fi 1.152 + 1.153 +# === Extract files from archive === 1.154 +action "Extracting the archive" 1.155 +newline 1.156 + 1.157 +tar x -vf $TARBALL > $LOG 2>&1 || \ 1.158 + (echo "Failed to extract $TARBALL" ; exit 1) 1.159 + 1.160 +status 1.161 + 1.162 +# Remove archive file 1.163 +rm -f $TARBALL 1.164 + 1.165 +# Extract everything from rpm files and remove them 1.166 +cd $TMP_DIR/*/RPMS 1.167 +for i in *.rpm 1.168 + do 1.169 + if (! echo $i | egrep -qi $EXCLUDE) 1.170 + then 1.171 + (rpm2cpio $i | cpio -id >> $LOG 2>&1 ) && 1.172 + rm -f $i 1.173 + fi 1.174 + done 1.175 + 1.176 +# Extracted from freedesktop rpm and remove it 1.177 +rpm2cpio desktop-integration/*freedesktop*.rpm | cpio -id >> $LOG 2>&1 1.178 +rm -f desktop-integration/*freedesktop*.rpm 1.179 + 1.180 +# Prepare the package tree 1.181 +mkdir -p $PACKAGE-$VERSION/fs/usr/lib/openoffice 1.182 +mkdir -p $PACKAGE-$VERSION/fs/usr/share 1.183 + 1.184 +mv opt/openoffice* $PACKAGE-$VERSION/fs/usr/lib/openoffice 1.185 +mv usr/share/mime $PACKAGE-$VERSION/fs/usr/share 1.186 +mv usr/share/icons $PACKAGE-$VERSION/fs/usr/share 1.187 +mv usr/bin $PACKAGE-$VERSION/fs/usr 1.188 + 1.189 +# relocalised OOo libexec directory 1.190 +sed -i 's|/opt/|/usr/lib/openoffice/|' \ 1.191 + $PACKAGE-$VERSION/fs/usr/bin/openoffice* 1.192 + 1.193 +# Create recipe for tazpkg 1.194 +cat > $PACKAGE-$VERSION/receipt <<EOT 1.195 +# SliTaz package receipt. 1.196 + 1.197 +PACKAGE="$PACKAGE" 1.198 +VERSION="$VERSION" 1.199 +CATEGORY="$CATEGORY" 1.200 +SHORT_DESC="$SHORT_DESC" 1.201 +MAINTAINER="$MAINTAINER" 1.202 +LICENSE="$LICENSE" 1.203 +WEB_SITE="$WEB_SITE" 1.204 + 1.205 +post_install() 1.206 +{ 1.207 + cd \$1/usr/share/applications 1.208 + ln -s /usr/lib/openoffice/openoffice$MV/share/xdg/base.desktop openoffice$MV-base.desktop 1.209 + ln -s /usr/lib/openoffice/openoffice$MV/share/xdg/impress.desktop openoffice$MV-impress.desktop 1.210 + ln -s /usr/lib/openoffice/openoffice$MV/share/xdg/writer.desktop openoffice$MV-writer.desktop 1.211 + ln -s /usr/lib/openoffice/openoffice$MV/share/xdg/calc.desktop openoffice$MV-calc.desktop 1.212 + ln -s /usr/lib/openoffice/openoffice$MV/share/xdg/math.desktop openoffice$MV-math.desktop 1.213 + ln -s /usr/lib/openoffice/openoffice$MV/share/xdg/draw.desktop openoffice$MV-draw.desktop 1.214 + ln -s /usr/lib/openoffice/openoffice$MV/share/xdg/printeradmin.desktop openoffice$MV-printeradmin.desktop 1.215 + 1.216 + cd \$1/usr/bin 1.217 + ln -sf /usr/lib/openoffice/openoffice$MV/program/soffice 1.218 +} 1.219 + 1.220 +post_remove() 1.221 +{ 1.222 + rm -f \$1/usr/share/applications/openoffice$MV-* 1.223 +} 1.224 + 1.225 +EOT 1.226 + 1.227 +# Pack 1.228 +tazpkg pack $PACKAGE-$VERSION 1.229 +# Remove package tree 1.230 +rm -rf $PACKAGE-$VERSION 1.231 + 1.232 +# === Install the SliTaz package === 1.233 +[ "$install" == "yes" ] && 1.234 +tazpkg install $PACKAGE-$VERSION.tazpkg --root="$root" 1.235 + 1.236 +# === Cleanup === 1.237 +# Preserve package file, if requested 1.238 +[ "$keep" == "yes" ] && 1.239 +( mv $PACKAGE-$VERSION.tazpkg $CUR_DIR && 1.240 + echo Saved $PACKAGE-$VERSION.tazpkg to $CUR_DIR ) 1.241 + 1.242 +# Remove temporary build directory 1.243 +cd $CUR_DIR 1.244 +rm -rf $TMP_DIR