github.com/whyrusleeping/gx@v0.14.3/examples/gx-sample (about)

     1  #!/bin/bash
     2  
     3  cmd="$1"
     4  hook="$2"
     5  shift
     6  shift
     7  
     8  if [ "$cmd" != "hook" ]; then
     9  	echo "subcommand must be 'hook'"
    10  	exit 1
    11  fi
    12  
    13  case "$hook" in
    14  post-init)
    15  	pkg_dir="$1"
    16  	echo "post-init in $pkg_dir"
    17  	;;
    18  post-install)
    19  	new_pkg_path="$1"
    20  	global="$2"
    21  	echo "post-install of package $new_pkg_path. global = $global"
    22  	;;
    23  pre-publish)
    24  	echo "pre-publish!"
    25  	;;
    26  post-publish)
    27  	pkg_hash="$1"
    28  	echo "post-publish! package hash is $pkg_hash"
    29  	;;
    30  pre-update)
    31  	cur_hash="$1"
    32  	echo "pre-update, about to update $cur_hash"
    33  	;;
    34  post-update)
    35  	old_hash="$1"
    36  	new_hash="$2"
    37  	echo "post-update, updated $old_hash to $new_hash"
    38  	;;
    39  post-import)
    40  	new_imp="$1"
    41  	echo "post-import, just imported $new_imp"
    42  	;;
    43  req-check)
    44  	pkg_dir="$1"
    45  	echo "req-check, making sure package in $pkg_dir is good"
    46  	;;
    47  install-path)
    48  	global="$1"
    49  	echo "install-path, global = $global"
    50  	;;
    51  *)
    52  	echo "unknown hook $hook"
    53  	exit 1
    54  	;;
    55  esac