Junxiao Shi | d71d84c | 2014-04-18 17:22:50 -0700 | [diff] [blame] | 1 | #!@BASH@ |
| 2 | |
| 3 | hasProcess() { |
| 4 | local processName=$1 |
| 5 | |
| 6 | if pgrep -x $processName >/dev/null |
| 7 | then |
| 8 | echo $processName |
| 9 | fi |
| 10 | } |
| 11 | |
| 12 | hasNFD=$(hasProcess nfd) |
| 13 | hasNRD=$(hasProcess nrd) |
| 14 | |
| 15 | if [[ -n $hasNFD$hasNRD ]] |
| 16 | then |
| 17 | echo 'NFD or NRD is already running...' |
| 18 | exit 1 |
| 19 | fi |
| 20 | |
Junxiao Shi | 262f531 | 2014-05-03 10:45:12 -0700 | [diff] [blame^] | 21 | if ! ndnsec-get-default &>/dev/null |
| 22 | then |
| 23 | ndnsec-keygen /localhost/operator | ndnsec-install-cert - |
| 24 | fi |
| 25 | |
| 26 | if ! sudo true |
| 27 | then |
| 28 | echo 'Unable to obtain superuser privilege' |
| 29 | exit 2 |
| 30 | fi |
| 31 | |
Junxiao Shi | d71d84c | 2014-04-18 17:22:50 -0700 | [diff] [blame] | 32 | sudo nfd & |
| 33 | sleep 2 |
| 34 | nrd & |
| 35 | sleep 2 |