From 76ff750a6b057dacba1361726f15cd5bd4bfe14b Mon Sep 17 00:00:00 2001 From: An-Cheng Huang Date: Mon, 16 May 2011 19:57:39 -0700 Subject: reimplement commit hooks mechanism * do NOT reinvent the wheel (directory traversal, sorting, script execution, etc.) when the functionality is already provided by the system. * eliminate hard-coded hook directory in various feastures. everyone should obtain the directory path from the config backend. --- debian/vyatta-cfg.postinst.in | 8 ++++++++ 1 file changed, 8 insertions(+) (limited to 'debian') diff --git a/debian/vyatta-cfg.postinst.in b/debian/vyatta-cfg.postinst.in index 5585e2a..7ba4332 100644 --- a/debian/vyatta-cfg.postinst.in +++ b/debian/vyatta-cfg.postinst.in @@ -33,6 +33,14 @@ for bin in my_cli_bin my_cli_shell_api; do setcap cap_sys_admin=pe $sbindir/$bin done +# commit hooks +for hook in PreCommit PostCommit; do + d=$(cli-shell-api get${hook}HookDir) + if [ -n "$d" ] && [ ! -e "$d" ]; then + mkdir -p "$d" + fi +done + # handle renamed file (not automatically deleted since it was "conffile") rm -f /etc/bash_completion.d/20vyatta-cfg -- cgit v1.2.3