diff options
author | Stig Thormodsrud <stig@vyatta.com> | 2010-06-03 18:26:02 -0700 |
---|---|---|
committer | Stig Thormodsrud <stig@vyatta.com> | 2010-06-03 18:26:02 -0700 |
commit | 69078e9bda96ea0dc752b20677ac580cf26721cf (patch) | |
tree | aeba42368b684a9362a305b41412c80819156763 | |
parent | 0494d74dc72f2c40430b8a426fd55a71a4f02bd7 (diff) | |
download | vyatta-cfg-69078e9bda96ea0dc752b20677ac580cf26721cf.tar.gz vyatta-cfg-69078e9bda96ea0dc752b20677ac580cf26721cf.zip |
Fix 1452: Add warning prompt to save configuration when exiting configuration mode.
-rwxr-xr-x | etc/bash_completion.d/20vyatta-cfg | 13 |
1 files changed, 12 insertions, 1 deletions
diff --git a/etc/bash_completion.d/20vyatta-cfg b/etc/bash_completion.d/20vyatta-cfg index 48ba4fd..7a6ea5c 100755 --- a/etc/bash_completion.d/20vyatta-cfg +++ b/etc/bash_completion.d/20vyatta-cfg @@ -68,9 +68,18 @@ show () | eval "${VYATTA_PAGER:-cat}" } +commit () +{ + /opt/vyatta/sbin/my_commit $@ + if [ $? == 0 ]; then + touch $VYATTA_CHANGES_ONLY_DIR/.unsaved + fi +} + save () { eval "sudo sg vyattacfg \"umask 0002 ; ${vyatta_sbindir}/vyatta-save-config.pl $@\"" + rm -f $VYATTA_CHANGES_ONLY_DIR/.unsaved } discard () @@ -312,6 +321,9 @@ up () really_exit() { + if [ -f $VYATTA_CHANGES_ONLY_DIR/.unsaved ]; then + echo "Warning: configuration changes have not been saved." + fi sudo umount $VYATTA_TEMP_CONFIG_DIR sudo rm -rf $VYATTA_TEMP_CONFIG_DIR $VYATTA_CHANGES_ONLY_DIR \ $VYATTA_CONFIG_TMP @@ -1306,7 +1318,6 @@ fi set -o ignoreeof 1 set_config_ps1 '' -alias commit=/opt/vyatta/sbin/my_commit alias set=/opt/vyatta/sbin/my_set alias delete=/opt/vyatta/sbin/my_delete |