kiss: KISS_HOOK support multiple files

See #229
This commit is contained in:
Dylan Araps 2021-07-14 18:40:37 +03:00
parent d296b90b75
commit 7fc6929516
No known key found for this signature in database
GPG Key ID: 13295DAC2CF13B5C
1 changed files with 13 additions and 15 deletions

28
kiss
View File

@ -108,23 +108,21 @@ pkg_owner() {
} }
run_hook() { run_hook() {
# Provide a default post-build hook to remove files and directories # Run all hooks in KISS_HOOK (a colon separated
# for things we don't support out of the box. One can simply define # list of absolute file paths).
# their own hook to override this behavior. _type=${1:-null} _name=${2:-null} _path=${3:-null}
set -- "${1:-null}" "${2:-null}" "${3:-null}"
case ${KISS_HOOK:-}-$1 in IFS=:
-post-build)
rm -rf "$3/usr/share/gettext" \
"$3/usr/share/polkit-1" \
"$3/usr/share/locale" \
"$3/usr/share/info"
;;
*?*-"$1") # Intentional, globbing disabled.
"${KISS_HOOK:-}" "$1" "$2" "$3" # shellcheck disable=2086
;; set -- ${KISS_HOOK:-}
esac
unset IFS
for hook do "$hook" "$_type" "$_name" "$_path" ||
die "$_name" "$_type hook failed: '$hook'"
done
} }
run_hook_pkg() { run_hook_pkg() {