nfd: Ensure that /var/lib/ndn folder is owned by ndn user

Refs: #2471
diff --git a/nfd/Makefile b/nfd/Makefile
index 185ff44..1844a8e 100644
--- a/nfd/Makefile
+++ b/nfd/Makefile
@@ -11,6 +11,6 @@
 VERSION=0.3.0
 
 # PPA version
-PPA_VERSION=1
+PPA_VERSION=2
 
 include ../packaging.mk
diff --git a/nfd/debian/changelog b/nfd/debian/changelog
index 63c92e4..07573dc 100644
--- a/nfd/debian/changelog
+++ b/nfd/debian/changelog
@@ -1,3 +1,10 @@
+nfd (0.3.0-ppa2~DISTRO) DISTRO; urgency=low
+
+  * New version based on NFD-0.3.0 (https://github.com/named-
+    data/NFD.git)
+
+ -- Alexander Afanasyev <alexander.afanasyev@ucla.edu>  Tue, 03 Feb 2015 11:49:32 -0800
+
 nfd (0.3.0-ppa1~DISTRO) DISTRO; urgency=low
 
   * New version based on NFD-0.3.0 (https://github.com/named-
diff --git a/nfd/debian/nfd.postinst b/nfd/debian/nfd.postinst
index 8c4c667..e4c4ff8 100644
--- a/nfd/debian/nfd.postinst
+++ b/nfd/debian/nfd.postinst
@@ -13,22 +13,26 @@
 if [ ! -f /etc/ndn/certs/localhost_daemons_nrd.ndncert ]; then
     # Create HOME and generate self-signed NDN certificate for nfd
     mkdir -p /var/lib/ndn/nfd/.ndn
-    HOME=/var/lib/ndn/nfd ndnsec-keygen /localhost/daemons/nfd | \
-      HOME=/var/lib/ndn/nfd ndnsec-install-cert -
+    (
+        export HOME=/var/lib/ndn/nfd
+        ndnsec-keygen /localhost/daemons/nfd | ndnsec-install-cert -
+    )
 
     # Create HOME and generate self-signed NDN certificate for nrd
-    sudo mkdir -p /var/lib/ndn/nrd/.ndn
-    sudo chown -R ndn:ndn /var/lib/ndn/nrd
-    sudo -u ndn -g ndn HOME=/var/lib/ndn/nrd ndnsec-keygen /localhost/daemons/nrd | \
-      sudo -u ndn -g ndn HOME=/var/lib/ndn/nrd ndnsec-install-cert -
-
     # Dump RIB Management daemon's certificate
-    sudo mkdir /etc/ndn/certs
-    sudo sh -c 'sudo -u ndn -g ndn HOME=/var/lib/ndn/nrd \
-      ndnsec-dump-certificate -i /localhost/daemons/nrd \
-      > /etc/ndn/certs/localhost_daemons_nrd.ndncert'
+    mkdir -p /var/lib/ndn/nrd/.ndn
+    (
+         export HOME=/var/lib/ndn/nrd
+         ndnsec-keygen /localhost/daemons/nrd | ndnsec-install-cert -
+
+         mkdir /etc/ndn/certs
+         ndnsec-dump-certificate -i /localhost/daemons/nrd > \
+           /etc/ndn/certs/localhost_daemons_nrd.ndncert
+    )
 fi
 
+chown -R ndn:ndn /var/lib/ndn
+
 #DEBHELPER#
 
 exit 0