summaryrefslogtreecommitdiff
path: root/etc/bash_completion.d/20vyatta-cfg
diff options
context:
space:
mode:
authorMichael Larson <slioch@eng-140.vyatta.com>2008-06-17 14:06:55 -0700
committerMichael Larson <slioch@eng-140.vyatta.com>2008-06-17 14:06:55 -0700
commit97238661d34432eac6c8df62a28367da941f3e37 (patch)
tree5ae7786601604ac79ed0da522f972620c21ede21 /etc/bash_completion.d/20vyatta-cfg
parent8f1c7d3f0eb43ca080acb83e880af7403117c9cd (diff)
downloadvyatta-cfg-97238661d34432eac6c8df62a28367da941f3e37.tar.gz
vyatta-cfg-97238661d34432eac6c8df62a28367da941f3e37.zip
fix for bug 110. added discard command to configure mode. This command deletes local changes and keeps the user in configure mode.
Diffstat (limited to 'etc/bash_completion.d/20vyatta-cfg')
-rwxr-xr-xetc/bash_completion.d/20vyatta-cfg22
1 files changed, 22 insertions, 0 deletions
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."