mirror of
https://git.FreeBSD.org/ports.git
synced 2024-11-05 22:43:24 +00:00
46 lines
751 B
Plaintext
46 lines
751 B
Plaintext
|
#!/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
|