wok rev 23889

created get-anydesk
author Hans-G?nter Theisgen
date Fri Jul 24 11:12:22 2020 +0100 (2020-07-24)
parents 2781677bb539
children 78bc4b109dd6
files get-anydesk/receipt get-anydesk/stuff/get-anydesk
line diff
     1.1 --- /dev/null	Thu Jan 01 00:00:00 1970 +0000
     1.2 +++ b/get-anydesk/receipt	Fri Jul 24 11:12:22 2020 +0100
     1.3 @@ -0,0 +1,17 @@
     1.4 +# SliTaz package receipt.
     1.5 +
     1.6 +PACKAGE="get-anydesk"
     1.7 +VERSION="1.00"
     1.8 +CATEGORY="non-free"
     1.9 +TAGS="rdp"
    1.10 +SHORT_DESC="Feature rich multi-platform remote desktop application."
    1.11 +MAINTAINER="nobody@slitaz.org"
    1.12 +LICENSE="custom"
    1.13 +WEB_SITE="https://anydesk.com/"
    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 +	cp stuff/get-anydesk	$fs/usr/bin
    1.20 +}
     2.1 --- /dev/null	Thu Jan 01 00:00:00 1970 +0000
     2.2 +++ b/get-anydesk/stuff/get-anydesk	Fri Jul 24 11:12:22 2020 +0100
     2.3 @@ -0,0 +1,159 @@
     2.4 +#!/bin/sh
     2.5 +#
     2.6 +# get-anydesk - create and install SliTaz package anydesk
     2.7 +#
     2.8 +# (C) 2020 SliTaz - GNU General Public License v3.
     2.9 +# Author : HGT
    2.10 +#
    2.11 +
    2.12 +#	=== Initialisations ===
    2.13 +
    2.14 +PKGS_DB="/var/lib/tazpkg"	# packages database directory
    2.15 +PACKAGE="anydesk"
    2.16 +CATEGORY="non-free"
    2.17 +SHORT=DESC="remote access"
    2.18 +MAINTAINER="nobody@slitaz.org"
    2.19 +LICENSE="non-free"
    2.20 +WEB_SITE="https://anydesk.com/packagename/"
    2.21 +#DEPENDS="libglu-mesa"
    2.22 +
    2.23 +# Declare functions check_root, status, ...
    2.24 +. /lib/libtaz.sh
    2.25 +# and make commandline options (if any) available as variables
    2.26 +
    2.27 +is_installed()
    2.28 +{
    2.29 +	if [ -d $ROOT$PKGS_DB/installed/$PACKAGE ]
    2.30 +	  then	#package is deemed to be installed
    2.31 +	 	return 0
    2.32 +	  else
    2.33 +	 	return 1
    2.34 +	 fi
    2.35 +}
    2.36 +
    2.37 +# Show commandline options, if requested by --help
    2.38 +if [ "$help" == "yes" ]
    2.39 +  then
    2.40 +	echo "Commandline options:
    2.41 +  $0
    2.42 +	--version=<version>
    2.43 +	--root=<path-to-root>
    2.44 +	--install=yes|no
    2.45 +	--keep=no|yes
    2.46 +	--tmpdir=<directory-to-build-package>
    2.47 +	--logfile=<logging-file>"
    2.48 +	exit
    2.49 +fi
    2.50 +
    2.51 +# Check for system administrator privileges
    2.52 +check_root
    2.53 +
    2.54 +title "Package $PACKAGE will be build as SliTaz package and installed"
    2.55 +
    2.56 +# Fetch latest version, unless version is set by option --version
    2.57 +[ -z "$version" ] && version="latest"
    2.58 +
    2.59 +# Install SliTaz package, unless inhibited by option --install=no
    2.60 +[ -z "$install" ] && install="yes"
    2.61 +
    2.62 +# Delete SliTaz package file $PACKAGE-$VERSION.tazpkg after installation,
    2.63 +# unless option --keep=yes is given
    2.64 +[ -z "$keep" ] && keep="no"
    2.65 +
    2.66 +# Directory for temporary files
    2.67 +TMP_DIR="$tmpdir"
    2.68 +[ -z "$tmpdir" ] && TMP_DIR="/tmp/get-$PACKAGE"
    2.69 +
    2.70 +# Logging file (unused by now)
    2.71 +LOG="$logfile"
    2.72 +[ -z "$logfile" ] && LOG=$TMP_DIR/get-$PACKAGE.log
    2.73 +
    2.74 +cat <<EOT
    2.75 +Options in use:
    2.76 +  root           : $root/
    2.77 +  version        : $version
    2.78 +  install package: $install
    2.79 +  keep tazpkg    : $keep
    2.80 +  build directory: $TMP_DIR
    2.81 +  logging file   : $LOG
    2.82 +
    2.83 +EOT
    2.84 +
    2.85 +separator; newline
    2.86 +
    2.87 +#	=== Remove package, if installed ===
    2.88 +if is_installed
    2.89 +  then
    2.90 +	echo "$PACKAGE is already installed."
    2.91 +	echo -n "Would you like to remove and reinstall this package [y/n]? "
    2.92 +	read answer
    2.93 +	case "$answer" in
    2.94 +		y|Y)
    2.95 +			action "Removing installed version..."
    2.96 +			tazpkg remove $PACKAGE --root="$root/"
    2.97 +			[ ! is_installed ] &&
    2.98 +			die "Can't remove installed version. Exiting."
    2.99 +			;;
   2.100 +		*)
   2.101 +			echo "Leaving $PACKAGE untouched."
   2.102 +			exit 0
   2.103 +			;;
   2.104 +	esac
   2.105 +fi
   2.106 +
   2.107 +#	=== Fetch Debian package, if not existing ===
   2.108 +if [ "$version" == "latest" ]
   2.109 +  then
   2.110 +	VERSION="$(wget --no-check-certificate -O - https://anydesk.com/en/downloads/linux | \
   2.111 +		sed -n '/i386.deb">.*option/p' | sed 's|.*_\(.*\)_.*|\1|' )"
   2.112 +	FILE="${PACKAGE}_${VERSION}_i386.deb"
   2.113 +	WGET_URL="https://download.anydesk.com/linux/$FILE"
   2.114 +  else
   2.115 +	VERSION=$version
   2.116 +	FILE="${PACKAGE}_${VERSION}_i386.deb"
   2.117 +	WGET_URL="https://download.anydesk.com/linux/deb/$FILE"
   2.118 +fi
   2.119 +
   2.120 +CUR_DIR=$(pwd)
   2.121 +mkdir -p $TMP_DIR
   2.122 +cd $TMP_DIR
   2.123 +if [ -f $FILE ]
   2.124 +  then
   2.125 +	echo "Using existing archive file $FILE"
   2.126 +  else
   2.127 +	action "Fetching the archive"
   2.128 +	newline
   2.129 +	wget	--no-check-certificate $WGET_URL
   2.130 +	if [ ! -f $FILE ]
   2.131 +	  then
   2.132 +		cd $CUR_DIR
   2.133 +		rm -rf $TMP_DIR
   2.134 +		echo "Could not transfer $FILE from $WGET_URL. Exiting."
   2.135 +		exit 1
   2.136 +	fi
   2.137 +fi
   2.138 +
   2.139 +#	=== Convert Debian package to SliTaz package ===
   2.140 +action "Converting the package"
   2.141 +newline
   2.142 +
   2.143 +tazpkg convert $FILE
   2.144 +status
   2.145 +VERSION=${VERSION%-*}
   2.146 +
   2.147 +# Remove archive file
   2.148 +rm -f $FILE
   2.149 +
   2.150 +#	=== Install the SliTaz package ===
   2.151 +[ "$install" == "yes" ] &&
   2.152 +tazpkg install $PACKAGE-$VERSION.tazpkg --root="$root"
   2.153 +
   2.154 +#	=== Cleanup ===
   2.155 +# Preserve package file, if requested
   2.156 +[ "$keep" == "yes" ] &&
   2.157 +( mv $PACKAGE-$VERSION.tazpkg $CUR_DIR &&
   2.158 +  echo "Saved $PACKAGE-$VERSION.tazpkg to $CUR_DIR" )
   2.159 +
   2.160 +# Remove temporary build directory
   2.161 +cd $CUR_DIR
   2.162 +rm -rf $TMP_DIR