kiss-hook

directory based kiss-hook manager
git clone git://git.ckyln.com/~cem/kiss-hook
Log | Files | Refs | README | LICENSE

cpt-hook (585B)


      1 #!/bin/sh -e
      2 # shellcheck disable=1090
      3 # A directory based cpt-hook manager.
      4 
      5 hook() {
      6     [ -e "${CPT_HOOK_DIR:=${CPT_HOOK%/*}}/$TYPE" ] || return 0
      7     [ -e "$CPT_HOOK_DIR/lib" ] && . "$CPT_HOOK_DIR/lib"
      8 
      9     [ -d "$CPT_HOOK_DIR/$TYPE" ] || {
     10         . "$CPT_HOOK_DIR/$TYPE"
     11         return
     12     }
     13 
     14     [ -f "$CPT_HOOK_DIR/$TYPE/$TYPE" ] && . "$CPT_HOOK_DIR/$TYPE/$TYPE"
     15     [ -f "$CPT_HOOK_DIR/$TYPE/$PKG"  ] && . "$CPT_HOOK_DIR/$TYPE/$PKG"
     16 
     17     # We are returning with success, since the package manager already exits
     18     # with in an error caused by the hooks.
     19     return 0
     20 }
     21 
     22 hook