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

giblib: modified configure parameter
author Hans-G?nter Theisgen
date Fri May 20 10:31:53 2022 +0100 (2022-05-20)
parents 848953b66f8d
children
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 # modified by HGT on 2021-04-14
9 #
11 # === Initialisations ===
13 PKGS_DB="/var/lib/tazpkg" # packages database directory
14 PACKAGE="teamviewer"
15 CATEGORY="non-free"
16 WEB_SITE="https://www.teamviewer.com/"
17 DEPENDS="alsa-lib bash libjpeg62 xorg-libXext zlib"
19 # Declare functions check_root, status, ...
20 . /lib/libtaz.sh
21 # and make commandline options (if any) available as variables
23 is_installed()
24 {
25 if [ -d $ROOT$PKGS_DB/installed/$PACKAGE ]
26 then #package is deemed to be installed
27 return 0
28 else
29 return 1
30 fi
31 }
33 # Show commandline options, if requested by --help
34 if [ "$help" == "yes" ]
35 then
36 echo "Commandline options:
37 $0
38 --version=<two digits and letter x>
39 --root=<path-to-root>
40 --install=yes|no
41 --keep=no|yes
42 --tmpdir=<directory-to-build-package>
43 --logfile=<logging-file>"
44 exit
45 fi
47 # Check for system administrator privileges
48 check_root
50 title "Package $PACKAGE will be build as SliTaz package and installed"
52 # Fetch latest version, unless version is set by option --version=##x
53 [ -z "$version" ] && version="latest"
55 # Install SliTaz package, unless inhibited by option --install=no
56 [ -z "$install" ] && install="yes"
58 # Delete SliTaz package file $PACKAGE-$VERSION.tazpkg after installation,
59 # unless option --keep=yes is given
60 [ -z "$keep" ] && keep="no"
62 # Directory for temporary files
63 [ -z "$tempdir" ] && TMP_DIR="/tmp/get-$PACKAGE"
65 # Logging file
66 [ -z "$logfile" ] && LOG=$TMP_DIR/get-$PACKAGE.log
68 cat <<EOT
69 Options in use:
70 root : $root/
71 version : $version
72 install package: $install
73 keep tazpkg : $keep
74 build directory: $TMP_DIR
75 logging file : $LOG
77 EOT
79 separator; newline
81 # === Remove package, if installed ===
82 if is_installed
83 then
84 echo "$PACKAGE is already installed."
85 echo -n "Would you like to remove and reinstall this package [y/n]? "
86 read answer
87 case "$answer" in
88 (y|Y)
89 action "Removing installed version..."
90 tazpkg remove $PACKAGE --root="$root/"
91 [ ! is_installed ] &&
92 die "Can't remove installed version. Exiting."
93 ;;
94 (*)
95 echo "Leaving $PACKAGE untouched."
96 exit 0
97 ;;
98 esac
99 fi
101 # === Fetch Debian package, if not existing ===
102 if [ "$version" == "latest" ]
103 then
104 WGET_URL=$(wget --no-check-certificate -O - ${WEB_SITE}en/download/linux | sed '/i386/!d;s/.*"\([^"]*i386[^"]*\).*/\1/;q')
105 FILE=$(basename $WGET_URL)
106 else
107 VERSION=$version
108 FILE="${PACKAGE}_i386.deb"
109 if [[ ${VERSION:0:2} -gt 12 ]]
110 then
111 WGET_URL="https://download.teamviewer.com/download/linux/version_$VERSION/$FILE"
112 else
113 WGET_URL="https://download.teamviewer.com/download/version_$VERSION/$FILE"
114 fi
115 fi
117 CUR_DIR=$(pwd)
118 mkdir -p $TMP_DIR
119 cd $TMP_DIR
120 if [ -f $FILE ]
121 then
122 echo "Using existing archive file $FILE"
123 else
124 action "Fetching the archive"
125 newline
126 wget --no-check-certificate $WGET_URL
127 if [ ! -f $FILE ]
128 then
129 cd $CUR_DIR
130 rm -rf $TMP_DIR
131 echo "Could not transfer $FILE from $WGET_URL. Exiting."
132 exit 1
133 fi
134 fi
136 mkdir $PACKAGE
137 dpkg-deb -e $FILE $PACKAGE/meta
138 dpkg-deb -x $FILE $PACKAGE/fs
140 # Remove archive file
141 rm -f $FILE
143 find $PACKAGE/fs | grep /script/ | xargs sed -i 's|--append|-a|'
145 sed '/^Description:/,$!d;s/^Description://' \
146 < $PACKAGE/meta/control > $PACKAGE/description.txt
148 SHORT_DESC="$(sed '/^Description:/!d;s/.*: //' $PACKAGE/meta/control)"
149 MAINTAINER="$(sed '/^Maintainer:/!d;s/.*: //' $PACKAGE/meta/control)"
150 VERSION="$(sed '/^Version:/!d;s/.*: //' $PACKAGE/meta/control)"
152 mv $PACKAGE $PACKAGE-$VERSION
154 cd $PACKAGE-$VERSION/fs
155 [ -e usr/bin/$PACKAGE ] ||
156 ln -s $(cd usr/bin ; ls $PACKAGE* 2> /dev/null) \
157 usr/bin/$PACKAGE 2> /dev/null || true
159 mkdir -p usr/share/applications
161 # because failing ...
162 #sed "s|EXEC|/usr/bin/$PACKAGE|g;s!ICON!/$(find opt | grep $PACKAGE.png)!g" \
163 # < $(find opt | grep -E '(desktop.template|\.desktop$)') \
164 # > usr/share/applications/$PACKAGE.desktop
165 # replaced by:
166 cp opt/teamviewer/tv_bin/desktop/teamviewer-teamviewer??.desktop \
167 usr/share/applications/teamviewer.desktop
169 sed -i 's/readlink -e/readlink $0 || echo /' \
170 $(find opt -type f | grep /$PACKAGE$)
172 cd ../..
174 cat > $PACKAGE-$VERSION/receipt <<EOT
175 # SliTaz package receipt.
177 PACKAGE="$PACKAGE"
178 VERSION="$VERSION"
179 CATEGORY="$CATEGORY"
180 SHORT_DESC="$SHORT_DESC"
181 MAINTAINER="$MAINTAINER"
182 DEPENDS="$DEPENDS"
183 WEB_SITE="$WEB_SITE"
185 post_install()
186 {
187 cat <<EOF
188 Web viewer (needs flash): https://go.teamviewer.com/v${VERSION%%.*}/
189 EOF
190 }
191 EOT
193 # === Create the SliTaz package ===
194 tazpkg pack $PACKAGE-$VERSION
196 # === Install the SliTaz package ===
197 [ "$install" == "yes" ] &&
198 tazpkg install $PACKAGE-$VERSION.tazpkg --root="$root"
200 # === Cleanup ===
201 # Preserve package file, if requested
202 [ "$keep" == "yes" ] &&
203 ( mv $PACKAGE-$VERSION.tazpkg $CUR_DIR &&
204 echo "Saved $PACKAGE-$VERSION.tazpkg to $CUR_DIR" )
206 # Remove temporary build directory
207 cd $CUR_DIR
208 rm -rf $TMP_DIR