summaryrefslogtreecommitdiff
path: root/pkgtools/pkg_alternatives/files/pkg_alternatives.sh
diff options
context:
space:
mode:
Diffstat (limited to 'pkgtools/pkg_alternatives/files/pkg_alternatives.sh')
-rw-r--r--pkgtools/pkg_alternatives/files/pkg_alternatives.sh39
1 files changed, 37 insertions, 2 deletions
diff --git a/pkgtools/pkg_alternatives/files/pkg_alternatives.sh b/pkgtools/pkg_alternatives/files/pkg_alternatives.sh
index 86cd6d23e63..0e04a39daad 100644
--- a/pkgtools/pkg_alternatives/files/pkg_alternatives.sh
+++ b/pkgtools/pkg_alternatives/files/pkg_alternatives.sh
@@ -1,6 +1,6 @@
#!@SH@
#
-# $NetBSD: pkg_alternatives.sh,v 1.1.1.1 2005/01/25 13:00:46 jmmv Exp $
+# $NetBSD: pkg_alternatives.sh,v 1.2 2005/01/25 16:27:37 jmmv Exp $
#
# pkg_alternatives - Generic wrappers for programs with similar interfaces
# Copyright (c) 2005 Julio M. Merino Vidal <jmmv@NetBSD.org>
@@ -86,6 +86,41 @@ action_auto_wrapper() {
# -------------------------------------------------------------------------
+# action_destroy_package
+#
+# Destroys the alternatives database and removes all installed wrappers.
+#
+action_destroy_package() {
+ validate_args list ${#} -eq 0
+
+ wrappers=$(cd ${Db_Dir} ; find . -type f)
+
+ for w in ${wrappers}; do
+ wrapper=$(echo ${w} | sed -e 's|^./||')
+ manpage=$(get_manpage ${wrapper})
+ info "removing wrapper \`${wrapper}'"
+ rm -f ${Prefix}/${wrapper}
+ info "removing manual page \`${manpage}'"
+ rm -f ${manpage}
+ done
+
+ info "removing contents of \`@DBDIR@'"
+ rm -rf @DBDIR@/* 2>/dev/null
+ rmdir_p @DBDIR@
+}
+
+# -------------------------------------------------------------------------
+
+# action_destroy_wrapper
+#
+# Unavailable action.
+#
+action_destroy_wrapper() {
+ err "the \`destroy' action cannot be used in wrapper mode"
+}
+
+# -------------------------------------------------------------------------
+
# action_list_package
#
# Lists all available packages that provide alternatives.
@@ -598,7 +633,7 @@ main() {
action=${1}; shift
case ${action} in
- auto|list|manual|rebuild|register|status|unregister)
+ auto|destroy|list|manual|rebuild|register|status|unregister)
action_${action}_${what} "${@}"
;;
*)