freebsd-ports/irc/dancer-services/pkg-deinstall
Akinori MUSHA e5925cd22e Add patches to prevent multibyte encoded strings to be garbaged.
(already submitted to the author)

Add user & group in package building too.

Submitted by:	bento

Remove user & group on deinstallation (only on bento).
2003-04-24 20:19:31 +00:00

56 lines
925 B
Bash

#!/bin/sh
#
# $FreeBSD$
#
ask() {
local question default answer
question=$1
default=$2
if [ -z "$BATCH" ]; then
read -p "${question} [${default}]? " answer
fi
if [ x${answer} = x ]; then
answer=${default}
fi
echo ${answer}
}
yesno() {
local dflt question answer
question=$1
dflt=$2
while :; do
answer=$(ask "${question}" "${dflt}")
case "${answer}" in
[Yy]*) return 0;;
[Nn]*) return 1;;
esac
echo "Please answer yes or no."
done
}
delete_account() {
local u g
u=$1
g=$2
if yesno "Do you want me to remove group \"${g}\"" y; then
pw groupdel -n ${g}
echo "Done."
fi
if yesno "Do you want me to remove user \"${u}\"" y; then
pw userdel -n ${u}
echo "Done."
fi
}
if [ "$2" != "POST-DEINSTALL" ]; then
exit 0
fi
if [ -n "$PACKAGE_BUILDING" ]; then
delete_account ircservices ircservices
fi