wok view get-teamviewer/stuff/get-teamviewer @ rev 24035

updated sane-backends and sane-backends-dev (1.0.22 -> 1.0.24)
author Hans-G?nter Theisgen
date Sun Apr 11 15:30:14 2021 +0100 (2021-04-11)
parents 5baa35df2fab
children aae4e23265ae
line source
1 #!/bin/sh -e
2 # get-teamviewer - create and install SliTaz package teamviewer
3 #
4 # (C) 2021 SliTaz - GNU General Public License v3.
5 #
6 # Author :
7 # modified by HGT on 2021-04-06
8 #
10 # === Initialisations ===
12 PKGS_DB="/var/lib/tazpkg" # packages database directory
13 PACKAGE="teamviewer"
14 CATEGORY="non-free"
15 WEB_SITE="https://www.teamviewer.com/"
16 DEPENDS="alsa-lib bash xorg-libXext zlib"
18 # Declare functions check_root, status, ...
19 . /lib/libtaz.sh
20 # and make commandline options (if any) available as variables
22 is_installed()
23 {
24 if [ -d $ROOT$PKGS_DB/installed/$PACKAGE ]
25 then #package is deemed to be installed
26 return 0
27 else
28 return 1
29 fi
30 }
32 # Show commandline options, if requested by --help
33 if [ "$help" == "yes" ]
34 then
35 echo "Commandline options:
36 $0
37 --version=<two digits and letter x>
38 --root=<path-to-root>
39 --install=yes|no
40 --keep=no|yes
41 --tmpdir=<directory-to-build-package>
42 --logfile=<logging-file>"
43 exit
44 fi
46 # Check for system administrator privileges
47 check_root
49 title "Package $PACKAGE will be build as SliTaz package and installed"
51 # Fetch latest version, unless version is set by option --version=##x
52 [ -z "$version" ] && version="latest"
54 # Install SliTaz package, unless inhibited by option --install=no
55 [ -z "$install" ] && install="yes"
57 # Delete SliTaz package file $PACKAGE-$VERSION.tazpkg after installation,
58 # unless option --keep=yes is given
59 [ -z "$keep" ] && keep="no"
61 # Directory for temporary files
62 [ -z "$tempdir" ] && TMP_DIR="/tmp/get-$PACKAGE"
64 # Logging file
65 [ -z "$logfile" ] && LOG=$TMP_DIR/get-$PACKAGE.log
67 cat <<EOT
68 Options in use:
69 root : $root/
70 version : $version
71 install package: $install
72 keep tazpkg : $keep
73 build directory: $TMP_DIR
74 logging file : $LOG
76 EOT
78 separator; newline
80 # === Remove package, if installed ===
81 if is_installed
82 then
83 echo "$PACKAGE is already installed."
84 echo -n "Would you like to remove and reinstall this package [y/n]? "
85 read answer
86 case "$answer" in
87 (y|Y)
88 action "Removing installed version..."
89 tazpkg remove $PACKAGE --root="$root/"
90 [ ! is_installed ] &&
91 die "Can't remove installed version. Exiting."
92 ;;
93 (*)
94 echo "Leaving $PACKAGE untouched."
95 exit 0
96 ;;
97 esac
98 fi
100 # === Fetch Debian package, if not existing ===
101 if [ "$version" == "latest" ]
102 then
103 WGET_URL=$(wget --no-check-certificate -O - ${WEB_SITE}en/download/linux | sed '/i386/!d;s/.*"\([^"]*i386[^"]*\).*/\1/;q')
104 FILE=$(basename $WGET_URL)
105 else
106 VERSION=$version
107 FILE="${PACKAGE}_i386.deb"
108 if [[ ${VERSION:0:2} -gt 12 ]]
109 then
110 WGET_URL="https://download.teamviewer.com/download/linux/version_$VERSION/$FILE"
111 else
112 WGET_URL="https://download.teamviewer.com/download/version_$VERSION/$FILE"
113 fi
114 fi
116 CUR_DIR=$(pwd)
117 mkdir -p $TMP_DIR
118 cd $TMP_DIR
119 if [ -f $FILE ]
120 then
121 echo "Using existing archive file $FILE"
122 else
123 action "Fetching the archive"
124 newline
125 wget --no-check-certificate $WGET_URL
126 if [ ! -f $FILE ]
127 then
128 cd $CUR_DIR
129 rm -rf $TMP_DIR
130 echo "Could not transfer $FILE from $WGET_URL. Exiting."
131 exit 1
132 fi
133 fi
135 mkdir $PACKAGE
136 dpkg-deb -e $FILE $PACKAGE/meta
137 dpkg-deb -x $FILE $PACKAGE/fs
138 find $PACKAGE/fs | grep /script/ | xargs sed -i 's|--append|-a|'
140 # Remove archive file
141 rm -f $FILE
142 sed '/^Description:/,$!d;s/^Description://' \
143 < $PACKAGE/meta/control > $PACKAGE/description.txt
145 SHORT_DESC="$(sed '/^Description:/!d;s/.*: //' $PACKAGE/meta/control)"
146 MAINTAINER="$(sed '/^Maintainer:/!d;s/.*: //' $PACKAGE/meta/control)"
147 VERSION="$(sed '/^Version:/!d;s/.*: //' $PACKAGE/meta/control)"
148 mv $PACKAGE $PACKAGE-$VERSION
150 cd $PACKAGE-$VERSION/fs
151 [ -e usr/bin/$PACKAGE ] ||
152 ln -s $(cd usr/bin ; ls $PACKAGE* 2> /dev/null) \
153 usr/bin/$PACKAGE 2> /dev/null || true
154 mkdir -p usr/share/applications
156 # removed because failing, to be repaired by somebody else:
157 #sed "s|EXEC|/usr/bin/$PACKAGE|g;s!ICON!/$(find opt | grep $PACKAGE.png)!g" \
158 # < $(find opt | grep -E '(desktop.template|\.desktop$)') \
159 # > usr/share/applications/$PACKAGE.desktop
161 sed -i 's/readlink -e/readlink $0 || echo /' \
162 $(find opt -type f | grep /$PACKAGE$)
163 cd ../..
165 cat > $PACKAGE-$VERSION/receipt <<EOT
166 # SliTaz package receipt.
168 PACKAGE="$PACKAGE"
169 VERSION="$VERSION"
170 CATEGORY="$CATEGORY"
171 SHORT_DESC="$SHORT_DESC"
172 MAINTAINER="$MAINTAINER"
173 DEPENDS="$DEPENDS"
174 WEB_SITE="$WEB_SITE"
176 post_install()
177 {
178 cat <<EOF
179 Web viewer (needs flash): https://go.teamviewer.com/v${VERSION%%.*}/
180 EOF
181 }
182 EOT
184 # === Create the SliTaz package ===
185 tazpkg pack $PACKAGE-$VERSION
187 # === Install the SliTaz package ===
188 [ "$install" == "yes" ] &&
189 tazpkg install $PACKAGE-$VERSION.tazpkg --root="$root"
191 # === Cleanup ===
192 # Preserve package file, if requested
193 [ "$keep" == "yes" ] &&
194 ( mv $PACKAGE-$VERSION.tazpkg $CUR_DIR &&
195 echo "Saved $PACKAGE-$VERSION.tazpkg to $CUR_DIR" )
197 # Remove temporary build directory
198 cd $CUR_DIR
199 rm -rf $TMP_DIR