pkg_comp icon indicating copy to clipboard operation
pkg_comp copied to clipboard

Add hook support for post_build_hook routine

Open jlmuir opened this issue 7 years ago • 0 comments

Add hook support for a post_build_hook routine that is executed right after packages have been built by the pkg_comp build subcommand.

This enables me to, for example, define a post_build_hook function in /usr/local/etc/pkg_comp/default.conf to preserve the pbulk log outside of the sandbox after the build finishes but before the sandbox gets destroyed:

post_build_hook() {
  local logdir bulklog sandbox_bulklog
  logdir=/var/pkg_comp/log
  bulklog=$logdir/bulklog
  sandbox_bulklog=/var/pkg_comp/sandbox/pkg_comp/work/bulklog
  [ ! -e "$sandbox_bulklog" ] && return
  if [ -e "$bulklog" ]; then
    rm -rf "$bulklog.old"
    mv "$bulklog" "$bulklog.old"
  fi
  mkdir -p "$logdir"
  cp -rp "$sandbox_bulklog" "$bulklog"
}

jlmuir avatar Mar 27 '17 20:03 jlmuir