Jinja-templated hdistjail.c{,.in}, more consistent hook handling