nfd+ndn-tlv-ping: New upstart scripts for ndnpingserver, nfd-autoreg, and nfd-status-http-server
nfd-autoreg and nfd-status-http-server are separate package to install,
if the function needs to be enabled
diff --git a/ndn-tlv-ping/debian/ndn-tlv-ping.default b/ndn-tlv-ping/debian/ndn-tlv-ping.default
new file mode 100644
index 0000000..20bc941
--- /dev/null
+++ b/ndn-tlv-ping/debian/ndn-tlv-ping.default
@@ -0,0 +1,6 @@
+# defaults for ndn-tlv-ping server
+
+# Prefix should be set to a valid value
+PREFIX="/localhost/ndnpingserver"
+
+FLAGS=""
diff --git a/ndn-tlv-ping/debian/ndn-tlv-ping.postinst b/ndn-tlv-ping/debian/ndn-tlv-ping.postinst
new file mode 100644
index 0000000..b082869
--- /dev/null
+++ b/ndn-tlv-ping/debian/ndn-tlv-ping.postinst
@@ -0,0 +1,19 @@
+#!/bin/sh -e
+
+if [ "$1" != "configure" ]; then
+ exit 0
+fi
+
+APP=ndn-tlv-ping
+
+if [ ! -f /var/lib/ndn/$APP/.ndn/ndnsec-public-info.db ]; then
+ # Create HOME and generate self-signed NDN certificate
+ sudo mkdir -p /var/lib/ndn/$APP/.ndn
+ sudo chown -R ndn:ndn /var/lib/ndn/$APP
+ sudo -u ndn -g ndn HOME=/var/lib/ndn/$APP ndnsec-keygen /localhost/daemons/$APP | \
+ sudo -u ndn -g ndn HOME=/var/lib/ndn/$APP ndnsec-install-cert -
+fi
+
+#DEBHELPER#
+
+exit 0
diff --git a/ndn-tlv-ping/debian/ndn-tlv-ping.upstart b/ndn-tlv-ping/debian/ndn-tlv-ping.upstart
new file mode 100644
index 0000000..4cfb4e4
--- /dev/null
+++ b/ndn-tlv-ping/debian/ndn-tlv-ping.upstart
@@ -0,0 +1,21 @@
+description "NDN TLV ping server"
+author "Alexander Afanasyev <alexander.afanasyev@ucla.edu>"
+
+start on started nrd
+stop on stopping nrd
+
+respawn
+respawn limit unlimited
+
+setuid ndn
+setgid ndn
+
+script
+ FLAGS=""
+ PREFIX="/localhost/ndnpingserver"
+ if [ -f /etc/default/ndn-tlv-ping ]; then
+ . /etc/default/ndn-tlv-ping
+ fi
+ export HOME=/var/lib/ndn/ndn-tlv-ping
+ exec /usr/bin/ndnpingserver "$PREFIX" $FLAGS
+end script