summaryrefslogtreecommitdiff
path: root/debian/vyatta-cfg.postinst.in
diff options
context:
space:
mode:
authorAn-Cheng Huang <ancheng@vyatta.com>2011-05-16 19:57:39 -0700
committerAn-Cheng Huang <ancheng@vyatta.com>2011-05-16 19:57:39 -0700
commit76ff750a6b057dacba1361726f15cd5bd4bfe14b (patch)
tree8eea69cfa6ba3377883d2caa4aeca874c100b2a3 /debian/vyatta-cfg.postinst.in
parent7ea935bc47f37111b95ed8a4f989a2ae3f578e5a (diff)
downloadvyatta-cfg-76ff750a6b057dacba1361726f15cd5bd4bfe14b.tar.gz
vyatta-cfg-76ff750a6b057dacba1361726f15cd5bd4bfe14b.zip
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.
Diffstat (limited to 'debian/vyatta-cfg.postinst.in')
-rw-r--r--debian/vyatta-cfg.postinst.in8
1 files changed, 8 insertions, 0 deletions
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