wok-current view get-teamviewer/stuff/get-teamviewer @ rev 17448
Add Qcad 2D CAD application
author | Christophe Lincoln <pankso@slitaz.org> |
---|---|
date | Sun Dec 14 10:13:18 2014 +0100 (2014-12-14) |
parents | b4e5ae364192 |
children | d11fd3e3b9d3 |
line source
1 #!/bin/sh -e
3 PACKAGE="teamviewer"
4 WEB_SITE="http://www.$PACKAGE.com/"
5 URL=${WEB_SITE}download/${PACKAGE}_linux.deb
6 DEPENDS="bash alsa-lib zlib xorg-libXext"
7 ROOT="$1"
8 [ -d "$ROOT" ] || ROOT=""
10 if test $(id -u) != 0 ; then
11 echo -e "\nYou must be root to run `basename $0`."
12 echo -e "Please type 'su' and root password to become super-user.\n"
13 exit 0
14 fi
16 if [ -d $ROOT/var/lib/tazpkg/installed/$PACKAGE ]; then
17 [ -n "$ROOT" ] && exit 1
18 tazpkg remove $PACKAGE
19 [ -d /var/lib/tazpkg/installed/$PACKAGE ] && exit 1
20 fi
22 TMP_DIR=/tmp/get-$PACKAGE-$$-$RANDOM
23 CUR_DIR=$(pwd)
24 mkdir -p $TMP_DIR && cd $TMP_DIR
26 # Download deb
27 wget $URL
28 FILE=$(basename $URL)
30 if [ ! -f $FILE ]; then
31 cd $CUR_DIR
32 rm -rf $TMP_DIR
33 echo "Could not download $FILE from $URL. Exiting."
34 exit 1
35 fi
37 mkdir $PACKAGE
38 dpkg-deb -e $FILE $PACKAGE/meta
39 dpkg-deb -x $FILE $PACKAGE/fs
40 # extracted pkg can be removed: Save RAM
41 rm -f $FILE
42 sed '/^Description:/,$!d;s/^Description://' \
43 < $PACKAGE/meta/control > $PACKAGE/description.txt
45 SHORT_DESC="$(sed '/^Description:/!d;s/.*: //' $PACKAGE/meta/control)"
46 MAINTAINER="$(sed '/^Maintainer:/!d;s/.*: //' $PACKAGE/meta/control)"
47 VERSION="$(sed '/^Version:/!d;s/.*: //' $PACKAGE/meta/control)"
48 mv $PACKAGE $PACKAGE-$VERSION
50 cd $PACKAGE-$VERSION/fs
51 ln -s $(cd usr/bin ; ls $PACKAGE*) usr/bin/$PACKAGE 2> /dev/null || true
52 mkdir -p usr/share/applications
53 sed "s|EXEC|/usr/bin/$PACKAGE|g;s!ICON!/$(find opt | grep $PACKAGE.png)!g" \
54 < $(find opt | grep -E '(desktop.template|\.desktop$)') \
55 > usr/share/applications/$PACKAGE.desktop
56 sed -i 's/readlink -e/readlink $0 || echo /' $(find opt | grep /$PACKAGE$)
57 cd ../..
59 cat > $PACKAGE-$VERSION/receipt <<EOT
60 # SliTaz package receipt.
62 PACKAGE="$PACKAGE"
63 VERSION="$VERSION"
64 CATEGORY="non-free"
65 SHORT_DESC="$SHORT_DESC"
66 MAINTAINER="$MAINTAINER"
67 DEPENDS="$DEPENDS"
68 WEB_SITE="$WEB_SITE"
70 post_install()
71 {
72 cat <<EOF
73 Web viewer (needs flash): https://go.teamviewer.com/v${VERSION%%.*}/
74 EOF
75 }
76 EOT
78 # Pack
79 tazpkg pack $PACKAGE-$VERSION
81 # Clean to save RAM memory
82 rm -rf $PACKAGE-$VERSION
84 # Install pseudo package
85 tazpkg install $PACKAGE-$VERSION.tazpkg --root=$ROOT
86 case " $@ " in
87 *\ --k*) mv $PACKAGE-$VERSION.tazpkg $CUR_DIR ;;
88 esac
90 # Clean
91 cd $CUR_DIR
92 rm -rf $TMP_DIR