wok rev 25661
Add receipt for OpenOffice4
author | Stanislas Leduc <shann@slitaz.org> |
---|---|
date | Thu Feb 22 21:55:14 2024 +0100 (9 months ago) |
parents | ed5716f72579 |
children | 3c575401ce94 |
files | get-OpenOffice4/receipt get-OpenOffice4/stuff/get-OpenOffice4 |
line diff
1.1 --- /dev/null Thu Jan 01 00:00:00 1970 +0000 1.2 +++ b/get-OpenOffice4/receipt Thu Feb 22 21:55:14 2024 +0100 1.3 @@ -0,0 +1,24 @@ 1.4 +# SliTaz package receipt. 1.5 + 1.6 +PACKAGE="get-OpenOffice4" 1.7 +VERSION="1.20" 1.8 +CATEGORY="office" 1.9 +TAGS="office word excel ppt openoffice" 1.10 +SHORT_DESC="Productivity suite." 1.11 +MAINTAINER="maintainer@slitaz.org" 1.12 +LICENSE="GPL3" 1.13 +WEB_SITE="https://openoffice.org" 1.14 + 1.15 +# Rules to gen a SliTaz package suitable for Tazpkg. 1.16 +genpkg_rules() 1.17 +{ 1.18 + mkdir -p $fs/usr/bin 1.19 + install -o root -g root -m755 stuff/get-OpenOffice4 $fs/usr/bin 1.20 + ln -s get-OpenOffice4 $fs/usr/bin/get-openoffice 1.21 +} 1.22 + 1.23 +post_install() 1.24 +{ 1.25 + echo "Now you may enter: 1.26 +get-openoffice" 1.27 +}
2.1 --- /dev/null Thu Jan 01 00:00:00 1970 +0000 2.2 +++ b/get-OpenOffice4/stuff/get-OpenOffice4 Thu Feb 22 21:55:14 2024 +0100 2.3 @@ -0,0 +1,328 @@ 2.4 +#!/bin/sh 2.5 +# get-OpenOffice4 - create and install SliTaz package OpenOffice 2.6 +# excluding KDE and GNOME integration and test suite. 2.7 +# 2.8 +# (C) 2020 SliTaz - GNU General Public License v3. 2.9 +# Author : Ben Arnold <ben@seawolfsanctuary.com> 2.10 +# via : get-OpenOffice3 (Eric Joseph-Alexandre <erjo@slitaz.org>) 2.11 +# modified by Hans-Günter Theisgen on 2019-04-07 2.12 +# modified by Hans-Günter Theisgen on 2020-03-17 2.13 +# modified by Hans-Günter Theisgen on 2020-07-24 2.14 +# modified by Hans-Günter Theisgen on 2022-06-15 2.15 +# modified by shann on 2024-02-22 2.16 +# 2.17 + 2.18 +# === Initialisations === 2.19 + 2.20 +PKGS_DB="/var/lib/tazpkg" # packages database directory 2.21 +PACKAGE="OpenOffice" # package to create and install 2.22 +CATEGORY="office" 2.23 +SHORT_DESC="Productivity suite." 2.24 +WEB_SITE="https://www.openoffice.org" 2.25 +LICENCE="MPL v2.0" 2.26 + 2.27 +SUFFIX="Linux_x86_install-rpm_en-US.tar.gz" 2.28 +PREFIX="https://downloads.apache.org/openoffice" 2.29 + 2.30 +DEPENDS="cups" 2.31 +EXCLUDE="kde|gnome|test" 2.32 + 2.33 +# Declare functions check_root, status, ... 2.34 +. /lib/libtaz.sh 2.35 +# and make commandline options (if any) available as variables 2.36 + 2.37 +is_installed() 2.38 +{ 2.39 + if [ -d $root$PKGS_DB/installed/$PACKAGE ] 2.40 + then #package is deemed to be installed 2.41 + return 0 2.42 + else 2.43 + return 1 2.44 + fi 2.45 +} 2.46 + 2.47 +# Show available commandline options, if requested by --help 2.48 +if [ "$help" = "yes" ] 2.49 + then 2.50 + echo "Available commandline options: 2.51 + $0 2.52 + --version=<version> 2.53 + --lang=<language_package_required> 2.54 + --root=<path_to_root> 2.55 + --install=yes|no 2.56 + --keep=no|yes 2.57 + --srcdir=<directory_for_source_packages> 2.58 + --tmpdir=<directory_to_build-package>" 2.59 + exit 2.60 +fi 2.61 + 2.62 +# Check for system administrator privileges 2.63 +check_root 2.64 + 2.65 +title "Package $PACKAGE will be build as SliTaz package and installed" 2.66 + 2.67 +# Fetch latest $DIR version, unless version is set by option --version 2.68 +#[ -z "$version" ] && version="latest" 2.69 +[ -z "$version" ] && version="4.1.15" && 2.70 + echo "Newer versions than 4.1.15 are not available in 32-bit flavour!" 2.71 + 2.72 +# Fetch language pack according to $LANG, unless otherwise set by option --lang 2.73 +[ -z "$lang" ] && lang="automatic" 2.74 + 2.75 +# Install SliTaz package, unless inhibited by option --install=no 2.76 +[ -z "$install" ] && install="yes" 2.77 + 2.78 +# Delete SliTaz package file $PACKAGE-$VERSION.tazpkg after installation, 2.79 +# unless option --keep=yes is given 2.80 +[ -z "$keep" ] && keep="no" 2.81 + 2.82 +# Directory for temporary files 2.83 +[ -z "$tempdir" ] && TEMP_DIR="/tmp/get-$PACKAGE" 2.84 + 2.85 +# Directory for source archives 2.86 +[ -z "$srcdir" ] && SOURCE_DIR="/tmp/src-$PACKAGE" 2.87 + 2.88 +# Logging file 2.89 +LOG="/tmp/$(basename $0 .sh).log" 2.90 + 2.91 +cat <<EOT 2.92 +Options in use: 2.93 + root : $root/ 2.94 + version : $version 2.95 + lang : $lang 2.96 + install package : $install 2.97 + keep tazpkg : $keep 2.98 + source directory: $SOURCE_DIR 2.99 + build directory : $TEMP_DIR 2.100 + logging file: $LOG 2.101 + 2.102 +EOT 2.103 + 2.104 +separator; newline 2.105 + 2.106 +# === Remove package, if installed === 2.107 +if is_installed 2.108 + then 2.109 + echo "$PACKAGE is already installed." 2.110 + [ -n "$root" ] && exit 0 2.111 + echo -n "Would you like to remove and reinstall this package [y/N]? " 2.112 + read answer 2.113 + case "$answer" in 2.114 + (y|Y) 2.115 + action "Removing installed version..." 2.116 + tazpkg remove $PACKAGE --root="$root/" 2.117 + [ ! is_installed ] && 2.118 + die "Can't remove installed version. Exiting." ;; 2.119 + (*) 2.120 + exit 0 ;; 2.121 + esac 2.122 +fi 2.123 + 2.124 +# === Fetch archive file, if not existing === 2.125 + 2.126 +if [ "$version" == "latest" ] 2.127 + then 2.128 + VERSIONS="$(wget -qO - $PREFIX/ | \ 2.129 + sed '/href=\"[0-9]/!d;s/.*href=\"//;s/[/\">].*//' | tac)" 2.130 + if [ -z "$VERSIONS" ] 2.131 + then 2.132 + echo "Can't detect an appropriate version. The version numbering or URL may have changed. Exiting." 2.133 + exit 1 2.134 + fi 2.135 + else 2.136 + PREFIX="https://downloads.apache.org/openoffice" 2.137 + VERSIONS="$version" 2.138 +fi 2.139 + 2.140 +for VERSION in $VERSIONS 2.141 + do # foreach VERSION 2.142 + 2.143 + VER="${VERSION/\-/}" # without hyphens 2.144 + TARBALL="Apache_OpenOffice_${VER}_${SUFFIX}" 2.145 + WGET_URL="$PREFIX/${VERSION}/binaries/en-US/${TARBALL}" 2.146 + 2.147 + # Set LANG_URL to fetch language package 2.148 + if [ "$lang" = "automatic" ] 2.149 + then # use language from $LANG of running process 2.150 + LOCS=${LANG/_/-} 2.151 + for LOC in ${LOCS%.*} 2.152 + do 2.153 + L_SUFFIX="Linux_x86_langpack-rpm_$LOC.tar.gz" 2.154 + L_TARBALL="Apache_OpenOffice_${VER}_${L_SUFFIX}" 2.155 + LANG_URL="$PREFIX/${VERSION}/binaries/$LOC/${L_TARBALL}" 2.156 + busybox wget -s $LANG_URL 2> /dev/null || continue 2.157 + echo "Added language pack for $LANG ($LOC)." 2.158 + break 2.159 + done 2.160 + else 2.161 + L_SUFFIX="Linux_x86_langpack-rpm_$lang.tar.gz" 2.162 + L_TARBALL="Apache_OpenOffice_${VER}_${L_SUFFIX}" 2.163 + LANG_URL="$PREFIX/${VERSION}/binaries/$lang/${L_TARBALL}" 2.164 + busybox wget -s $LANG_URL 2> /dev/null && 2.165 + echo "Added language pack for $lang." 2.166 + fi 2.167 + 2.168 + CUR_DIR=$(pwd) 2.169 + mkdir -p $TEMP_DIR 2.170 + cd $TEMP_DIR 2.171 + 2.172 + if [ -f $SOURCE_DIR/$TARBALL ] 2.173 + then 2.174 + echo "Using existing archive file $TARBALL" 2.175 + else 2.176 + action "Fetching the archives..." 2.177 + newline 2.178 + # Check if $SOURCE_DIR exists 2.179 + [ -d $SOURCE_DIR ] || mkdir -p $SOURCE_DIR 2.180 + wget -c $WGET_URL -O $SOURCE_DIR/$TARBALL || continue 2.181 + if [ -n $L_TARBALL ] # language pack required? 2.182 + then 2.183 + wget -c $LANG_URL -O $SOURCE_DIR/$L_TARBALL 2.184 + fi 2.185 + status 2.186 + fi 2.187 + 2.188 + break 2.189 + 2.190 + done # foreach VERSION 2.191 + 2.192 +if [ ! -f $SOURCE_DIR/$TARBALL ] 2.193 + then 2.194 + rm -rf $SOURCE_DIR 2.195 + echo "Could not get $TARBALL. Exiting." 2.196 + exit 1 2.197 +fi 2.198 + 2.199 +# === Extract files from archives === 2.200 +action "Extracting the archives..." 2.201 +newline 2.202 +mkdir -p $TEMP_DIR 2.203 +for TB in $TARBALL $L_TARBALL 2.204 + do 2.205 + tar xvzf $SOURCE_DIR/$TB -C $TEMP_DIR > $LOG 2>&1 || 2.206 + (echo "Failed to extract $TB" ; exit 1) 2.207 + done 2.208 + 2.209 +# === Create SliTaz package === 2.210 + 2.211 +# Prepare metadata for SliTaz package 2.212 + 2.213 +# Merge language pack into main package 2.214 +if [ -n $L_TARBALL ] # language pack required? 2.215 + then 2.216 + locale=$(echo ${L_TARBALL/.tar.gz} | awk -F '-rpm_' '{print $2}') 2.217 + mv -f $TEMP_DIR/$locale/RPMS/*.rpm \ 2.218 + $TEMP_DIR/en-US/RPMS/ 2.219 +fi 2.220 +status 2.221 + 2.222 +# Extracted archives can be removed 2.223 +rm -rf $SOURCE_DIR 2.224 + 2.225 +# Extract almost everything from RPMS directory 2.226 +action "Extracting RPMs..." 2.227 +newline 2.228 +cd $TEMP_DIR/en-US/RPMS 2.229 +for i in *.rpm 2.230 + do 2.231 + if (! echo $i | egrep -qi $EXCLUDE) 2.232 + then 2.233 + echo -n "." 2.234 + (rpm2cpio $i | cpio -id >> $LOG 2>&1 ) && rm -f $i 2.235 + fi 2.236 + done 2.237 +rpm2cpio desktop-integration/*freedesktop*.rpm | cpio -id >> $LOG 2>&1 2.238 +rm -rf *integration* 2.239 +status 2.240 + 2.241 +# Move files to package tree $PACKAGE-$VERSION/fs/ 2.242 +action "Preparing package..." 2.243 +mkdir -p $PACKAGE-$VERSION/fs/usr/lib/openoffice 2.244 +mkdir -p $PACKAGE-$VERSION/fs/usr/share 2.245 + 2.246 +# use mv instead of 'cp -a' to save space 2.247 +mv opt/openoffice* $PACKAGE-$VERSION/fs/usr/lib/openoffice 2.248 +mv usr/share/mime $PACKAGE-$VERSION/fs/usr/share 2.249 +mv usr/share/icons $PACKAGE-$VERSION/fs/usr/share 2.250 +mv usr/share/applications $PACKAGE-$VERSION/fs/usr/share 2.251 +mv usr/bin $PACKAGE-$VERSION/fs/usr 2.252 + 2.253 +# relocalised libexec directory 2.254 +bin=$PACKAGE-$VERSION/fs/usr/bin/openoffice${VERSION:0:1} 2.255 +if [ -L $bin ] 2.256 + then 2.257 + target=$(readlink $bin) 2.258 + rm -f $bin 2.259 + ln -s ${target/opt/usr\/lib\/openoffice} $bin 2.260 + else 2.261 + sed -i 's#/opt/#/usr/lib/openoffice/#' $bin 2.262 +fi 2.263 + 2.264 +# Create recipe for SliTaz package 2.265 +cat > $PACKAGE-$VERSION/receipt <<EOT 2.266 +# SliTaz package receipt. 2.267 + 2.268 +PACKAGE="$PACKAGE" 2.269 +VERSION="$VERSION" 2.270 +CATEGORY="$CATEGORY" 2.271 +TAGS="writer spreadsheet database" 2.272 +SHORT_DESC="$SHORT_DESC" 2.273 +LICENSE="$LICENCE" 2.274 +WEB_SITE="$WEB_SITE" 2.275 +DEPENDS="$DEPENDS" 2.276 + 2.277 +post_install() 2.278 +{ 2.279 + path_openoffice=/usr/lib/openoffice/openoffice${VERSION:0:1} 2.280 + 2.281 + # Remove links, if existing 2.282 + rm -f /usr/share/applications/openoffice${VERSION:0:1}* 2.283 + 2.284 + # Create links 2.285 + cd /usr/share/applications 2.286 + for app in "base" "impress" "writer" "calc" "math" "draw" 2.287 + do 2.288 + ln -sf \$path_openoffice/share/xdg/\$app.desktop \\ 2.289 + openoffice${VERSION:0:1}-\$app.desktop 2.290 + done 2.291 + 2.292 + chmod +x \$path_openoffice/share/xdg/*.desktop 2.293 + 2.294 + # Fix menu entries 2.295 + sed -i 's|^\\([Ee]xec=openoffice\\)[0-9\\.]*|\\0|' \\ 2.296 + \$path_openoffice/share/xdg/*.desktop 2.297 + 2.298 + # If necessary, recreate links for soffice 2.299 + rm -f /usr/bin/soffice 2.300 + rm -f /usr/bin/openoffice 2.301 + ln -sf \$path_openoffice/program/soffice /usr/bin/openoffice 2.302 + ln -sf \$path_openoffice/program/soffice /usr/bin/soffice 2.303 +} 2.304 + 2.305 +post_remove() 2.306 +{ 2.307 + rm -f /usr/share/applications/openoffice${VERSION:0:1}-* 2.308 +} 2.309 +EOT 2.310 + 2.311 +status 2.312 + 2.313 +# Create the package 2.314 +tazpkg pack $PACKAGE-$VERSION 2.315 + 2.316 +# Remove package tree 2.317 +rm -rf $PACKAGE-$VERSION 2.318 + 2.319 +# === Install the SliTaz package === 2.320 +[ "$install" == "yes" ] && 2.321 +tazpkg install $PACKAGE-$VERSION.tazpkg --root="$root" 2.322 + 2.323 +# === Cleanup === 2.324 +# Preserve package file, if requested 2.325 +[ "$keep" == "yes" ] && 2.326 +( mv $PACKAGE-$VERSION.tazpkg $CUR_DIR && 2.327 + echo Saved $PACKAGE-$VERSION.tazpkg to $CUR_DIR ) 2.328 + 2.329 +# Remove temporary build directory 2.330 +cd $CUR_DIR 2.331 +rm -rf $TEMP_DIR