For the installation error try to remove /var/lib/dpkg/info/nis.postinst to avoid the error condition.
For the installation error try to remove /var/lib/ dpkg/info/ nis.postinst to avoid the error condition.