summaryrefslogtreecommitdiff
path: root/scripts/vyatta-cfg-cmd-wrapper
diff options
context:
space:
mode:
Diffstat (limited to 'scripts/vyatta-cfg-cmd-wrapper')
-rwxr-xr-xscripts/vyatta-cfg-cmd-wrapper13
1 files changed, 10 insertions, 3 deletions
diff --git a/scripts/vyatta-cfg-cmd-wrapper b/scripts/vyatta-cfg-cmd-wrapper
index 8eddd5c..e994742 100755
--- a/scripts/vyatta-cfg-cmd-wrapper
+++ b/scripts/vyatta-cfg-cmd-wrapper
@@ -35,9 +35,16 @@ export VYATTA_EDIT_LEVEL=/;
export VYATTA_TEMPLATE_LEVEL=/;
export VYATTA_ACTIVE_CONFIGURATION_DIR=/opt/vyatta/config/active;
-export VYATTA_CHANGES_ONLY_DIR=/tmp/changes_only_$PPID;
-export VYATTA_TEMP_CONFIG_DIR=/opt/vyatta/config/tmp/new_config_$PPID;
-export VYATTA_CONFIG_TMP=/opt/vyatta/config/tmp/tmp_$PPID;
+# allow env variable to override default session id (ppid). this enables
+# the script to handle cases where the invocations can come from
+# different parents.
+SID=$PPID
+if [ -n "$CMD_WRAPPER_SESSION_ID" ]; then
+ SID=$CMD_WRAPPER_SESSION_ID
+fi
+export VYATTA_CHANGES_ONLY_DIR=/tmp/changes_only_$SID;
+export VYATTA_TEMP_CONFIG_DIR=/opt/vyatta/config/tmp/new_config_$SID;
+export VYATTA_CONFIG_TMP=/opt/vyatta/config/tmp/tmp_$SID;
RET_STATUS=0