summaryrefslogtreecommitdiff
path: root/etc
diff options
context:
space:
mode:
authorslioch <slioch@eng-140.vyatta.com>2009-05-21 17:11:54 -0700
committerslioch <slioch@eng-140.vyatta.com>2009-05-21 17:11:54 -0700
commit81218208adb11e2a8e32b90ede20554cad23c45a (patch)
tree0c4ebb3e5a509dfcd2adf0daf53f26b89ec14982 /etc
parent8e3b81d1a13f35d4b419fe9af6da2e0b7fa64a64 (diff)
downloadvyatta-cfg-81218208adb11e2a8e32b90ede20554cad23c45a.tar.gz
vyatta-cfg-81218208adb11e2a8e32b90ede20554cad23c45a.zip
added load-merge command to configuration mode
Diffstat (limited to 'etc')
-rwxr-xr-xetc/bash_completion.d/20vyatta-cfg21
1 files changed, 19 insertions, 2 deletions
diff --git a/etc/bash_completion.d/20vyatta-cfg b/etc/bash_completion.d/20vyatta-cfg
index ac573fa..ef8810a 100755
--- a/etc/bash_completion.d/20vyatta-cfg
+++ b/etc/bash_completion.d/20vyatta-cfg
@@ -46,7 +46,7 @@ declare last_idx=0
declare -a comp_words=()
# commands to unalias
-declare -a unalias_cmds=( clear configure date debug edit exit load \
+declare -a unalias_cmds=( clear configure date debug edit exit load load-merge \
no run set show save terminal undebug up top )
for cmd in "${unalias_cmds[@]}"; do
unalias $cmd >& /dev/null
@@ -138,6 +138,21 @@ load ()
eval "${vyatta_sbindir}/vyatta-load-config.pl $@"
}
+load-merge ()
+{
+ # don't load if there are uncommitted changes.
+ if [ -f "$VYATTA_TEMP_CONFIG_DIR/$VYATTA_MOD_NAME" ]; then
+ echo "Cannot load: configuration modified."
+ echo "Commit or discard the changes before loading a config file."
+ return 1
+ fi
+ # return to top level.
+ export VYATTA_EDIT_LEVEL="/"
+ export VYATTA_TEMPLATE_LEVEL="/"
+ set_config_ps1 ''
+ eval "${vyatta_sbindir}/vyatta-load-config.pl $@ --merge"
+}
+
top ()
{
if [ "$VYATTA_EDIT_LEVEL" == "/" ]; then
@@ -840,6 +855,7 @@ vyatta_config_complete ()
"edit" \
"exit" \
"load" \
+ "load-merge" \
"rename" \
"run" \
"save" \
@@ -852,7 +868,8 @@ vyatta_config_complete ()
"Discard uncommitted changes" \
"Edit a sub-element" \
"Exit from this configuration level" \
- "Load configuration from a file" \
+ "Load configuration from a file and replace running configuration" \
+ "Load configuration from a file and merge running configuration" \
"Rename a configuration element" \
"Run an operational-mode command" \
"Save configuration to a file" \