From 144fddad929f4dc5d9ce730a0fdcea998fa546db Mon Sep 17 00:00:00 2001 From: Sean Whitton Date: Sun, 23 Oct 2016 13:03:34 -0700 Subject: check dir exists before chowning --- debian/keysafe-server.postinst | 2 +- debian/keysafe-server.postrm | 4 +++- 2 files changed, 4 insertions(+), 2 deletions(-) (limited to 'debian') diff --git a/debian/keysafe-server.postinst b/debian/keysafe-server.postinst index 38508cc..7282e29 100755 --- a/debian/keysafe-server.postinst +++ b/debian/keysafe-server.postinst @@ -6,7 +6,7 @@ if ! getent passwd _keysafe >/dev/null; then adduser --system --group --disabled-login --disabled-password \ --home /var/lib/keysafe --force-badname _keysafe chmod 700 /var/lib/keysafe -else +elif [ -d "/var/lib/keysafe" ]; then chown -R _keysafe:_keysafe /var/lib/keysafe fi diff --git a/debian/keysafe-server.postrm b/debian/keysafe-server.postrm index 1ee50af..10ebfea 100755 --- a/debian/keysafe-server.postrm +++ b/debian/keysafe-server.postrm @@ -8,7 +8,9 @@ set -e # delete the _keysafe user and group, after chowning the shard storage # to root so that it does not end up owned by another system user if [ "$1" = "purge" ]; then - chown -R root:root /var/lib/keysafe + if [ -e "/var/lib/keysafe" ]; then + chown -R root:root /var/lib/keysafe + fi userdel _keysafe || true groupdel _keysafe || true fi -- cgit v1.2.3