summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorJohn Estabrook <jestabro@vyos.io>2020-08-31 11:20:41 -0500
committerGitHub <noreply@github.com>2020-08-31 11:20:41 -0500
commit800762b3a23f06277e2cba3a3f5ae943615626ff (patch)
tree02358bd0731b72f54bf0d629d56d60aeaf1ad9f7
parent9dd1557c27b5e7c91cbba7edc03f70f9788c19fe (diff)
parentcf6fb0dc307a69c6840a58fc52b41cd81a9da12c (diff)
downloadvyatta-cfg-800762b3a23f06277e2cba3a3f5ae943615626ff.tar.gz
vyatta-cfg-800762b3a23f06277e2cba3a3f5ae943615626ff.zip
Merge pull request #25 from jestabro/vyos-configd
configd: T2582: hooks for vyos config script daemon configd: T2582: set vyshim env variable for config session configd: T2582: leave marker to indicate beginning of commit
-rwxr-xr-xetc/bash_completion.d/vyatta-cfg4
-rw-r--r--src/cli_objects.c21
2 files changed, 25 insertions, 0 deletions
diff --git a/etc/bash_completion.d/vyatta-cfg b/etc/bash_completion.d/vyatta-cfg
index 1cd0b62..7547099 100755
--- a/etc/bash_completion.d/vyatta-cfg
+++ b/etc/bash_completion.d/vyatta-cfg
@@ -39,6 +39,10 @@ if [ "$_OFR_CONFIGURE" != "ok" ]; then
return 0
fi
+if [ -r /etc/default/vyos-configd-env ]; then
+ source /etc/default/vyos-configd-env
+fi
+
if [ -r /etc/default/vyatta ]; then
source /etc/default/vyatta
fi
diff --git a/src/cli_objects.c b/src/cli_objects.c
index dbb2f08..190ff46 100644
--- a/src/cli_objects.c
+++ b/src/cli_objects.c
@@ -30,6 +30,21 @@ static first_seg f_seg_a;
static first_seg f_seg_c;
static first_seg f_seg_m;
+/****************** simple marker ***********************/
+
+static char *in_commit_file = "/var/tmp/in_commit";
+static char *initial_file = "/var/tmp/initial_in_commit";
+
+static int mark_by_file(char *p) {
+ int ret = mknod(p, S_IFREG|0664, 0);
+ return ret;
+}
+
+static int remove_mark(char *p) {
+ int ret = remove(p);
+ return ret;
+}
+
/******************** Accessors: ************************/
static char at_buffer[1024]={0};
@@ -73,6 +88,12 @@ boolean is_in_commit(void) {
void set_in_commit(boolean b) {
in_commit=b;
+ if (b == TRUE) {
+ mark_by_file(in_commit_file);
+ mark_by_file(initial_file);
+ } else {
+ remove_mark(in_commit_file);
+ }
}
boolean is_in_exec(void) {