ccnping: add daemon capabilities
diff --git a/net/ccnping/Portfile b/net/ccnping/Portfile
index 584cad9..2ea20b9 100644
--- a/net/ccnping/Portfile
+++ b/net/ccnping/Portfile
@@ -37,14 +37,21 @@
destroot {
system "echo /ndn/`hostname` > ${ccnxdir}/ccnpingserver.conf.example"
- xinstall -W ${worksrcpath} ccnping ccnpingserver ${destroot}${prefix}/bin/
+ xinstall -W ${worksrcpath} ccnping ccnpingserver ccnpingserver-wrapper ${destroot}${prefix}/bin/
}
-patchfiles patch-Makefile.diff
+patchfiles patch-Makefile.diff \
+ patch-wrapper.diff
notes "
-ccnpingserver is usually run on a hub. For example, on Arizona hub, ccnpingserver
-is started by running \[ccnpingserver /ndn/arizona.edu\]. Then we can run
-\[ccnping /ndn/arizona.edu\] from other nodes to test connectivity towards name
-prefix /ndn/arizona.edu.
+ccnpingserver needs a local prefix to be configured in ${ccnxdir}/ccnpingserver.conf
+configuration file. This file should contain just one line with local prefix, for example: /ndn/ucla.edu
"
+
+startupitem.executable "${prefix}/bin/ccnpingserver-wrapper"
+
+startupitem.create yes
+startupitem.name ${name}
+
+startupitem.netchange no
+startupitem.logevents no
diff --git a/net/ccnping/files/patch-wrapper.diff b/net/ccnping/files/patch-wrapper.diff
new file mode 100644
index 0000000..5e68729
--- /dev/null
+++ b/net/ccnping/files/patch-wrapper.diff
@@ -0,0 +1,19 @@
+diff --git ccnpingserver-wrapper ccnpingserver-wrapper
+new file mode 100755
+index 0000000..c0993c8
+--- /dev/null
++++ ccnpingserver-wrapper
+@@ -0,0 +1,13 @@
++#!/bin/sh
++
++# This script should be installed in the same place as ccnd, ccndc, ccndsmoketest, ...
++# adjust the path to get consistency.
++D=`dirname "$0"`
++export PATH="$D:$PATH"
++
++if [ ! -f "$D/../etc/ccnx/ccnpingserver.conf" ]; then
++ sleep 100
++else
++ su - ccnx -c "$D/ccnpingserver `cat $D/../etc/ccnx/ccnpingserver.conf | xargs`"
++fi
++