summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
-rw-r--r--Makefile.am5
-rw-r--r--configure.ac2
-rw-r--r--scripts/neard.in42
3 files changed, 48 insertions, 1 deletions
diff --git a/Makefile.am b/Makefile.am
index a276ed3..9c1537d 100644
--- a/Makefile.am
+++ b/Makefile.am
@@ -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 \
diff --git a/configure.ac b/configure.ac
index 76d77eb..35ec5bd 100644
--- a/configure.ac
+++ b/configure.ac
@@ -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
index 0000000..0a839ad
--- /dev/null
+++ b/scripts/neard.in
@@ -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