openbsc: Add config file and init script for SGSN
diff --git a/recipes-osmocom/openbsc/openbsc.inc b/recipes-osmocom/openbsc/openbsc.inc
index a372005..6d6366e 100644
--- a/recipes-osmocom/openbsc/openbsc.inc
+++ b/recipes-osmocom/openbsc/openbsc.inc
@@ -8,8 +8,9 @@
 
 SRC_URI = "file://osmo-nitb.init \
 	   file://osmo-bsc_mgcp.init \
-	   file://osmo-bsc.init"
-INC_PR = "r13.${META_TELEPHONY_OSMO_INC}"
+	   file://osmo-bsc.init \
+	   file://osmo-sgsn.init"
+INC_PR = "r14.${META_TELEPHONY_OSMO_INC}"
 
 
 EXTRA_OECONF += " --enable-nat --enable-osmo-bsc "
@@ -28,9 +29,11 @@
 	install -m 0660 ${S}/doc/examples/osmo-nitb/nanobts/openbsc.cfg ${D}${sysconfdir}/osmocom/osmo-nitb.cfg
 	install -m 0660 ${S}/doc/examples/osmo-bsc/osmo-bsc.cfg ${D}${sysconfdir}/osmocom/osmo-bsc.cfg
 	install -m 0660 ${S}/doc/examples/osmo-bsc_mgcp/mgcp.cfg ${D}${sysconfdir}/osmocom/osmo-bsc-mgcp.cfg
+	install -m 0660 ${S}/doc/examples/osmo-sgsn/osmo-sgsn.cfg ${D}${sysconfdir}/osmocom/osmo-sgsn.cfg
 	install -m 0775 ${WORKDIR}/osmo-nitb.init ${D}${sysconfdir}/init.d/osmo-nitb
 	install -m 0775 ${WORKDIR}/osmo-bsc_mgcp.init ${D}${sysconfdir}/init.d/osmo-bsc-mgcp
 	install -m 0775 ${WORKDIR}/osmo-bsc.init ${D}${sysconfdir}/init.d/osmo-bsc
+	install -m 0775 ${WORKDIR}/osmo-sgsn.init ${D}${sysconfdir}/init.d/osmo-sgsn
 
 	install -d ${D}/var/lib/osmocom
 }
@@ -61,7 +64,13 @@
 		${sysconfdir}/init.d/osmo-nitb \
 		${sysconfdir}/osmocom/osmo-nitb.cfg"
 
-FILES_osmo-sgsn = " ${bindir}/osmo-sgsn "
+CONFFILES_osmo-sgsn = "${sysconfdir}/osmocom/osmo-sgsn.cfg"
+INITSCRIPT_NAME_osmo-sgsn = "osmo-sgsn"
+INITSCRIPT_PARAMS_osmo-sgsn = "defaults 30 30"
+FILES_osmo-sgsn = " ${bindir}/osmo-sgsn \
+		${sysconfdir}/init.d/osmo-sgsn \
+		${sysconfdir}/osmocom/osmo-sgsn.cfg"
+
 FILES_ipaccess-utils = " ${bindir}/ipaccess-find ${bindir}/ipaccess-config ${bindir}/ipaccess-proxy "
 FILES_osmo-bsc-nat = " ${bindir}/osmo-bsc_nat "
 FILES_osmo-gbproxy = " ${bindir}/osmo-gbproxy "
diff --git a/recipes-osmocom/openbsc/openbsc/osmo-sgsn.init b/recipes-osmocom/openbsc/openbsc/osmo-sgsn.init
new file mode 100755
index 0000000..4481135
--- /dev/null
+++ b/recipes-osmocom/openbsc/openbsc/osmo-sgsn.init
@@ -0,0 +1,48 @@
+#!/bin/sh
+### BEGIN INIT INFO
+# Provides:		osmo-sgsn
+# Required-Start:	$syslog $networking
+# Required-Stop:	$syslog
+# Default-Start:	5
+# Default-Stop:		1
+# Short-Description:	Osmocom Serving GPRS Support Node
+### END INIT INFO
+
+DAEMON=/usr/bin/osmo-sgsn
+NAME=osmo-sgsn
+DESC="Osmocom Serving GPRS Support Node"
+NORMAL_ARGS="-D -c /etc/osmocom/osmo-sgsn.cfg"
+
+OSMOSGSN_EXTRA_ARGS=""
+NO_START=0
+
+set -e
+
+test ! -r /etc/default/osmo-sgsn || . /etc/default/osmo-sgsn
+test "$NO_START" = "0" || exit 0
+test -x "$DAEMON" || exit 0
+
+case "$1" in
+  start)
+	echo -n "Starting $DESC: "
+	start-stop-daemon -S \
+	  -x "$DAEMON" -- $NORMAL_ARGS $OSMOSGSN_EXTRA_ARGS
+	echo "$NAME."
+	;;
+  stop)
+	echo -n "Stopping $DESC: "
+	start-stop-daemon -K -x "$DAEMON"
+	echo "$NAME."
+	;;
+  restart|force-reload)
+	$0 stop
+	$0 start
+	;;
+  *)
+	N=/etc/init.d/$NAME
+	echo "Usage: $N {start|stop|restart}" >&2
+	exit 1
+	;;
+esac
+
+exit 0