1
0
mirror of https://git.FreeBSD.org/ports.git synced 2024-11-13 23:36:08 +00:00
freebsd-ports/news/ifmail/pkg-deinstall
Bill Fenner 40f68154c5 Try to use uid 70 for the ifmail user when installing; pick an
available uid < 100 if 70 isn't available.
Delete the user when deinstalling.
1997-11-20 05:16:53 +00:00

46 lines
751 B
Bash

#!/bin/sh
user=ifmail
ask() {
local question default answer
question=$1
default=$2
if [ -z "${PACKAGE_BUILDING}" ]; 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
}
if [ x$2 != xDEINSTALL ]; then
exit
fi
if yesno "Do you want me to remove user \"${user}\"" y; then
if [ `id -u` -ne 0 ]; then
echo "You must be root to delete the user."
exit 1
fi
pw userdel -n ${user}
echo "Done."
fi