Alexander Afanasyev | 469cbcd | 2014-05-08 01:25:11 -0700 | [diff] [blame] | 1 | #!/bin/sh -e |
| 2 | |
| 3 | if [ "$1" != "configure" ]; then |
Alexander Afanasyev | 790bb21 | 2015-03-15 19:19:25 -0700 | [diff] [blame] | 4 | exit 0 |
Alexander Afanasyev | 469cbcd | 2014-05-08 01:25:11 -0700 | [diff] [blame] | 5 | fi |
| 6 | |
Alexander Afanasyev | 790bb21 | 2015-03-15 19:19:25 -0700 | [diff] [blame] | 7 | # Create log folder |
| 8 | mkdir -p "/var/log/ndn" |
Alexander Afanasyev | a4ce620 | 2014-08-10 18:17:52 -0700 | [diff] [blame] | 9 | |
Alexander Afanasyev | 790bb21 | 2015-03-15 19:19:25 -0700 | [diff] [blame] | 10 | # Create HOME and generate self-signed NDN certificate |
| 11 | mkdir -p "/var/lib/ndn/nfd/.ndn" |
Alexander Afanasyev | 469cbcd | 2014-05-08 01:25:11 -0700 | [diff] [blame] | 12 | |
Alexander Afanasyev | 790bb21 | 2015-03-15 19:19:25 -0700 | [diff] [blame] | 13 | ( |
| 14 | export HOME="/var/lib/ndn/nfd" |
Alexander Afanasyev | 3a90289 | 2015-12-30 22:42:20 +0000 | [diff] [blame] | 15 | if [ -z "$(ndnsec-get-default 2>/dev/null)" ]; then |
Alexander Afanasyev | 790bb21 | 2015-03-15 19:19:25 -0700 | [diff] [blame] | 16 | ndnsec-keygen "/localhost/daemons/nfd" | ndnsec-install-cert - |
| 17 | fi |
Alexander Afanasyev | 469cbcd | 2014-05-08 01:25:11 -0700 | [diff] [blame] | 18 | |
Alexander Afanasyev | 790bb21 | 2015-03-15 19:19:25 -0700 | [diff] [blame] | 19 | mkdir -p "/etc/ndn/certs" |
| 20 | ndnsec-dump-certificate -i "$(ndnsec-get-default)" > \ |
| 21 | "/etc/ndn/certs/localhost_daemons_nfd.ndncert" |
| 22 | ) |
Alexander Afanasyev | 60664e2 | 2015-02-03 11:55:06 -0800 | [diff] [blame] | 23 | |
Alexander Afanasyev | 790bb21 | 2015-03-15 19:19:25 -0700 | [diff] [blame] | 24 | chown -R ndn:ndn "/var/lib/ndn/nfd" |
Alexander Afanasyev | 60664e2 | 2015-02-03 11:55:06 -0800 | [diff] [blame] | 25 | |
Junxiao Shi | d9bd015 | 2018-04-20 16:49:30 +0000 | [diff] [blame] | 26 | # Enable Ethernet face creation |
| 27 | setcap cap_net_raw,cap_net_admin=eip /usr/bin/nfd |
| 28 | |
Alexander Afanasyev | 469cbcd | 2014-05-08 01:25:11 -0700 | [diff] [blame] | 29 | #DEBHELPER# |
| 30 | |
| 31 | exit 0 |