summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorDaniel Friesel <derf@derf.homelinux.org>2009-01-23 17:59:10 +0100
committerDaniel Friesel <derf@derf.homelinux.org>2009-01-23 17:59:10 +0100
commit7e3ebdeb7cd68c6222fbcb40463b40c270a16eab (patch)
tree93b47171af864b915fd8e88e4a9787aa188b6a41
parent9047fffb9f43980bb8c5e365f8ae438209fba3e7 (diff)
Added support for global hooks via .pkg.conf
-rwxr-xr-xbin/pkg1
-rw-r--r--man/5/pkg.conf14
2 files changed, 15 insertions, 0 deletions
diff --git a/bin/pkg b/bin/pkg
index ca09a53..91bcab6 100755
--- a/bin/pkg
+++ b/bin/pkg
@@ -378,6 +378,7 @@ function global_hook {
update_provides $1 'remove'
;;
esac
+ (( $+functions[pkg_hook_$2] )) && pkg_hook_$2 $1
}
# Set the correct origin
diff --git a/man/5/pkg.conf b/man/5/pkg.conf
index b508807..7c7230a 100644
--- a/man/5/pkg.conf
+++ b/man/5/pkg.conf
@@ -45,6 +45,20 @@ Operate in debug mode if 1
If 1, automatically execute 'pkg update' before 'pkg push'
and 'pkg remote-update' before 'pkg upgrade'
+=item B<pkg_hook_>I<hook> () {I<content>}
+
+Define the global hook I<hook>, its I<content> will be executed
+together with pkg's global hooks; the name of the package for which the hook is
+being executed will be given as first parameter and is accessible throug B<$1>.
+The hook is just a zsh function, so you can use any valid syntax you want,
+including newlines.
+See zsh(1) for more
+
+Valid I<hook> names are: post-add, pre-update, post-update, pre-remove.
+Note thatt post-add automatically executes post-update
+
+Example: pkg_hook_post-update () {clear_line; echo "Hello from package $1!"}
+
=back
=head1 SEE ALSO