wok-current rev 22837

modified get-libaacs
author Hans-G?nter Theisgen
date Tue Feb 11 08:08:11 2020 +0100 (2020-02-11)
parents 079887dee9fb
children 950cf198f5a1
files get-google-earth/stuff/get-google-earth get-libaacs/receipt get-libaacs/stuff/get-libaacs
line diff
     1.1 --- a/get-google-earth/stuff/get-google-earth	Mon Feb 10 15:18:14 2020 +0100
     1.2 +++ b/get-google-earth/stuff/get-google-earth	Tue Feb 11 08:08:11 2020 +0100
     1.3 @@ -2,17 +2,20 @@
     1.4  #
     1.5  # get-google-earth - create and install SliTaz package google-earth
     1.6  #
     1.7 -# (C) 2019 SliTaz - GNU General Public License v3.
     1.8 +# (C) 2020 SliTaz - GNU General Public License v3.
     1.9  # Author : unknown
    1.10  # modified by HGT on 2019-04-05
    1.11 +# modified by HGT on 2020-02-10
    1.12  #
    1.13  
    1.14  #	=== Initialisations ===
    1.15  
    1.16  PKGS_DB="/var/lib/tazpkg"	# packages database directory
    1.17  PACKAGE="google-earth"		# package to create and install
    1.18 +CATEGORY="non-free"
    1.19 +TAGS="maps"
    1.20 +LICENSE="non-free"
    1.21  WEB_SITE="https://google.com/earth/"
    1.22 -CATEGORY="non-free"
    1.23  DEPENDS="libglu-mesa"
    1.24  
    1.25  # Declare functions check_root, status, ...
    1.26 @@ -59,10 +62,12 @@
    1.27  [ -z "$keep" ] && keep="no"
    1.28  
    1.29  # Directory for temporary files
    1.30 -[ -z "$tempdir" ] && TMP_DIR="/tmp/get-$PACKAGE"
    1.31 +TMP_DIR="$tmpdir"
    1.32 +[ -z "$tmpdir" ] && TMP_DIR="/tmp/get-$PACKAGE"
    1.33  
    1.34  # Logging file (unused by now)
    1.35 -LOG=$TMP_DIR/get-$PACKAGE.log
    1.36 +LOG="$logfile"
    1.37 +[ -z "$logfile" ] && LOG=$TMP_DIR/get-$PACKAGE.log
    1.38  
    1.39  cat <<EOT
    1.40  Options in use:
    1.41 @@ -77,12 +82,23 @@
    1.42  separator; newline
    1.43  
    1.44  #	=== Remove package, if installed ===
    1.45 -if [ is_installed ]
    1.46 -	then
    1.47 -		action "Removing installed version..."
    1.48 -		tazpkg remove $PACKAGE --root="$root/"
    1.49 -		[ ! is_installed ] &&
    1.50 -		die "Can't remove installed version. Exiting."
    1.51 +if is_installed
    1.52 +  then
    1.53 +	echo "$PACKAGE is already installed."
    1.54 +	echo -n "Would you like to remove and reinstall this package [y/n]? "
    1.55 +	read answer
    1.56 +	case "$answer" in
    1.57 +		y|Y)
    1.58 +			action "Removing installed version..."
    1.59 +			tazpkg remove $PACKAGE --root="$root/"
    1.60 +			[ ! is_installed ] &&
    1.61 +			die "Can't remove installed version. Exiting."
    1.62 +			;;
    1.63 +		*)
    1.64 +			echo "Leaving $PACKAGE untouched."
    1.65 +			exit 0
    1.66 +			;;
    1.67 +	esac
    1.68  fi
    1.69  
    1.70  #	=== Fetch archive file, if not existing ===
    1.71 @@ -113,7 +129,7 @@
    1.72  		  then
    1.73  			cd $CUR_DIR
    1.74  			rm -rf $TMP_DIR
    1.75 -			echo "Could not transfer $FILE from $URL. Exiting."
    1.76 +			echo "Could not transfer $FILE from $WGET_URL. Exiting."
    1.77  			exit 1
    1.78  		fi
    1.79  fi
    1.80 @@ -153,10 +169,10 @@
    1.81  PACKAGE="$PACKAGE"
    1.82  VERSION="$VERSION"
    1.83  CATEGORY="$CATEGORY"
    1.84 -TAGS="maps"
    1.85 +TAGS="$TAGS"
    1.86  SHORT_DESC="$SHORT_DESC"
    1.87  MAINTAINER="$MAINTAINER"
    1.88 -LICENSE="non-free"
    1.89 +LICENSE="$LICENSE"
    1.90  WEB_SITE="$WEB_SITE"
    1.91  
    1.92  DEPENDS="$DEPENDS"
    1.93 @@ -187,7 +203,9 @@
    1.94  
    1.95  #	=== Cleanup ===
    1.96  # Preserve package file, if requested
    1.97 -[ "$keep" == "yes" ] && mv $PACKAGE-$VERSION.tazpkg $CUR_DIR
    1.98 +[ "$keep" == "yes" ] &&
    1.99 +( mv $PACKAGE-$VERSION.tazpkg $CUR_DIR &&
   1.100 +  echo Saved $PACKAGE-$VERSION.tazpkg to $CUR_DIR )
   1.101  
   1.102  # Remove temporary build directory
   1.103  cd $CUR_DIR
     2.1 --- a/get-libaacs/receipt	Mon Feb 10 15:18:14 2020 +0100
     2.2 +++ b/get-libaacs/receipt	Tue Feb 11 08:08:11 2020 +0100
     2.3 @@ -1,18 +1,17 @@
     2.4  # SliTaz package receipt.
     2.5  
     2.6  PACKAGE="get-libaacs"
     2.7 -VERSION="1.00"
     2.8 +VERSION="1.01"
     2.9  CATEGORY="non-free"
    2.10 +TAGS="bluray"
    2.11  SHORT_DESC="Get a library to play encrypted blu-ray."
    2.12  MAINTAINER="pascal.bellard@slitaz.org"
    2.13  LICENSE="BSD"
    2.14  WEB_SITE="http://vlc-bluray.whoknowsmy.name/"
    2.15 -TAGS="bluray"
    2.16  
    2.17  # Rules to gen a SliTaz package suitable for Tazpkg.
    2.18  genpkg_rules()
    2.19  {
    2.20  	mkdir -p $fs/usr/bin
    2.21 -	cp stuff/get-libaacs $fs/usr/bin
    2.22 +	cp stuff/get-libaacs	$fs/usr/bin
    2.23  }
    2.24 -
     3.1 --- a/get-libaacs/stuff/get-libaacs	Mon Feb 10 15:18:14 2020 +0100
     3.2 +++ b/get-libaacs/stuff/get-libaacs	Tue Feb 11 08:08:11 2020 +0100
     3.3 @@ -1,46 +1,132 @@
     3.4 -#!/bin/sh -e
     3.5 +#!/bin/sh
     3.6 +#
     3.7 +# get-libaacs - create and install SliTaz package libaacs
     3.8 +#
     3.9 +# (C) 2020 SliTaz - GNU General Public License v3.
    3.10 +# Author : Pascal Bellard
    3.11 +# modified by HGT on 2020-02-11
    3.12 +#
    3.13  
    3.14 +#	=== Initialisations ===
    3.15 +
    3.16 +PKGS_DB="/var/lib/tazpkg"	# packages database directory
    3.17  PACKAGE="libaacs"
    3.18  VERSION="1.0"
    3.19 -WEB_SITE="http://vlc-bluray.whoknowsmy.name/"
    3.20  CATEGORY="non-free"
    3.21 +SHORT_DESC="A library to play encrypted blu-ray."
    3.22 +MAINTAINER="nobody@slitaz.org"
    3.23 +WEB_SITE="https://vlc-bluray.whoknowsmy.name/"
    3.24  SUGGESTED="vlc"
    3.25 -SHORT_DESC="A library to play encrypted blu-ray"
    3.26 -MAINTAINER="nobody@slitaz.org"
    3.27  
    3.28 -ROOT="$1"
    3.29 -[ -d "$ROOT" ] || ROOT=""
    3.30 +# Declare functions check_root, status, ...
    3.31 +. /lib/libtaz.sh
    3.32 +# and make commandline options (if any) available as variables
    3.33  
    3.34 -if test $(id -u) != 0 ; then
    3.35 -        echo -e "\nYou must be root to run `basename $0`."
    3.36 -        echo -e "Please type 'su' and root password to become super-user.\n"
    3.37 -        exit 0
    3.38 +is_installed()
    3.39 +{
    3.40 +	if [ -d $ROOT$PKGS_DB/installed/$PACKAGE ]
    3.41 +	  then	#package is deemed to be installed
    3.42 +	 	return 0
    3.43 +	  else
    3.44 +	 	return 1
    3.45 +	 fi
    3.46 +}
    3.47 +
    3.48 +# Show commandline options, if requested by --help
    3.49 +if [ "$help" == "yes" ]
    3.50 +  then
    3.51 +	echo "Commandline options:
    3.52 +  $0
    3.53 +	--version=<version>
    3.54 +	--root=<path-to-root>
    3.55 +	--install=yes|no
    3.56 +	--keep=no|yes
    3.57 +	--tmpdir=<directory-to-build-package>"
    3.58 +	exit
    3.59  fi
    3.60  
    3.61 -if [ -d $ROOT/var/lib/tazpkg/installed/$PACKAGE ]; then
    3.62 -	[ -n "$ROOT" ] && exit 1
    3.63 -	tazpkg remove $PACKAGE
    3.64 -	[ -d /var/lib/tazpkg/installed/$PACKAGE ] && exit 1
    3.65 +# Check for system administrator privileges
    3.66 +check_root
    3.67 +
    3.68 +title "Package $PACKAGE will be build as SliTaz package and installed"
    3.69 +
    3.70 +# Fetch latest version, unless version is set by option --version
    3.71 +[ -z "$version" ] && version="latest"
    3.72 +
    3.73 +# Install SliTaz package, unless inhibited by option --install=no
    3.74 +[ -z "$install" ] && install="yes"
    3.75 +
    3.76 +# Delete SliTaz package file $PACKAGE-$VERSION.tazpkg after installation,
    3.77 +# unless option --keep=yes is given
    3.78 +[ -z "$keep" ] && keep="no"
    3.79 +
    3.80 +# Directory for temporary files
    3.81 +TMP_DIR="$tmpdir"
    3.82 +[ -z "$tmpdir" ] && TMP_DIR="/tmp/get-$PACKAGE"
    3.83 +
    3.84 +# Logging file (unused by now)
    3.85 +LOG="$logfile"
    3.86 +[ -z "$logfile" ] && LOG=$TMP_DIR/get-$PACKAGE.log
    3.87 +
    3.88 +cat <<EOT
    3.89 +Options in use:
    3.90 +  root           : $root/
    3.91 +  version        : $version
    3.92 +  install package: $install
    3.93 +  keep tazpkg    : $keep
    3.94 +  build directory: $TMP_DIR
    3.95 +
    3.96 +EOT
    3.97 +
    3.98 +separator; newline
    3.99 +
   3.100 +#	=== Remove package, if installed ===
   3.101 +if is_installed
   3.102 +  then
   3.103 +	echo "$PACKAGE is already installed."
   3.104 +	echo -n "Would you like to remove and reinstall this package [y/n]? "
   3.105 +	read answer
   3.106 +	case "$answer" in
   3.107 +		y|Y)
   3.108 +			action "Removing installed version..."
   3.109 +			tazpkg remove $PACKAGE --root="$root/"
   3.110 +			[ ! is_installed ] &&
   3.111 +			die "Can't remove installed version. Exiting."
   3.112 +			;;
   3.113 +		*)
   3.114 +			echo "Leaving $PACKAGE untouched."
   3.115 +			exit 0
   3.116 +			;;
   3.117 +	esac
   3.118  fi
   3.119  
   3.120 -TMP_DIR=/tmp/get-$PACKAGE-$$-$RANDOM
   3.121 +#	=== Fetch files ===
   3.122 +
   3.123  CUR_DIR=$(pwd)
   3.124 -mkdir -p $TMP_DIR && cd $TMP_DIR
   3.125 +mkdir -p $TMP_DIR
   3.126 +cd $TMP_DIR
   3.127  
   3.128 -for i in KEYDB.cfg linux32/libaacs.so.0 ; do
   3.129 -	wget ${WEB_SITE}files/$i
   3.130 +for i in KEYDB.cfg linux32/libaacs.so.0
   3.131 +  do
   3.132 +	wget --no-check-certificate ${WEB_SITE}files/$i
   3.133  	[ -s $(basename $i) ] && continue
   3.134  	cd $CUR_DIR
   3.135  	rm -rf $TMP_DIR
   3.136  	echo "Could not download $(basename $i) from ${WEB_SITE}files/$i. Exiting."
   3.137  	exit 1
   3.138 -done
   3.139 +  done
   3.140  
   3.141 -mkdir -p $PACKAGE-$VERSION/fs/usr/lib $PACKAGE-$VERSION/fs/etc/skel/.config/aacs
   3.142 -mv libaacs.so.0 $PACKAGE-$VERSION/fs/usr/lib
   3.143 -mv KEYDB.cfg $PACKAGE-$VERSION/fs/etc/skel/.config/aacs
   3.144 +#	=== Create SliTaz package ===
   3.145  
   3.146 +mkdir -p $PACKAGE-$VERSION/fs/usr/lib
   3.147 +mkdir -p $PACKAGE-$VERSION/fs/etc/skel/.config/aacs
   3.148 +mv libaacs.so.0	$PACKAGE-$VERSION/fs/usr/lib
   3.149 +mv KEYDB.cfg	$PACKAGE-$VERSION/fs/etc/skel/.config/aacs
   3.150 +
   3.151 +# Create recipe for SliTaz package
   3.152  cat > $PACKAGE-$VERSION/receipt <<EOT
   3.153 +# SliTaz package receipt.
   3.154 +
   3.155  PACKAGE="$PACKAGE"
   3.156  VERSION="$VERSION"
   3.157  CATEGORY="$CATEGORY"
   3.158 @@ -49,35 +135,40 @@
   3.159  SUGGESTED="$SUGGESTED"
   3.160  WEB_SITE="$WEB_SITE"
   3.161  
   3.162 -# Pre and post install commands for Tazpkg.
   3.163 +# Post install commands for Tazpkg.
   3.164  post_install()
   3.165  {
   3.166 -	for i in \$1/home/*/.config ; do
   3.167 +	for i in \$1/home/*/.config
   3.168 +	  do
   3.169  		[ -d \$i ] || continue
   3.170  		cp -a \$1/etc/skel/.config/aacs \$i
   3.171  		chown -R \$(stat -c '%u.%g' \$i) \$i/aacs
   3.172 -	done
   3.173 +	  done
   3.174  }
   3.175  
   3.176 +# Pre remove commands for Tazpkg.
   3.177  pre_remove()
   3.178  {
   3.179  	rm -rf \$1/home/*/.config/aacs
   3.180  }
   3.181  EOT
   3.182  
   3.183 +action "Creating the package $PACKAGE..."
   3.184  # Pack
   3.185  tazpkg pack $PACKAGE-$VERSION
   3.186 -
   3.187 -# Clean to save RAM memory
   3.188 +# Remove package tree
   3.189  rm -rf $PACKAGE-$VERSION
   3.190  
   3.191 -# Install pseudo package
   3.192 -tazpkg install $PACKAGE-$VERSION.tazpkg --root=$ROOT
   3.193 -case " $@ " in
   3.194 -*\ --k*) mv $PACKAGE-$VERSION.tazpkg $CUR_DIR ;;
   3.195 -esac
   3.196 +#	=== Install the SliTaz package ===
   3.197 +[ "$install" == "yes" ] &&
   3.198 +tazpkg install $PACKAGE-$VERSION.tazpkg --root="$root"
   3.199  
   3.200 -# Clean
   3.201 +#	=== Cleanup ===
   3.202 +# Preserve package file, if requested
   3.203 +[ "$keep" == "yes" ] &&
   3.204 +( mv $PACKAGE-$VERSION.tazpkg $CUR_DIR &&
   3.205 +  echo Saved $PACKAGE-$VERSION.tazpkg to $CUR_DIR )
   3.206 +
   3.207 +# Remove temporary build directory
   3.208  cd $CUR_DIR
   3.209  rm -rf $TMP_DIR
   3.210 -