summaryrefslogtreecommitdiff
path: root/etc
diff options
context:
space:
mode:
authorMichael Larson <slioch@eng-140.vyatta.com>2008-06-18 19:39:05 -0700
committerMichael Larson <slioch@eng-140.vyatta.com>2008-06-18 19:39:05 -0700
commitbb4b1baf77ec14182de00d48767a00523282bbea (patch)
treed1679a0cd320a41ea3fa5f82ace7bddb6a9cb39d /etc
parent97238661d34432eac6c8df62a28367da941f3e37 (diff)
parent2b12e94e3f19b694808fb2513f8e2a1e08eaec2d (diff)
downloadvyatta-cfg-bb4b1baf77ec14182de00d48767a00523282bbea.tar.gz
vyatta-cfg-bb4b1baf77ec14182de00d48767a00523282bbea.zip
Merge branch 'hollywood' of http://git.vyatta.com/vyatta-cfg into hollywood
Diffstat (limited to 'etc')
-rwxr-xr-xetc/bash_completion.d/20vyatta-cfg60
1 files changed, 60 insertions, 0 deletions
diff --git a/etc/bash_completion.d/20vyatta-cfg b/etc/bash_completion.d/20vyatta-cfg
index d77c933..d501019 100755
--- a/etc/bash_completion.d/20vyatta-cfg
+++ b/etc/bash_completion.d/20vyatta-cfg
@@ -135,6 +135,66 @@ top ()
set_config_ps1 ''
}
+rename()
+{
+ mvcp rename Rename mv "$@"
+}
+
+copy()
+{
+ mvcp copy Copy "cp -a" "$@"
+}
+
+mvcp ()
+{
+ local str=$1
+ shift
+ local Str=$1
+ shift
+ local cmd=$1
+ shift
+ local _otag=$1
+ local _ovalu=$2
+ local _to=$3
+ local _ntag=$4
+ local _nvalu=$5
+ local _oval=''
+ local _nval=''
+ local _mpath=${VYATTA_TEMP_CONFIG_DIR}/${VYATTA_EDIT_LEVEL}
+ local _tpath=${VYATTA_CONFIG_TEMPLATE}/${VYATTA_TEMPLATE_LEVEL}
+ vyatta_escape _ovalu _oval
+ vyatta_escape _nvalu _nval
+ if [ "$_to" != 'to' ] || [ -z "$_ntag" ] || [ -z "$_nval" ]; then
+ echo "Invalid $str command"
+ return 1
+ fi
+ if [ "$_otag" != "$_ntag" ]; then
+ echo "Cannot $str from \"$_otag\" to \"$_ntag\""
+ return 1
+ fi
+ if [ ! -d "$_tpath/$_otag/$VYATTA_TAG_NAME" ]; then
+ echo "Cannot $str under \"$_otag\""
+ return 1
+ fi
+ if [ ! -d "$_mpath/$_otag/$_oval" ]; then
+ echo "Configuration \"$_otag $_ovalu\" does not exist"
+ return 1
+ fi
+ if [ -d "$_mpath/$_ntag/$_nval" ]; then
+ echo "Configuration \"$_ntag $_nvalu\" already exists"
+ return 1
+ fi
+ if ! /opt/vyatta/sbin/my_set $_ntag "$_nvalu"; then
+ echo "$Str failed"
+ return 1
+ fi
+ /opt/vyatta/sbin/my_delete $_ntag "$_nvalu" >&/dev/null 3>&1
+
+ $cmd "$_mpath/$_otag/$_oval" "$_mpath/$_ntag/$_nval"
+
+ return 0
+}
+
edit ()
{
local num_comp=${#@}