From 13e5cb29f396fc9983b7ee55da313f39dd32eec1 Mon Sep 17 00:00:00 2001 From: Akinori MUSHA Date: Thu, 24 Apr 2003 20:18:10 +0000 Subject: Add user & group in package building too. Submitted by: bento Remove user & group on deinstallation (only on bento). --- irc/dancer-ircd/pkg-deinstall | 56 +++++++++++++++++++++++++++++++++++++++++++ 1 file changed, 56 insertions(+) create mode 100644 irc/dancer-ircd/pkg-deinstall (limited to 'irc/dancer-ircd/pkg-deinstall') diff --git a/irc/dancer-ircd/pkg-deinstall b/irc/dancer-ircd/pkg-deinstall new file mode 100644 index 000000000000..1e87c9ff95aa --- /dev/null +++ b/irc/dancer-ircd/pkg-deinstall @@ -0,0 +1,56 @@ +#!/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 ircd ircd +fi -- cgit v1.2.3