From 97238661d34432eac6c8df62a28367da941f3e37 Mon Sep 17 00:00:00 2001 From: Michael Larson Date: Tue, 17 Jun 2008 14:06:55 -0700 Subject: fix for bug 110. added discard command to configure mode. This command deletes local changes and keeps the user in configure mode. --- etc/bash_completion.d/20vyatta-cfg | 22 ++++++++++++++++++++++ 1 file changed, 22 insertions(+) (limited to 'etc/bash_completion.d/20vyatta-cfg') diff --git a/etc/bash_completion.d/20vyatta-cfg b/etc/bash_completion.d/20vyatta-cfg index 102ce8f..d77c933 100755 --- a/etc/bash_completion.d/20vyatta-cfg +++ b/etc/bash_completion.d/20vyatta-cfg @@ -66,6 +66,28 @@ save () \"umask 0002 ; ${vyatta_sbindir}/vyatta-save-config.pl $@\"" } +discard () +{ + local changes + if [ -f "$VYATTA_TEMP_CONFIG_DIR/$VYATTA_MOD_NAME" ]; then + changes=1 + else + changes=0 + fi + + sudo umount ${VYATTA_TEMP_CONFIG_DIR}; + rm -fr ${VYATTA_CHANGES_ONLY_DIR}; + mkdir -p ${VYATTA_CHANGES_ONLY_DIR}; + sudo mount -t unionfs -o dirs=${VYATTA_CHANGES_ONLY_DIR}=rw:${VYATTA_ACTIVE_CONFIGURATION_DIR}=ro unionfs ${VYATTA_TEMP_CONFIG_DIR}; + + if (( changes )); then + echo "Changes have been discarded" + else + echo "No changes have been discarded" + fi + +} + reboot () { echo "Exit from configure mode before rebooting." -- cgit v1.2.3