nlsr: Add systemd startup scripts

refs #2810

Change-Id: I8aa587094c353419655b0ed629d2c1172a5bfb80
diff --git a/nlsr/debian/control b/nlsr/debian/control
index 6e120fb..ae20759 100644
--- a/nlsr/debian/control
+++ b/nlsr/debian/control
@@ -1,7 +1,8 @@
 Source: nlsr
 Priority: extra
-Maintainer: A K M Mahmudul Hoque <ahoque1@memphis.edu>
+Maintainer: Vince Lehman <vslehman@memphis.edu>
 Build-Depends: debhelper (>= 8.0.0),
+ dh-systemd (>= 1.5),
  python (>= 2.7.0),
  pkg-config (>= 0.26),
  ndn-cxx-dev (>= 0.3.0~rc0.2),
diff --git a/nlsr/debian/control.precise b/nlsr/debian/control.precise
index b2a86b2..5287cbd 100644
--- a/nlsr/debian/control.precise
+++ b/nlsr/debian/control.precise
@@ -1,6 +1,6 @@
 Source: nlsr
 Priority: extra
-Maintainer: A K M Mahmudul Hoque <ahoque1@memphis.edu>
+Maintainer: Vince Lehman <vslehman@memphis.edu>
 Build-Depends: debhelper (>= 8.0.0),
  python (>= 2.7.0),
  pkg-config (>= 0.26),
@@ -20,4 +20,4 @@
 Package: nlsr
 Architecture: i386 amd64
 Depends: ${shlibs:Depends}, ${misc:Depends} , ndn-cxx
-Description: A link state routing protocol for Named Data Networking 
+Description: A link state routing protocol for Named Data Networking
diff --git a/nlsr/debian/nlsr.service b/nlsr/debian/nlsr.service
new file mode 100644
index 0000000..db61b81
--- /dev/null
+++ b/nlsr/debian/nlsr.service
@@ -0,0 +1,39 @@
+# Copyright (c) 2014-2015,  The University of Memphis,
+#                           Regents of the University of California,
+#                           Arizona Board of Regents.
+#
+# This file is part of NLSR (Named-data Link State Routing).
+# See AUTHORS.md for complete list of NLSR authors and contributors.
+#
+# NLSR is free software: you can redistribute it and/or modify it under the terms
+# of the GNU General Public License as published by the Free Software Foundation,
+# either version 3 of the License, or (at your option) any later version.
+#
+# NLSR is distributed in the hope that it will be useful, but WITHOUT ANY WARRANTY;
+# without even the implied warranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR
+# PURPOSE.  See the GNU General Public License for more details.
+#
+# You should have received a copy of the GNU General Public License along with
+# NLSR, e.g., in COPYING.md file.  If not, see <http://www.gnu.org/licenses/>.
+#
+# Author: Eric Newberry <enewberry@email.arizona.edu>
+
+[Unit]
+Description=NDN NLSR Routing Daemon
+Documentation=man:nlsr
+Requires=nfd.service
+After=nfd.service
+
+[Service]
+Environment=HOME=/var/lib/ndn/nlsr
+User=nlsr
+Group=nlsr
+ExecStart=/usr/bin/nlsr -f /etc/ndn/nlsr/nlsr.conf
+Restart=on-failure
+ProtectSystem=full
+PrivateTmp=yes
+PrivateDevices=yes
+ProtectHome=yes
+
+[Install]
+WantedBy=multi-user.target
\ No newline at end of file
diff --git a/nlsr/debian/rules b/nlsr/debian/rules
index 23a8078..9cb89e5 100755
--- a/nlsr/debian/rules
+++ b/nlsr/debian/rules
@@ -14,7 +14,7 @@
 CXXFLAGS += -std=c++11
 
 %:
-	dh $@ --parallel
+	dh $@ --parallel --with=systemd
 
 override_dh_auto_configure:
 	CXXFLAGS="$(CXXFLAGS)" LINKFLAGS="$(LDFLAGS)" ./waf configure --prefix=/usr
@@ -38,3 +38,9 @@
 	rm -f docs/*.pyc
 
 override_dh_auto_test:
+
+override_dh_systemd_enable:
+	dh_systemd_enable --no-enable
+
+override_dh_systemd_start:
+	dh_systemd_start --no-start