All of lore.kernel.org
 help / color / mirror / Atom feed
* [PATCH 4/4] scripts: Added init.rc script
@ 2010-12-08  8:35 Jessica Nilsson
  2010-12-08 15:22 ` Marcel Holtmann
  0 siblings, 1 reply; 3+ messages in thread
From: Jessica Nilsson @ 2010-12-08  8:35 UTC (permalink / raw)
  To: ofono

[-- Attachment #1: Type: text/plain, Size: 2632 bytes --]

Updates in Makefile.am and the adding of an init file.

Regards,
Jessica Nilsson

---
 Makefile.am    |   10 +++++++
 scripts/ofonod |   79 ++++++++++++++++++++++++++++++++++++++++++++++++++++++++
 2 files changed, 89 insertions(+), 0 deletions(-)
 create mode 100755 scripts/ofonod

diff --git a/Makefile.am b/Makefile.am
index a5c89f2..0e6b761 100644
--- a/Makefile.am
+++ b/Makefile.am
@@ -82,6 +82,10 @@ gatchat_sources = gatchat/gatchat.h gatchat/gatchat.c \
 
 udev_files = plugins/ofono.rules
 
+if ISIMODEM25
+init_files = scripts/ofonod
+endif
+
 if UDEV
 builtin_modules += udev
 builtin_sources += plugins/udev.c
@@ -562,3 +566,9 @@ include/ofono/%.h: include/%.h
 
 clean-local:
 	@$(RM) -rf include/ofono
+
+if ISIMODEM25
+init-scripts:
+	$(AM_V_at)$(MKDIR_P) $(sysconfdir)/rc.d/init.d
+	@install -m 755 $(init_files) $(sysconfdir)/rc.d/init.d/ofonod
+endif
diff --git a/scripts/ofonod b/scripts/ofonod
new file mode 100755
index 0000000..6f568e8
--- /dev/null
+++ b/scripts/ofonod
@@ -0,0 +1,79 @@
+#!/bin/sh
+
+# Init file for ofono daemon
+
+### BEGIN INIT INFO
+# Provides: ofonod
+# Required-Start: $local_fs cops msa
+# Required-Stop:
+# Default-Start:  2 3 4 5
+# Default-Stop: 0 1 6
+# chkconfig: 2345 99 01
+# Short-Description: start and stop ofono
+# Description: ofono
+# Modem middleware for accessing the modem
+# through phonet sockets.
+### END INIT INFO
+
+progname=ofonod
+execname=/usr/sbin/$progname
+lockfile=/var/lock/subsys/$progname
+options=""
+
+# Sanity check
+[ -x $execname ] || exit 5
+
+# Source function library.
+. /etc/init.d/functions
+
+RETVAL=0
+
+start() {
+
+        echo -n "Starting $progname: "
+        /sbin/ifconfig shrm0 up
+        daemon $execname $options
+        RETVAL=$?
+        [ $RETVAL -eq 0 ] && touch $lockfile
+        echo
+        return $RETVAL
+}
+
+stop() {
+        echo -n "Stopping $progname: "
+        killproc $progname
+        RETVAL=$?
+        echo
+        [ $RETVAL -eq 0 ] && rm -f $lockfile
+        return $RETVAL
+}
+
+case "$1" in
+  start)
+        start
+        ;;
+  stop)
+        stop
+        ;;
+  reload)
+  ;;
+  restart|force-reload)
+        stop
+        start
+        ;;
+  status)
+        status $progname
+        RETVAL=$?
+        ;;
+  try-restart)
+        if [ -f $lockfile ]; then
+            stop
+            start
+        fi
+        ;;
+  *)
+        echo $"Usage: $0 {start|stop|restart|try-restart|reload|force-reload|status}"
+        RETVAL=$?
+esac
+
+exit $RETVAL
-- 
1.7.3.2


^ permalink raw reply related	[flat|nested] 3+ messages in thread

end of thread, other threads:[~2010-12-09  8:16 UTC | newest]

Thread overview: 3+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2010-12-08  8:35 [PATCH 4/4] scripts: Added init.rc script Jessica Nilsson
2010-12-08 15:22 ` Marcel Holtmann
2010-12-09  8:16   ` Jessica Nilsson

This is an external index of several public inboxes,
see mirroring instructions on how to clone and mirror
all data and code used by this external index.