From 8941d07b8b8d6d3a6c001f36b4f931111ad18cb4 Mon Sep 17 00:00:00 2001 From: Alex Harpin Date: Tue, 16 Jun 2015 07:45:53 +0100 Subject: vyatta-cfg-system: prevent deletion of system based post-hook symlinks Any system based symlinks installed in the /etc/commit/post-hooks.d directory were being deleted on either the initial start of the system or subsequent reboots. This commit resolves this by excluding these from the deletion process, while still tidying up other non system symlinks. This is required for bug #538 (enhancement request) to function as intended and also enables the Vyatta bug fix 4718 (enhancement), to log successful commits to syslog with commit type and user name, commited on February 2012! Bug #576 http://bugzilla.vyos.net/show_bug.cgi?id=576 --- scripts/rl-system.init | 11 ++++++++++- 1 file changed, 10 insertions(+), 1 deletion(-) (limited to 'scripts') diff --git a/scripts/rl-system.init b/scripts/rl-system.init index fac5fbc1..6a2b8d25 100755 --- a/scripts/rl-system.init +++ b/scripts/rl-system.init @@ -210,8 +210,17 @@ start () { # note that this approach only supports hooks that are "configured", # i.e., it does not support hooks that need to always be present. cpostdir=$(cli-shell-api getPostCommitHookDir) + + # exclude commits hooks from vyatta-cfg + excluded="10vyatta-log-commit.pl 99vyos-user-postcommit-hooks" + if [ -d "$cpostdir" ]; then - rm -f $cpostdir/* + for f in $cpostdir/* + do + if [[ ! $excluded =~ $(basename $f) ]]; then + rm -f $cpostdir/$(basename $f) + fi + done fi ## Clear out apt config file--it will be filled in by config load -- cgit v1.2.3