diff options
author | jmmv <jmmv@pkgsrc.org> | 2005-01-25 16:27:37 +0000 |
---|---|---|
committer | jmmv <jmmv@pkgsrc.org> | 2005-01-25 16:27:37 +0000 |
commit | 3cfcc8be82229d92018f68b27bb29093adb78e97 (patch) | |
tree | 7dc97d342ceaef3e03ae57687f61b60f59e10a5d /pkgtools/pkg_alternatives/files | |
parent | 5ff7c8f3a530690cba3d5bd2dcdbddc045d50d5e (diff) | |
download | pkgsrc-3cfcc8be82229d92018f68b27bb29093adb78e97.tar.gz |
Update to 1.1:
- Add the destroy action, used to remove the alternatives database as well
as any known wrappers.
- Use the rebuild/destroy actions at install/deinstall time respectively
so that this package can be installed at any time and pick up automatically
available alternatives from PKG_DBDIR.
Per suggestion from reed@ in tech-pkg@.
Diffstat (limited to 'pkgtools/pkg_alternatives/files')
-rw-r--r-- | pkgtools/pkg_alternatives/files/pkg_alternatives.8 | 12 | ||||
-rw-r--r-- | pkgtools/pkg_alternatives/files/pkg_alternatives.sh | 39 |
2 files changed, 48 insertions, 3 deletions
diff --git a/pkgtools/pkg_alternatives/files/pkg_alternatives.8 b/pkgtools/pkg_alternatives/files/pkg_alternatives.8 index 3e990da236c..ca90e10ad09 100644 --- a/pkgtools/pkg_alternatives/files/pkg_alternatives.8 +++ b/pkgtools/pkg_alternatives/files/pkg_alternatives.8 @@ -1,4 +1,4 @@ -.\" $NetBSD: pkg_alternatives.8,v 1.1.1.1 2005/01/25 13:00:46 jmmv Exp $ +.\" $NetBSD: pkg_alternatives.8,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> @@ -154,6 +154,13 @@ Removes any manual configuration from each wrapper associated to the given package. This means that all the affected wrappers are then free to choose whichever alternative they prefer. +.It destroy +Removes the alternative database, found in +.Pa @DBDIR@ , +and all its associated wrappers and manual pages. +This action is intended to be used by the +.Nm +package. .It list Lists which of the installed packages provide alternatives. Any of the packages shown by this command can then be fed back to the @@ -175,6 +182,9 @@ Basically, it scans the later looking for packages with an file in them, and, for each of those, the .Sq register action is called with the appropriate file name. +This action is intended to be used by the +.Nm +package or in case of database corruption. .It register Ar package wrapper alternative arguments Registers a new .Ar alternative 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} "${@}" ;; *) |