aboutsummaryrefslogtreecommitdiff
path: root/net/wired/pkg-deinstall
diff options
context:
space:
mode:
authorMartin Wilke <miwi@FreeBSD.org>2006-11-23 22:36:05 +0000
committerMartin Wilke <miwi@FreeBSD.org>2006-11-23 22:36:05 +0000
commita8e0f5eaf976df63a611df1deb8a9acde64d7c57 (patch)
tree3838e754aec34bc7492c9cb13dc0e8c29036ed02 /net/wired/pkg-deinstall
parent3fc923c38eaaec6746df8dd11dc63a9329efb26d (diff)
Notes
Diffstat (limited to 'net/wired/pkg-deinstall')
-rw-r--r--net/wired/pkg-deinstall56
1 files changed, 56 insertions, 0 deletions
diff --git a/net/wired/pkg-deinstall b/net/wired/pkg-deinstall
new file mode 100644
index 000000000000..ba3037ac19da
--- /dev/null
+++ b/net/wired/pkg-deinstall
@@ -0,0 +1,56 @@
+#! /bin/sh
+#
+# ex:ts=4
+
+ask() {
+ local question default answer
+
+ question=$1
+ default=$2
+ if [ -z "${PACKAGE_BUILDING}" -a -z "${BATCH}" ]; then
+ read -p "${question} [${default}]? " answer
+ fi
+ echo ${answer:-${default}}
+}
+
+yesno() {
+ local question default answer
+
+ question=$1
+ default=$2
+ while :; do
+ answer=$(ask "${question}" "${default}")
+ case "${answer}" in
+ [Yy]*) return 0;;
+ [Nn]*) return 1;;
+ esac
+ echo "Please answer yes or no."
+ done
+}
+
+delete_account() {
+ local u
+
+ u=$1
+ if yesno "Do you want me to remove user \"${u}\"" n; then
+ pw userdel -n ${u}
+ echo "Done."
+ fi
+}
+
+case $2 in
+
+DEINSTALL)
+ if ps -axc | grep -qw wired; then
+ if yesno "Wired is still running. Shall I stop it?" y; then
+ killall wired
+ sleep 2
+ else
+ echo "OK ... I hope you know what you are doing."
+ fi
+ fi
+
+ delete_account wired
+ ;;
+
+esac