wok rev 24030

updated get-teamviewer (1.00 -> 1.01)
author Hans-G?nter Theisgen
date Mon Apr 05 10:50:45 2021 +0100 (2021-04-05)
parents 1049482a1a19
children b4b3cde755b0
files get-teamviewer/receipt get-teamviewer/stuff/get-teamviewer
line diff
     1.1 --- a/get-teamviewer/receipt	Thu Mar 25 08:56:08 2021 +0100
     1.2 +++ b/get-teamviewer/receipt	Mon Apr 05 10:50:45 2021 +0100
     1.3 @@ -1,17 +1,16 @@
     1.4  # SliTaz package receipt.
     1.5  
     1.6  PACKAGE="get-teamviewer"
     1.7 -VERSION="1.00"
     1.8 +VERSION="1.01"
     1.9  CATEGORY="non-free"
    1.10  SHORT_DESC="Get TeamViewer (Remote Control Application)."
    1.11  MAINTAINER="pascal.bellard@slitaz.org"
    1.12  LICENSE="BSD"
    1.13 -WEB_SITE="http://www.teamviewer.com/"
    1.14 +WEB_SITE="https://www.teamviewer.com/"
    1.15  
    1.16  # Rules to gen a SliTaz package suitable for Tazpkg.
    1.17  genpkg_rules()
    1.18  {
    1.19  	mkdir -p $fs/usr/bin
    1.20 -	cp stuff/$PACKAGE $fs/usr/bin
    1.21 +	cp stuff/$PACKAGE	$fs/usr/bin
    1.22  }
    1.23 -
     2.1 --- a/get-teamviewer/stuff/get-teamviewer	Thu Mar 25 08:56:08 2021 +0100
     2.2 +++ b/get-teamviewer/stuff/get-teamviewer	Mon Apr 05 10:50:45 2021 +0100
     2.3 @@ -1,45 +1,138 @@
     2.4  #!/bin/sh -e
     2.5 +# get-teamviewer - create and install SliTaz package teamviewer
     2.6 +#
     2.7 +# (C) 2021 SliTaz - GNU General Public License v3.
     2.8 +#
     2.9 +# Author : 
    2.10 +# modified by HGT on 2021-04-05
    2.11 +#
    2.12  
    2.13 +#       === Initialisations ===
    2.14 +
    2.15 +PKGS_DB="/var/lib/tazpkg"       # packages database directory
    2.16  PACKAGE="teamviewer"
    2.17 -WEB_SITE="http://www.$PACKAGE.com/"
    2.18 -URL=${WEB_SITE}en/download/linux.aspx
    2.19 -DEPENDS="bash alsa-lib zlib xorg-libXext"
    2.20 -ROOT="$1"
    2.21 -[ -d "$ROOT" ] || ROOT=""
    2.22 +CATEGORY="non-free"
    2.23 +WEB_SITE="https://www.teamviewer.com/"
    2.24 +DEPENDS="alsa-lib bash xorg-libXext zlib"
    2.25  
    2.26 -if test $(id -u) != 0 ; then
    2.27 -        echo -e "\nYou must be root to run `basename $0`."
    2.28 -        echo -e "Please type 'su' and root password to become super-user.\n"
    2.29 -        exit 0
    2.30 +# Declare functions check_root, status, ...
    2.31 +. /lib/libtaz.sh
    2.32 +# and make commandline options (if any) available as variables
    2.33 +
    2.34 +is_installed()
    2.35 +{
    2.36 +	if [ -d $ROOT$PKGS_DB/installed/$PACKAGE ]
    2.37 +	  then  #package is deemed to be installed
    2.38 +		return 0
    2.39 +	  else
    2.40 +		return 1
    2.41 +	fi
    2.42 +}
    2.43 +
    2.44 +# Show commandline options, if requested by --help
    2.45 +if [ "$help" == "yes" ]
    2.46 +  then
    2.47 +	echo "Commandline options:
    2.48 +  $0
    2.49 +	--version=<two digits and letter x>
    2.50 +	--root=<path-to-root>
    2.51 +	--install=yes|no
    2.52 +	--keep=no|yes
    2.53 +	--tmpdir=<directory-to-build-package>
    2.54 +	--logfile=<logging-file>"
    2.55 +	exit
    2.56  fi
    2.57  
    2.58 -if [ -d $ROOT/var/lib/tazpkg/installed/$PACKAGE ]; then
    2.59 -	[ -n "$ROOT" ] && exit 1
    2.60 -	tazpkg remove $PACKAGE
    2.61 -	[ -d /var/lib/tazpkg/installed/$PACKAGE ] && exit 1
    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 version, unless version is set by option --version=##x
    2.68 +[ -z "$version" ] && version="latest"
    2.69 +
    2.70 +# Install SliTaz package, unless inhibited by option --install=no
    2.71 +[ -z "$install" ] && install="yes"
    2.72 +
    2.73 +# Delete SliTaz package file $PACKAGE-$VERSION.tazpkg after installation,
    2.74 +# unless option --keep=yes is given
    2.75 +[ -z "$keep" ] && keep="no"
    2.76 +
    2.77 +# Directory for temporary files
    2.78 +[ -z "$tempdir" ] && TMP_DIR="/tmp/get-$PACKAGE"
    2.79 +
    2.80 +# Logging file
    2.81 +[ -z "$logfile" ] && LOG=$TMP_DIR/get-$PACKAGE.log
    2.82 +
    2.83 +cat <<EOT
    2.84 +Options in use:
    2.85 +  root           : $root/
    2.86 +  version        : $version
    2.87 +  install package: $install
    2.88 +  keep tazpkg    : $keep
    2.89 +  build directory: $TMP_DIR
    2.90 +  logging file   : $LOG
    2.91 +
    2.92 +EOT
    2.93 +
    2.94 +separator; newline
    2.95 +
    2.96 +#       === Remove package, if installed ===
    2.97 +if is_installed
    2.98 +  then
    2.99 +	echo "$PACKAGE is already installed."
   2.100 +	echo -n "Would you like to remove and reinstall this package [y/n]? "
   2.101 +	read answer
   2.102 +	case "$answer" in
   2.103 +		(y|Y)
   2.104 +			action "Removing installed version..."
   2.105 +			tazpkg remove $PACKAGE --root="$root/"
   2.106 +			[ ! is_installed ] &&
   2.107 +			die "Can't remove installed version. Exiting."
   2.108 +			;;
   2.109 +		(*)
   2.110 +			echo "Leaving $PACKAGE untouched."
   2.111 +			exit 0
   2.112 +			;;
   2.113 +	esac
   2.114  fi
   2.115  
   2.116 -TMP_DIR=/tmp/get-$PACKAGE-$$-$RANDOM
   2.117 +#       === Fetch Debian package, if not existing ===
   2.118 +if [ "$version" == "latest" ]
   2.119 +  then
   2.120 +	WGET_URL=$(wget --no-check-certificate -O - ${WEB_SITE}en/download/linux | sed '/i386/!d;s/.*"\([^"]*i386[^"]*\).*/\1/;q')
   2.121 +	FILE=$(basename $WGET_URL)
   2.122 +  else
   2.123 +        VERSION=$version
   2.124 +        FILE="${PACKAGE}_i386.deb"
   2.125 +        WGET_URL="https://download.teamviewer.com/download/linux/version_$VERSION/$FILE"
   2.126 +fi
   2.127 +
   2.128  CUR_DIR=$(pwd)
   2.129 -mkdir -p $TMP_DIR && cd $TMP_DIR
   2.130 -
   2.131 -# Download deb
   2.132 -URL=$(wget -O - $URL | sed '/i386/!d;s/.*"\([^"]*i386[^"]*\).*/\1/;q')
   2.133 -wget $URL
   2.134 -FILE=$(basename $URL)
   2.135 -
   2.136 -if [ ! -f $FILE ]; then
   2.137 -	cd $CUR_DIR
   2.138 -	rm -rf $TMP_DIR
   2.139 -	echo "Could not download $FILE from $URL. Exiting."
   2.140 -	exit 1
   2.141 +mkdir -p $TMP_DIR
   2.142 +cd $TMP_DIR
   2.143 +if [ -f $FILE ]
   2.144 +  then
   2.145 +	echo "Using existing archive file $FILE"
   2.146 +  else
   2.147 +	action "Fetching the archive"
   2.148 +	newline
   2.149 +	wget    --no-check-certificate $WGET_URL
   2.150 +	if [ ! -f $FILE ]
   2.151 +	  then
   2.152 +		cd $CUR_DIR
   2.153 +		rm -rf $TMP_DIR
   2.154 +		echo "Could not transfer $FILE from $WGET_URL. Exiting."
   2.155 +		exit 1
   2.156 +	fi
   2.157  fi
   2.158  
   2.159  mkdir $PACKAGE
   2.160  dpkg-deb -e $FILE $PACKAGE/meta
   2.161  dpkg-deb -x $FILE $PACKAGE/fs
   2.162  find $PACKAGE/fs | grep /script/ | xargs sed -i 's|--append|-a|'
   2.163 -# extracted pkg can be removed: Save RAM
   2.164 +
   2.165 +# Remove archive file
   2.166  rm -f $FILE
   2.167  sed '/^Description:/,$!d;s/^Description://' \
   2.168  	< $PACKAGE/meta/control > $PACKAGE/description.txt
   2.169 @@ -51,12 +144,15 @@
   2.170  
   2.171  cd $PACKAGE-$VERSION/fs
   2.172  [ -e usr/bin/$PACKAGE ] ||
   2.173 -ln -s $(cd usr/bin ; ls $PACKAGE* 2> /dev/null) \
   2.174 +	ln -s $(cd usr/bin ; ls $PACKAGE* 2> /dev/null) \
   2.175  	usr/bin/$PACKAGE 2> /dev/null || true
   2.176  mkdir -p usr/share/applications
   2.177 -sed "s|EXEC|/usr/bin/$PACKAGE|g;s!ICON!/$(find opt | grep $PACKAGE.png)!g" \
   2.178 -	< $(find opt | grep -E '(desktop.template|\.desktop$)') \
   2.179 -	> usr/share/applications/$PACKAGE.desktop
   2.180 +
   2.181 +# removed because failing, to be repaired by somebody else:
   2.182 +#sed "s|EXEC|/usr/bin/$PACKAGE|g;s!ICON!/$(find opt | grep $PACKAGE.png)!g" \
   2.183 +#	< $(find opt | grep -E '(desktop.template|\.desktop$)') \
   2.184 +#	> usr/share/applications/$PACKAGE.desktop
   2.185 +
   2.186  sed -i 's/readlink -e/readlink $0 || echo /' \
   2.187  	$(find opt -type f | grep /$PACKAGE$)
   2.188  cd ../..
   2.189 @@ -66,7 +162,7 @@
   2.190  
   2.191  PACKAGE="$PACKAGE"
   2.192  VERSION="$VERSION"
   2.193 -CATEGORY="non-free"
   2.194 +CATEGORY="$CATEGORY"
   2.195  SHORT_DESC="$SHORT_DESC"
   2.196  MAINTAINER="$MAINTAINER"
   2.197  DEPENDS="$DEPENDS"
   2.198 @@ -80,19 +176,19 @@
   2.199  }
   2.200  EOT
   2.201  
   2.202 -# Pack
   2.203 +#       === Create the SliTaz package ===
   2.204  tazpkg pack $PACKAGE-$VERSION
   2.205  
   2.206 -# Clean to save RAM memory
   2.207 -rm -rf $PACKAGE-$VERSION
   2.208 +#       === Install the SliTaz package ===
   2.209 +[ "$install" == "yes" ] &&
   2.210 +tazpkg install $PACKAGE-$VERSION.tazpkg --root="$root"
   2.211  
   2.212 -# Install pseudo package
   2.213 -tazpkg install $PACKAGE-$VERSION.tazpkg --root=$ROOT
   2.214 -case " $@ " in
   2.215 -*\ --k*) mv $PACKAGE-$VERSION.tazpkg $CUR_DIR ;;
   2.216 -esac
   2.217 +#       === Cleanup ===
   2.218 +# Preserve package file, if requested
   2.219 +[ "$keep" == "yes" ] &&
   2.220 +( mv $PACKAGE-$VERSION.tazpkg $CUR_DIR &&
   2.221 +  echo "Saved $PACKAGE-$VERSION.tazpkg to $CUR_DIR" )
   2.222  
   2.223 -# Clean
   2.224 +# Remove temporary build directory
   2.225  cd $CUR_DIR
   2.226  rm -rf $TMP_DIR
   2.227 -