freebsd-ports/sysutils/bacula-server/pkg-deinstall.server
Wesley Shields a0ca3434a2 - Update to 3.0.2 [1]
- Fix whitespace in pkg-deinstall [2]
- Use %%PREFIX%% in pkg-message [2]
- Document that make_sqlite_tables needs to be run as bacula user [2]

PR:		[1]: ports/137160
		[2]: ports/133818
Submitted by:	[1]: Dan Langille <dan@langille.org> (maintainer)
		[2]: Kostas Voulgaris <voulgaris@ceid.upatras.gr>
Approved by:	[2]: maintainer via IRC
2009-08-14 20:00:36 +00:00

32 lines
830 B
Bash

#!/bin/sh
PATH=/bin:/usr/bin:/usr/sbin
TMPFILE=/tmp/services-$RANDOM-$$
if [ -z "${BACULA_DIR}" ]; then
BACULA_DIR=/var/db/bacula
fi
case "$2" in
"DEINSTALL")
# Delete entries in /etc/services
sed -e '/# Bacula port start/,/# Bacule port end/{' \
-e 'd' \
-e '}' /etc/services > $TMPFILE
mv -f $TMPFILE /etc/services
if [ -d ${BACULA_DIR} ]; then
rmdir ${BACULA_DIR};
fi
if [ -d ${BACULA_DIR} ]; then
echo "Check if ${BACULA_DIR} is empty and delete it to permanently remove the bacula port"
fi
# Note how to delete UID/GID
USER=bacula
GROUP=${USER}
if pw usershow "${USER}" 2>/dev/null 1>&2; then
echo "To delete Bacula user permanently, use 'pw userdel ${USER}'"
echo "To delete Bacula group permanently, use 'pw groupdel ${GROUP}'"
fi
;;
esac