updated on Wed Jan 25 16:08:47 UTC 2012
[aur-mirror.git] / touchdaemon-git / PKGBUILD
blobc249ddb783889dd87419d29e2df4e7f11f293c1d
1 # See http://wiki.archlinux.org/index.php/VCS_PKGBUILD_Guidelines
2 # for more information on packaging from GIT sources.
4 # Contributor: David Sommer <icecook@sourceforge.net
5 pkgname=touchdaemon-git
6 pkgver=20100314
7 pkgrel=1
8 pkgdesc="A tool to dis-/enable the touchpad during typping automaticly"
9 arch=('i686' 'x86_64')
10 url="http://touchdaemon.sourceforge.net"
11 license=('unknown')
12 groups=()
13 depends=('xorg-server')
14 makedepends=('git')
15 provides=()
16 conflicts=()
17 replaces=()
18 options=()
19 backup=("/etc/rc.d/touchdaemon" "/etc/rc.d/touchdaemon.conf" )
20 install=touchdaemon.install
21 noextract=()
23 _gitroot="git://touchdaemon.git.sourceforge.net/gitroot/touchdaemon/touchdaemon"
24 _gitname="touchdaemon"
26 build() {
27   cd "$srcdir"
28   msg "Connecting to GIT server...."
30   if [ -d $_gitname ] ; then
31     cd $_gitname && git pull origin
32     msg "The local files are updated."
33   else
34     git clone $_gitroot $_gitname
35   fi
37   msg "GIT checkout done or server timeout"
38   msg "Starting make..."
40   rm -rf "$srcdir/$_gitname-build"
41   git clone "$srcdir/$_gitname" "$srcdir/$_gitname-build"
42   cd "$srcdir/$_gitname-build"
43   
44   make || return 1
45   #make DESTDIR="$pkgdir/" install
46   [ -d $pkgdir/usr/share/touchdaemon ] || mkdir $pkgdir/usr/share/touchdaemon -p
47   [ -d $pkgdir/usr/bin ] || mkdir $pkgdir/usr/bin -p
48   
49   cp $srcdir/$_gitname-build/touchdaemon $pkgdir/usr/bin/touchdaemon || return 1
50   rm $srcdir/$_gitname-build/touchdaemon* || return 1
51   cp -r $srcdir/$_gitname-build/* $pkgdir/usr/share/touchdaemon || return 1
54   [ -d $pkgdir/etc/rc.d/ ] || mkdir $pkgdir/etc/rc.d/ -p
55   
56   [  $pkgdir/etc/touchdaemon.conf -f ] ||  cat << EOF  >> $pkgdir/etc/touchdaemon.conf
57 #To dis-/enable your touchpad use a bash command string and replace 
58 #"Logitec Touchpad" with your one. You get the name with the command 
59 #"xinput list".
60 #COMMAND='xinput set-prop "Logitech Touchpad" "Device Enabled"'
61 COMMAND=""
62 #touchdaemon puts a " 0" or " 1"  at the end of your command to alternate 
63 #the touchpad state.
64 EOF
66   cat << EOF >> $pkgdir/etc/rc.d/touchdaemon
67 #!/bin/bash
68 . /etc/touchdaemon.conf
69 . /etc/rc.d/functions
71 if [ "\$COMMAND" = "" ]; then 
72 echo "no command in /etc/touchdaemon.conf"
73 exit 1
76 case "\$1" in
77 start)
78         stat_busy "Starting touchdaemon"
79         /usr/bin/touchdaemon "-c\${COMMAND}" -d
80         if [ $? -gt 0 ]; then
81           stat_fail
82         else
83           add_daemon touchdaemon
84           stat_done
85         fi
86         ;;
87 stop)
88         stat_busy "Stopping touchdaemon"
89         killall touchdaemon
90         rm_daemon touchdaemon
91         stat_done
92         ;;
93 esac
94 exit 0
95 EOF
97 chmod 755 $pkgdir/etc/rc.d/touchdaemon
98