blob: 84463aaf2ce6c393cb87b5bead6d2874d710ee73 [file] [log] [blame]
Alexander Afanasyev469cbcd2014-05-08 01:25:11 -07001#!/bin/sh -e
2
3if [ "$1" != "configure" ]; then
Alexander Afanasyev790bb212015-03-15 19:19:25 -07004 exit 0
Alexander Afanasyev469cbcd2014-05-08 01:25:11 -07005fi
6
Alexander Afanasyev790bb212015-03-15 19:19:25 -07007# Create log folder
8mkdir -p "/var/log/ndn"
Alexander Afanasyeva4ce6202014-08-10 18:17:52 -07009
Alexander Afanasyev790bb212015-03-15 19:19:25 -070010# Create HOME and generate self-signed NDN certificate
11mkdir -p "/var/lib/ndn/nfd/.ndn"
Alexander Afanasyev469cbcd2014-05-08 01:25:11 -070012
Alexander Afanasyev790bb212015-03-15 19:19:25 -070013(
14 export HOME="/var/lib/ndn/nfd"
Alexander Afanasyev3a902892015-12-30 22:42:20 +000015 if [ -z "$(ndnsec-get-default 2>/dev/null)" ]; then
Alexander Afanasyev790bb212015-03-15 19:19:25 -070016 ndnsec-keygen "/localhost/daemons/nfd" | ndnsec-install-cert -
17 fi
Alexander Afanasyev469cbcd2014-05-08 01:25:11 -070018
Alexander Afanasyev790bb212015-03-15 19:19:25 -070019 mkdir -p "/etc/ndn/certs"
20 ndnsec-dump-certificate -i "$(ndnsec-get-default)" > \
21 "/etc/ndn/certs/localhost_daemons_nfd.ndncert"
22)
Alexander Afanasyev60664e22015-02-03 11:55:06 -080023
Alexander Afanasyev790bb212015-03-15 19:19:25 -070024chown -R ndn:ndn "/var/lib/ndn/nfd"
Alexander Afanasyev60664e22015-02-03 11:55:06 -080025
Alexander Afanasyev469cbcd2014-05-08 01:25:11 -070026#DEBHELPER#
27
28exit 0