Add Debian packaging infrastructure 1.1
authorThomas Perl <thp@thpinfo.com>
Thu, 22 Oct 2009 15:03:00 +0000 (17:03 +0200)
committerThomas Perl <thp@thpinfo.com>
Fri, 23 Oct 2009 19:19:07 +0000 (21:19 +0200)
debian/changelog [new file with mode: 0644]
debian/compat [new file with mode: 0644]
debian/control [new file with mode: 0644]
debian/copyright [new file with mode: 0644]
debian/dirs [new file with mode: 0644]
debian/headphoned.1 [new file with mode: 0644]
debian/headphoned.zheadphoned.init [new file with mode: 0644]
debian/rules [new file with mode: 0755]
makefile

diff --git a/debian/changelog b/debian/changelog
new file mode 100644 (file)
index 0000000..60dfb2d
--- /dev/null
@@ -0,0 +1,11 @@
+headphoned (1.1) diablo; urgency=low
+
+  * Fix problems with system startup.
+
+ -- Thomas Perl <thp@thpinfo.com>  Thu, 22 Oct 2009 16:53:08 +0200
+
+headphoned (1.0) diablo; urgency=low
+
+  * Initial Release.
+
+ -- Thomas Perl <thp@thpinfo.com>  Thu, 22 Oct 2009 15:15:09 +0200
diff --git a/debian/compat b/debian/compat
new file mode 100644 (file)
index 0000000..7ed6ff8
--- /dev/null
@@ -0,0 +1 @@
+5
diff --git a/debian/control b/debian/control
new file mode 100644 (file)
index 0000000..18fbb2c
--- /dev/null
@@ -0,0 +1,17 @@
+Source: headphoned
+Section: user/multimedia
+Priority: extra
+Maintainer: Thomas Perl <thp@thpinfo.com>
+Build-Depends: debhelper (>= 5), libosso-dev, libgconf2-dev, libglib2.0-dev
+Standards-Version: 3.7.2
+
+Package: headphoned
+Architecture: armel
+Depends: ${shlibs:Depends}
+XB-Maemo-Display-Name: Headphone daemon
+Description: Pauses the media player when headpones are unplugged
+ The headphone daemon sits in the background and watches the
+ connection state of headphones on the N800/N810. Whenever the
+ headphones are unplugged, headphoned will send a "pause" signal
+ to the mediaplayer to avoid "public transport situations".
+
diff --git a/debian/copyright b/debian/copyright
new file mode 100644 (file)
index 0000000..f43c54d
--- /dev/null
@@ -0,0 +1,23 @@
+This is headphoned, written and maintained by Thomas Perl <thp@thpinfo.com>
+on Thu, 22 Oct 2009 15:15:09 +0200.
+
+Copyright Holder:  Thomas Perl <thp@thpinfo.com>
+
+License:
+
+  This program is free software; you can redistribute it and/or modify
+  it under the terms of the GNU General Public License as published by
+  the Free Software Foundation; either version 2 of the License, or
+  (at your option) any later version.
+
+  This program is distributed in the hope that it will be useful,
+  but WITHOUT ANY WARRANTY; without even the implied warranty of
+  MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
+  GNU General Public License for more details.
+
+  You should have received a copy of the GNU General Public License
+  along with this package; if not, write to the Free Software
+  Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA  02110-1301 USA
+
+On Debian systems, the complete text of the GNU General
+Public License can be found in `/usr/share/common-licenses/GPL'.
diff --git a/debian/dirs b/debian/dirs
new file mode 100644 (file)
index 0000000..236670a
--- /dev/null
@@ -0,0 +1 @@
+usr/sbin
diff --git a/debian/headphoned.1 b/debian/headphoned.1
new file mode 100644 (file)
index 0000000..967094f
--- /dev/null
@@ -0,0 +1,38 @@
+.\"                                      Hey, EMACS: -*- nroff -*-
+.\" First parameter, NAME, should be all caps
+.\" Second parameter, SECTION, should be 1-8, maybe w/ subsection
+.\" other parameters are allowed: see man(7), man(1)
+.TH HEADPHONED 1 "October 22, 2009" "" "The headphone daemon"
+.\" Please adjust this date whenever revising the manpage.
+.\"
+.\" Some roff macros, for reference:
+.\" .nh        disable hyphenation
+.\" .hy        enable hyphenation
+.\" .ad l      left justify
+.\" .ad b      justify to both left and right margins
+.\" .nf        disable filling
+.\" .fi        enable filling
+.\" .br        insert line break
+.\" .sp <n>    insert n+1 empty lines
+.\" for manpage-specific macros, see man(7)
+.SH NAME
+headphoned \- Pauses media player when unplugging headphones
+.SH SYNOPSIS
+.B /etc/init.d/headphoned [start|restart|stop]
+.RI
+.SH DESCRIPTION
+headphoned watches the connection status of the N800/N810 headphone jack
+and sends a "pause" signal to the media player when the headphones
+are unplugged. This is helpful for "public transport situations"
+where you accidentally unplug your headphones in a bus/tram/metro.
+.P
+headphoned is usually started via the init scripts, so normally there is
+no need to manually start it.
+.SH FILES
+.TP
+.B /sys/devices/platform/gpio-switch/headphone/state
+Tells the status of the headphone jack
+.SH SEE ALSO
+http://talk.maemo.org/showthread.php?t=33215
+.SH AUTHOR
+headphoned was written by Thomas Perl <thpinfo.com>
diff --git a/debian/headphoned.zheadphoned.init b/debian/headphoned.zheadphoned.init
new file mode 100644 (file)
index 0000000..846ce61
--- /dev/null
@@ -0,0 +1,89 @@
+#! /bin/sh
+#
+# skeleton     example file to build /etc/init.d/ scripts.
+#              This file should be used to construct scripts for /etc/init.d.
+#
+#              Written by Miquel van Smoorenburg <miquels@cistron.nl>.
+#              Modified for Debian 
+#              by Ian Murdock <imurdock@gnu.ai.mit.edu>.
+#
+# Version:     @(#)skeleton  1.9  26-Feb-2001  miquels@cistron.nl
+#
+
+PATH=/usr/local/sbin:/usr/local/bin:/sbin:/bin:/usr/sbin:/usr/bin
+DAEMON=/usr/sbin/headphoned
+NAME=headphoned
+USER=user
+DESC="Headphone daemon"
+
+# XXX: The following is needed for the D-Bus connection to work
+export DBUS_SESSION_BUS_ADDRESS='unix:path=/tmp/session_bus_socket'
+# XXX end
+
+test -x $DAEMON || exit 0
+
+set -e
+
+case "$1" in
+  start)
+       echo -n "Starting $DESC: "
+       start-stop-daemon --start --quiet --pidfile /var/run/$NAME.pid \
+               -b --user $USER --chuid $USER --exec $DAEMON -- $DAEMON_OPTS
+       echo "$NAME."
+       ;;
+  stop)
+       echo -n "Stopping $DESC: "
+       _PIDS=`pidof $DAEMON || echo ""`
+       if [ "$_PIDS" != "" ]; then
+               kill $_PIDS
+       fi
+       #start-stop-daemon --stop --quiet --pidfile /var/run/$NAME.pid \
+       #       --user $USER --chuid $USER --exec $DAEMON
+       echo "$NAME."
+       ;;
+  reload)
+       #
+       #       If the daemon can reload its config files on the fly
+       #       for example by sending it SIGHUP, do it here.
+       #
+       #       If the daemon responds to changes in its config file
+       #       directly anyway, make this a do-nothing entry.
+       #
+       # echo "Reloading $DESC configuration files."
+       # start-stop-daemon --stop --signal 1 --quiet --pidfile \
+       #       /var/run/$NAME.pid --exec $DAEMON
+       ;;
+  force-reload)
+       #
+       #       If the "reload" option is implemented, move the "force-reload"
+       #       option to the "reload" entry above. If not, "force-reload" is
+       #       just the same as "restart" except that it does nothing if the
+       #   daemon isn't already running.
+       # check wether $DAEMON is running. If so, restart
+       #start-stop-daemon --stop --test --quiet --pidfile \
+       #       --user $USER --chuid $USER /var/run/$NAME.pid --exec $DAEMON \
+       #&& $0 restart \
+       #|| exit 0
+       ;;
+  restart)
+    echo -n "Restarting $DESC: "
+       _PIDS=`pidof $DAEMON || echo ""`
+       if [ "$_PIDS" != "" ]; then
+               kill $_PIDS
+       fi
+       #start-stop-daemon --stop --quiet --pidfile \
+       #       --user $USER --chuid $USER /var/run/$NAME.pid --exec $DAEMON
+       sleep 1
+       start-stop-daemon --start --quiet --pidfile -b --user $USER \
+               --chuid $USER /var/run/$NAME.pid --exec $DAEMON -- $DAEMON_OPTS
+       echo "$NAME."
+       ;;
+  *)
+       N=/etc/init.d/$NAME
+       # echo "Usage: $N {start|stop|restart|reload|force-reload}" >&2
+       echo "Usage: $N {start|stop|restart|force-reload}" >&2
+       exit 1
+       ;;
+esac
+
+exit 0
diff --git a/debian/rules b/debian/rules
new file mode 100755 (executable)
index 0000000..0aa4a44
--- /dev/null
@@ -0,0 +1,75 @@
+#!/usr/bin/make -f
+# -*- makefile -*-
+# Sample debian/rules that uses debhelper.
+# This file was originally written by Joey Hess and Craig Small.
+# As a special exception, when this file is copied by dh-make into a
+# dh-make output file, you may use that output file without restriction.
+# This special exception was added by Craig Small in version 0.37 of dh-make.
+
+# Uncomment this to turn on verbose mode.
+#export DH_VERBOSE=1
+
+
+
+
+CFLAGS = -Wall -g
+
+ifneq (,$(findstring noopt,$(DEB_BUILD_OPTIONS)))
+       CFLAGS += -O0
+else
+       CFLAGS += -O2
+endif
+
+configure: configure-stamp
+configure-stamp:
+       dh_testdir
+       touch configure-stamp
+
+
+build: build-stamp
+
+build-stamp: configure-stamp 
+       dh_testdir
+       $(MAKE)
+       touch $@
+
+clean:
+       dh_testdir
+       dh_testroot
+       rm -f build-stamp configure-stamp
+       -$(MAKE) clean
+       dh_clean 
+
+install: build
+       dh_testdir
+       dh_testroot
+       dh_clean -k 
+       dh_installdirs
+       $(MAKE) DESTDIR=$(CURDIR)/debian/headphoned install
+
+
+# Build architecture-independent files here.
+binary-indep: build install
+
+# Build architecture-dependent files here.
+binary-arch: build install
+       dh_testdir
+       dh_testroot
+       dh_installchangelogs 
+       dh_installdocs
+       dh_install
+       dh_installinit --name=zheadphoned --update-rcd-params='defaults 99'
+       dh_installman
+       dh_link
+       dh_strip
+       dh_compress
+       dh_fixperms
+       dh_installdeb
+       dh_shlibdeps
+       dh_gencontrol
+       dh_md5sums
+       dh_builddeb
+
+binary: binary-indep binary-arch
+.PHONY: build clean binary-indep binary-arch binary install configure
+
index 2c5105e..b649bd5 100644 (file)
--- a/makefile
+++ b/makefile
@@ -3,10 +3,18 @@ PROG = headphoned
 CFLAGS += `pkg-config --cflags glib-2.0 gconf-2.0 libosso` -Os -Wall
 LDFLAGS += `pkg-config --libs glib-2.0 gconf-2.0 libosso`
 
+DESTDIR ?= 
+PREFIX ?= /usr
+
 $(PROG): $(OBJS)
        $(CC) $(LDFLAGS) $(LIBS) $^ -o $@
        strip $@
 
+install: $(PROG)
+       install $(PROG) $(DESTDIR)$(PREFIX)/sbin/$(PROG)
+
 clean:
        rm -f $(PROG) $(OBJS)
 
+.PHONY: install clean
+