summaryrefslogtreecommitdiff
path: root/functions/interpreter
diff options
context:
space:
mode:
authorerkin <me@erkin.party>2023-11-20 06:16:03 +0300
committererkin <me@erkin.party>2024-01-17 12:44:37 +0300
commit6e94def372856437d6e2fd6252ae272cc502c87e (patch)
tree17440fdd9ee9714dea7ad840aeff82a12a794e83 /functions/interpreter
parent58e5b6cd712802d411ffc2be880bc55d9f610f4a (diff)
downloadvyatta-op-6e94def372856437d6e2fd6252ae272cc502c87e.tar.gz
vyatta-op-6e94def372856437d6e2fd6252ae272cc502c87e.zip
op-mode: T4038: Remove legacy `vyatta-image-tools.pl`
Diffstat (limited to 'functions/interpreter')
-rw-r--r--functions/interpreter/vyatta-image-complete20
-rw-r--r--functions/interpreter/vyatta-op-run4
2 files changed, 14 insertions, 10 deletions
diff --git a/functions/interpreter/vyatta-image-complete b/functions/interpreter/vyatta-image-complete
index cfc1c90..48110cf 100644
--- a/functions/interpreter/vyatta-image-complete
+++ b/functions/interpreter/vyatta-image-complete
@@ -48,12 +48,14 @@ _vyatta_image_file_complete()
_vyatta_op_completions=( "" " " )
return 0;
fi
+
_vyatta_image_path_complete
}
-declare -a non_comps=( "http://<user>:<passwd>@<host>/<file>" \
+declare -a non_comps=( "http(s)://<user>:<passwd>@<host>/<file>" \
"scp://<user>:<passwd>@<host>/<file>" \
- "ftp://<user>:<passwd>@<host>/<file>" \
+ "sftp://<user>:<passwd>@<host>/<file>" \
+ "ftp(s)://<user>:<passwd>@<host>/<file>" \
"tftp://<host>/<file>" )
_vyatta_image_path_complete()
@@ -79,9 +81,9 @@ _vyatta_image_path_complete()
for i in `seq 0 $[${#reply[@]}-1]`; do
file=${reply[$i]}
reply[$i]=${file/#\/lib\/live\/mount\/persistence\/boot\//}
- reply[$i]="${reply[$i]}://config/"
+ reply[$i]="${reply[$i]}://"
done
- reply+=( "running://config/" )
+ reply+=( "running://" )
if [[ -d /lib/live/mount/persistence/opt/vyatta/etc/config || -d /lib/live/mount/persistence/config ]]; then
reply+=( "disk-install://" )
fi
@@ -108,13 +110,13 @@ _vyatta_image_path_complete()
for i in `seq 0 $[${#reply[@]}-1]`; do
file=${reply[$i]}
if [[ $isrunningimg == "running" ]];then
- reply[$i]="running://config/"
+ reply[$i]="running://"
elif [[ $isdiskinstall == "disk-install" ]]; then
reply[$i]="disk-install://"
else
reply[$i]=${file/#\/lib\/live\/mount\/persistence\/boot\//}
- if [[ -d /ib/live/mount/persistence/boot/${reply[$i]} ]]; then
- reply[$i]="${reply[$i]/#\//}://config/"
+ if [[ -d /lib/live/mount/persistence/boot/${reply[$i]} ]]; then
+ reply[$i]="${reply[$i]/#\//}://"
fi
fi
done
@@ -125,9 +127,9 @@ _vyatta_image_path_complete()
if [[ $topdir == "running" ]]; then
cur="/${cur}"
elif [[ $topdir == "disk-install" ]]; then
- cur="/ib/live/mount/persistence/${cur}"
+ cur="/lib/live/mount/persistence/${cur}"
else
- cur="/ib/live/mount/persistence/boot/${topdir}/rw/${cur}"
+ cur="/lib/live/mount/persistence/boot/${topdir}/rw/${cur}"
fi
reply=( $(compgen -f ${cur}) )
# for loop from _filedirs() in /etc/bash_completion
diff --git a/functions/interpreter/vyatta-op-run b/functions/interpreter/vyatta-op-run
index ee4cb1c..6bf6645 100644
--- a/functions/interpreter/vyatta-op-run
+++ b/functions/interpreter/vyatta-op-run
@@ -218,7 +218,9 @@ _vyatta_op_run ()
local run_cmd=$(_vyatta_op_get_node_def_field $tpath/node.def run)
run_cmd=$(_vyatta_op_conv_run_cmd "$run_cmd") # convert the positional parameters
local ret=0
- local cmd_regex="^(LESSOPEN=|less|pager|tail|/opt/vyatta/bin/vyatta-tshark-interface-port.pl).*"
+ # Exception for the `show file` command
+ local file_cmd='\$\{vyos_op_scripts_dir\}\/file\.py'
+ local cmd_regex="^(LESSOPEN=|less|pager|tail|(sudo )?$file_cmd).*"
if [ -n "$run_cmd" ]; then
eval $restore_shopts
if [[ -t 1 && "${args[1]}" == "show" && ! $run_cmd =~ $cmd_regex ]] ; then