From eb5c5c33151affc5861d181578d08de847955c52 Mon Sep 17 00:00:00 2001 From: Daniel Friesel Date: Sun, 17 Aug 2008 11:32:55 +0200 Subject: bin/pkg: Collect provide-related hooks and execute them after everything else --- bin/pkg | 12 +++++++++++- 1 file changed, 11 insertions(+), 1 deletion(-) diff --git a/bin/pkg b/bin/pkg index 31fe509..b6a601d 100755 --- a/bin/pkg +++ b/bin/pkg @@ -1,6 +1,8 @@ #!/usr/bin/env zsh # pkg - /home package manager and zsh playground +typeset -a -U triggers + ## ## Internal functions for displaying stuff ## @@ -373,11 +375,17 @@ update_provides () { for package in *; { if [[ -d $PDIR/$package ]] { [[ $2 = 'remove' ]] && rm -r $package - exec_hook $package 'post-update' + triggers+=$package } } } +apply_triggers () { + for package in $triggers; { + exec_hook $package 'post-update' + } +} + wrap () { function=$1 arg=$2 @@ -622,3 +630,5 @@ case $1 in upgrade) wrap pkg_upgrade "$2" "Looking for updates" ;; *) die "wait, what?\n" ;; esac + +apply_triggers -- cgit v1.2.3