Initial maemo support.
[connman] / debian / connman.init
diff --git a/debian/connman.init b/debian/connman.init
new file mode 100644 (file)
index 0000000..b7de060
--- /dev/null
@@ -0,0 +1,62 @@
+#!/bin/sh
+
+DAEMON=/usr/sbin/connmand
+PIDFILE=/var/run/connmand.pid
+DESC="Connection Manager"
+NAME=connman
+
+. /lib/lsb/init-functions
+
+if [ -f /etc/default/connman ] ; then
+       . /etc/default/connman
+fi
+
+set -e
+
+unset USE_UPSTART
+INITCTL=/sbin/initctl
+test -x /sbin/initctl && USE_UPSTART=1
+
+do_start() {
+       if [ -z "$USE_UPSTART" ]; then
+           start-stop-daemon --start --oknodo \
+               --pidfile $PIDFILE --exec $DAEMON -- $DAEMON_OPTS
+       else
+           $INITCTL start $NAME
+       fi
+}
+
+do_stop() {
+       if [ -z "$USE_UPSTART" ]; then
+           start-stop-daemon --stop --oknodo --quiet \
+               --pidfile $PIDFILE --exec $DAEMON
+       else
+           $INITCTL stop $NAME
+       fi
+}
+
+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