Files
NFD/tools/nfd-start.sh
Davide Pesavento d69070ef50 ci+docs+tools: stop using deprecated ndnsec commands
Change-Id: If77f479b45581a9a70619c329e713524678e35fb
2021-06-04 18:50:52 -04:00

63 lines
1.1 KiB
Bash
Executable File

#!@BASH@
VERSION="@VERSION@"
case "$1" in
-h)
echo Usage
echo $0
echo " Start NFD"
exit 0
;;
-V)
echo $VERSION
exit 0
;;
"") ;; # do nothing
*)
echo "Unrecognized option $1"
exit 1
;;
esac
hasProcess() {
local processName=$1
if pgrep -x $processName >/dev/null
then
echo $processName
fi
}
hasNFD=$(hasProcess nfd)
if [[ -n $hasNFD ]]
then
echo 'NFD is already running...'
exit 1
fi
if ! ndnsec get-default &>/dev/null
then
ndnsec key-gen /localhost/operator | ndnsec cert-install -
fi
if ! sudo true
then
echo 'Unable to obtain superuser privilege'
exit 2
fi
sudo @BINDIR@/nfd &
if [ -f @SYSCONFDIR@/ndn/nfd-init.sh ]; then
sleep 2 # post-start is executed just after nfd process starts, but there is no guarantee
# that all initialization has been finished
. @SYSCONFDIR@/ndn/nfd-init.sh
fi
if [ -f @SYSCONFDIR@/ndn/autoconfig.conf ]; then
sleep 2 # post-start is executed just after nfd process starts, but there is no guarantee
@BINDIR@/ndn-autoconfig -d -c "@SYSCONFDIR@/ndn/autoconfig.conf" &
fi