#!/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