fixing bugs in monkeysphere-server diagnostics.
[monkeysphere.git] / packaging / freebsd / pkg-deinstall
index 03db8e8a6d3c418fdcd10bf95a8ce779b64034b3..30008784182a835c800541d5e7f9a33617c750d1 100755 (executable)
@@ -13,12 +13,17 @@ VARLIB="/var/monkeysphere"
 
 case $2 in
 POST-DEINSTALL)
-# FIXME: This needs to be filled in!  Under what circumstances do we
-# want to actually purge all of /var/monkeysphere?
+        USER=monkeysphere
+# FIXME: This doesn't do anything!  Under what circumstances do we
+# want to actually automatically purge all of /var/monkeysphere?
 
 # (note: FreeBSD does not seem to want the package-specific user to be
 # purged at package removal)
-       echo "Warning: If you will *NOT* use this package anymore, please remove the monkeysphere user manually."
-       echo "         You may also want to remove the cached authentication data and keyrings in $VARLIB"
+       if pw user show "${USER}" 2>/dev/null >/dev/null; then
+           echo "Warning: If you will *NOT* use this package anymore, please remove the monkeysphere user manually."
+       fi
+       if [ -d "$VARLIB" ] ; then
+           echo "Warning: You may want to remove monkeysphere's cached authentication data and keyrings in $VARLIB"
+       fi
 ;;
 esac