summaryrefslogtreecommitdiff
path: root/irc/dancer-ircd/pkg-deinstall
diff options
context:
space:
mode:
authorAkinori MUSHA <knu@FreeBSD.org>2003-04-24 20:18:10 +0000
committerAkinori MUSHA <knu@FreeBSD.org>2003-04-24 20:18:10 +0000
commit13e5cb29f396fc9983b7ee55da313f39dd32eec1 (patch)
tree422ea0f68dc8f38e5e3db6c4acd651f93387b89a /irc/dancer-ircd/pkg-deinstall
parentFix typos in COMMENT. Replace spaces with a tab in MASTER_SITES to make (diff)
Add user & group in package building too.
Submitted by: bento Remove user & group on deinstallation (only on bento).
Notes
Notes: svn path=/head/; revision=79599
Diffstat (limited to 'irc/dancer-ircd/pkg-deinstall')
-rw-r--r--irc/dancer-ircd/pkg-deinstall56
1 files changed, 56 insertions, 0 deletions
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