commit 50167bc25fb79a20880ed9bab04d1a588fc3df50 parent 9a1671549acd2e8cad88b9a6693a4e1299185a4a Author: Cem Keylan <cem@ckyln.com> Date: Sun, 26 Jul 2020 14:30:36 +0300 cpt-hook: add the same script for cpt Diffstat:
A | cpt-hook | | | 22 | ++++++++++++++++++++++ |
1 file changed, 22 insertions(+), 0 deletions(-)
diff --git a/cpt-hook b/cpt-hook @@ -0,0 +1,22 @@ +#!/bin/sh -e +# shellcheck disable=1090 +# A directory based cpt-hook manager. + +# We don't want the package manager to exit because of an error here. +set +e + +hook() { + [ -e "${CPT_HOOK_DIR:=${CPT_HOOK%/*}}/$TYPE" ] || return 0 + [ -e "$CPT_HOOK_DIR/lib" ] && . "$CPT_HOOK_DIR/lib" + + [ -d "$CPT_HOOK_DIR/$TYPE" ] || { + . "$CPT_HOOK_DIR/$TYPE" + return + } + + [ -f "$CPT_HOOK_DIR/$TYPE/$TYPE" ] && . "$CPT_HOOK_DIR/$TYPE/$TYPE" + [ -f "$CPT_HOOK_DIR/$TYPE/$PKG" ] && . "$CPT_HOOK_DIR/$TYPE/$PKG" +} + +hook +set -e