configure: Add scripts/neard to the configure output
authorSamuel Ortiz <sameo@linux.intel.com>
Fri, 22 Mar 2013 11:32:58 +0000 (12:32 +0100)
committerSamuel Ortiz <sameo@linux.intel.com>
Fri, 22 Mar 2013 11:37:46 +0000 (12:37 +0100)
Makefile.am
configure.ac
scripts/neard.in [new file with mode: 0644]

index a276ed3..9c1537d 100644 (file)
@@ -49,6 +49,7 @@ nodist_src_neard_SOURCES = src/builtin.h
 AM_CFLAGS = @GLIB_CFLAGS@ @DBUS_CFLAGS@ @NETLINK_CFLAGS@ $(builtin_cflags) \
                                        -DNEAR_PLUGIN_BUILTIN \
                                        -DPLUGINDIR=\""$(plugindir)"\" \
+                                       -DSCRIPTDIR=\""$(build_scriptdir)"\" \
                                        -DCONFIGDIR=\""$(configdir)\""
 
 AM_CPPFLAGS = -I$(builddir)/include -I$(builddir)/src -I$(srcdir)/gdbus
@@ -57,6 +58,8 @@ CLEANFILES = src/builtin.h $(local_headers)
 
 plugindir = $(libdir)/near/plugins
 
+scriptdir = $(libdir)/connman/scripts
+
 configdir = ${sysconfdir}/neard
 
 dist_noinst_DATA = src/main.conf
@@ -67,8 +70,10 @@ dist_dbus_DATA = src/org.neard.conf
 
 if MAINTAINER_MODE
 build_plugindir = $(abs_top_srcdir)/plugins/.libs
+build_scriptdir = $(abs_top_srcdir)/scripts
 else
 build_plugindir = $(plugindir)
+build_scriptdir = $(scriptdir)
 endif
 
 doc_files = doc/manager-api.txt doc/tag-api.txt doc/device-api.txt \
index 76d77eb..35ec5bd 100644 (file)
@@ -123,4 +123,4 @@ AC_ARG_ENABLE(p2p, AC_HELP_STRING([--disable-p2p],
                                [enable_p2p=${enableval}])
 AM_CONDITIONAL(P2P, test "${enable_p2p}" != "no")
 
-AC_OUTPUT(Makefile include/version.h neard.pc)
+AC_OUTPUT(Makefile include/version.h neard.pc scripts/neard)
diff --git a/scripts/neard.in b/scripts/neard.in
new file mode 100644 (file)
index 0000000..0a839ad
--- /dev/null
@@ -0,0 +1,42 @@
+#!/bin/sh
+
+DAEMON=@libexecdir@/nfc/neard
+DESC="NFC daemon"
+
+. /lib/lsb/init-functions
+
+set -e
+
+do_start() {
+       start-stop-daemon --start --oknodo --exec $DAEMON -- $DAEMON_OPTS
+}
+
+do_stop() {
+       start-stop-daemon --stop --oknodo --quiet --exec $DAEMON
+}
+
+case "$1" in
+  start)
+       log_daemon_msg "Starting $DESC"
+       do_start
+       log_end_msg $?
+       ;;
+  stop)
+       log_daemon_msg "Stopping $DESC"
+       do_stop
+       log_end_msg $?
+       ;;
+  restart|force-reload)
+       log_daemon_msg "Restarting $DESC"
+       do_stop
+       sleep 1
+       do_start
+       log_end_msg $?
+       ;;
+  *)
+       log_success_msg "Usage: $0 {start|stop|restart|force-reload}" >&2
+       exit 1
+       ;;
+esac
+
+exit 0