From d765dbd043d5a69a15875f2cd0ff81cdaaa2d97f Mon Sep 17 00:00:00 2001 From: Dylan Araps Date: Wed, 14 Jul 2021 13:41:22 +0300 Subject: [PATCH] kiss: do not source KISS_HOOK This file can now be written in any language. The only requirement now is that it be executable. The variable originally exported in the environment are passed as command-line arguments to KISS_HOOK. We can now expand on the information we want to explicitly pass on to hooks via arguments or the environment. Let me know what information you would like exposed. --- kiss | 11 ++++++++--- 1 file changed, 8 insertions(+), 3 deletions(-) diff --git a/kiss b/kiss index 76c18c7..6c2812e 100755 --- a/kiss +++ b/kiss @@ -111,7 +111,9 @@ run_hook() { # Provide a default post-build hook to remove files and directories # for things we don't support out of the box. One can simply define # their own hook to override this behavior. - case ${KISS_HOOK:--}$1 in + set -- "${1:-null}" "${2:-null}" "${3:-null}" + + case $KISS_HOOK-$1 in -post-build) rm -rf "$3/usr/share/gettext" \ "$3/usr/share/polkit-1" \ @@ -119,8 +121,8 @@ run_hook() { "$3/usr/share/info" ;; - [!-]*) - TYPE=${1:-null} PKG=${2:-null} DEST=${3:-null} . "$KISS_HOOK" + *?*-"$1") + "$KISS_HOOK" "$1" "$2" "$3" ;; esac } @@ -130,6 +132,9 @@ run_hook_pkg() { if [ -x "$sys_db/$2/$1" ]; then log "$2" "Running $1 hook" "$sys_db/$2/$1" + + elif [ -f "$sys_db/$2/$1" ]; then + war "$2" "skipping $1 hook: not executable" fi }