wok view get-anydesk/stuff/get-anydesk @ rev 24044

modified WEB_SITE in stuff/get-anydesk
author Hans-G?nter Theisgen
date Sat May 01 09:28:58 2021 +0100 (2021-05-01)
parents a00792a1ec20
children
line source
1 #!/bin/sh
2 #
3 # get-anydesk - create and install SliTaz package anydesk
4 #
5 # (C) 2021 SliTaz - GNU General Public License v3.
6 # Author : HGT
7 # modified by HGT on 2021-04-15
8 # modified by HGT on 2021-05-01
9 #
11 # === Initialisations ===
13 PKGS_DB="/var/lib/tazpkg" # packages database directory
14 PACKAGE="anydesk"
15 CATEGORY="non-free"
16 SHORT=DESC="remote access"
17 MAINTAINER="nobody@slitaz.org"
18 LICENSE="non-free"
19 WEB_SITE="https://anydesk.com/"
21 # Declare functions check_root, status, ...
22 . /lib/libtaz.sh
23 # and make commandline options (if any) available as variables
25 is_installed()
26 {
27 if [ -d $ROOT$PKGS_DB/installed/$PACKAGE ]
28 then #package is deemed to be installed
29 return 0
30 else
31 return 1
32 fi
33 }
35 # Show commandline options, if requested by --help
36 if [ "$help" == "yes" ]
37 then
38 echo "Commandline options:
39 $0
40 --version=<version>
41 --root=<path-to-root>
42 --install=yes|no
43 --keep=no|yes
44 --tmpdir=<directory-to-build-package>
45 --logfile=<logging-file>"
46 exit
47 fi
49 # Check for system administrator privileges
50 check_root
52 title "Package $PACKAGE will be build as SliTaz package and installed"
54 # Fetch latest version, unless version is set by option --version
55 [ -z "$version" ] && version="latest"
57 # Install SliTaz package, unless inhibited by option --install=no
58 [ -z "$install" ] && install="yes"
60 # Delete SliTaz package file $PACKAGE-$VERSION.tazpkg after installation,
61 # unless option --keep=yes is given
62 [ -z "$keep" ] && keep="no"
64 # Directory for temporary files
65 TMP_DIR="$tmpdir"
66 [ -z "$tmpdir" ] && TMP_DIR="/tmp/get-$PACKAGE"
68 # Logging file (unused by now)
69 LOG="$logfile"
70 [ -z "$logfile" ] && LOG=$TMP_DIR/get-$PACKAGE.log
72 cat <<EOT
73 Options in use:
74 root : $root/
75 version : $version
76 install package: $install
77 keep tazpkg : $keep
78 build directory: $TMP_DIR
79 logging file : $LOG
81 EOT
83 separator; newline
85 # === Remove package, if installed ===
86 if is_installed
87 then
88 echo "$PACKAGE is already installed."
89 echo -n "Would you like to remove and reinstall this package [y/n]? "
90 read answer
91 case "$answer" in
92 y|Y)
93 action "Removing installed version..."
94 tazpkg remove $PACKAGE --root="$root/"
95 [ ! is_installed ] &&
96 die "Can't remove installed version. Exiting."
97 ;;
98 *)
99 echo "Leaving $PACKAGE untouched."
100 exit 0
101 ;;
102 esac
103 fi
105 # === Fetch Debian package, if not existing ===
106 if [ "$version" == "latest" ]
107 then
108 VERSION="$(wget -q --no-check-certificate -O - https://anydesk.com/en/downloads/linux | \
109 sed -n '/i386.deb">.*Debian.*/p' | sed 's|.*_\(.*\)_.*|\1|' )"
110 if [ -z "$VERSION" ]
111 then
112 echo "Could not determine latest version. Call get-anydesk with version parameter."
113 exit 1
114 else
115 FILE="${PACKAGE}_${VERSION}_i386.deb"
116 WGET_URL="https://download.anydesk.com/linux/$FILE"
117 fi
118 else
119 # for available versions see https://download.anydesk.com/linux/
120 VERSION=$version
121 FILE="${PACKAGE}_${VERSION}_i386.deb"
122 WGET_URL="https://download.anydesk.com/linux/deb/$FILE"
123 fi
125 CUR_DIR=$(pwd)
126 mkdir -p $TMP_DIR
127 cd $TMP_DIR
128 if [ -f $FILE ]
129 then
130 echo "Using existing archive file $FILE"
131 else
132 action "Fetching the archive"
133 newline
134 wget --no-check-certificate $WGET_URL
135 if [ ! -f $FILE ]
136 then
137 cd $CUR_DIR
138 rm -rf $TMP_DIR
139 echo "Could not transfer $FILE from $WGET_URL. Exiting."
140 exit 1
141 fi
142 fi
144 # === Convert Debian package to SliTaz package ===
145 action "Converting the package"
146 newline
148 tazpkg convert $FILE
149 status
150 VERSION=${VERSION%-*}
152 # Remove archive file
153 rm -f $FILE
155 # === Install the SliTaz package ===
156 [ "$install" == "yes" ] &&
157 tazpkg install $PACKAGE-$VERSION.tazpkg --root="$root"
159 # === Cleanup ===
160 # Preserve package file, if requested
161 [ "$keep" == "yes" ] &&
162 ( mv $PACKAGE-$VERSION.tazpkg $CUR_DIR &&
163 echo "Saved $PACKAGE-$VERSION.tazpkg to $CUR_DIR" )
165 # Remove temporary build directory
166 cd $CUR_DIR
167 rm -rf $TMP_DIR