summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorJohn Southworth <john.southworth@vyatta.com>2011-04-23 12:48:18 -0700
committerJohn Southworth <john.southworth@vyatta.com>2011-04-23 12:48:18 -0700
commit1d0cd8922bab1d8d53b886b8287baeb22979d087 (patch)
treef01a00eb1e79279a06395a9d718508015da3a18b
parent17e28be540ef15c57d11b07cb8b9ad1365163078 (diff)
downloadvyatta-op-1d0cd8922bab1d8d53b886b8287baeb22979d087.tar.gz
vyatta-op-1d0cd8922bab1d8d53b886b8287baeb22979d087.zip
Initial addition of image op mode tools
-rw-r--r--Makefile.am2
-rw-r--r--etc/bash_completion.d/vyatta-op167
-rwxr-xr-xscripts/vyatta-image-tools.pl171
-rwxr-xr-xscripts/vyatta-op-cmd-wrapper5
-rw-r--r--templates/copy/files/node.def1
-rw-r--r--templates/copy/files/node.tag/node.def3
-rw-r--r--templates/copy/files/node.tag/to/node.def1
-rw-r--r--templates/copy/files/node.tag/to/node.tag/node.def4
-rw-r--r--templates/copy/node.def1
-rw-r--r--templates/delete/files/node.def1
-rw-r--r--templates/delete/files/node.tag/node.def4
-rw-r--r--templates/show/files/node.def2
-rw-r--r--templates/show/files/node.tag/node.def5
-rw-r--r--templates/show/log/image/node.def1
-rw-r--r--templates/show/log/image/node.tag/all/node.def5
-rw-r--r--templates/show/log/image/node.tag/authorization/node.def4
-rw-r--r--templates/show/log/image/node.tag/directory/node.def4
-rw-r--r--templates/show/log/image/node.tag/file/node.def2
-rw-r--r--templates/show/log/image/node.tag/file/node.tag/node.def7
-rw-r--r--templates/show/log/image/node.tag/node.def11
-rw-r--r--templates/update/config/node.def1
-rw-r--r--templates/update/config/node.tag/from/node.def1
-rw-r--r--templates/update/config/node.tag/from/node.tag/node.def10
-rw-r--r--templates/update/config/node.tag/node.def10
24 files changed, 411 insertions, 12 deletions
diff --git a/Makefile.am b/Makefile.am
index 7ad4452..9cc17b4 100644
--- a/Makefile.am
+++ b/Makefile.am
@@ -31,8 +31,10 @@ bin_SCRIPTS += scripts/show-image-storage.pl
bin_SCRIPTS += scripts/vyatta-remote-copy.pl
bin_SCRIPTS += scripts/vyatta-show-current-user
bin_SCRIPTS += scripts/tech-support-archive
+bin_SCRIPTS += scripts/vyatta-op-cmd-wrapper
sbin_SCRIPTS = scripts/dhcpv6-client-show-leases.pl
+sbin_SCRIPTS = scripts/vyatta-image-tools.pl
bin_sudo_users_SCRIPTS = scripts/vyatta-identify-interface.pl
bin_sudo_users_SCRIPTS += scripts/vyatta-delete-log-file.sh
diff --git a/etc/bash_completion.d/vyatta-op b/etc/bash_completion.d/vyatta-op
index aa516bc..a1b7097 100644
--- a/etc/bash_completion.d/vyatta-op
+++ b/etc/bash_completion.d/vyatta-op
@@ -65,6 +65,8 @@ declare _vyatta_op_last_comp=${_vyatta_op_last_comp_init}
declare _vyatta_op_node_path
declare -a _vyatta_op_noncompletions _vyatta_op_completions
declare -x -a _vyatta_pipe_noncompletions _vyatta_pipe_completions
+declare _vyatta_comptype
+declare -x -a reply
source /etc/bash_completion.d/vyatta-op-run
@@ -237,6 +239,8 @@ _vyatta_op_expand ()
local restore_shopts=$( shopt -p extglob nullglob | tr \\n \; )
shopt -s extglob nullglob
local cur=""
+ local _has_comptype=0
+ _vyatta_comptype=""
if (( ${#COMP_WORDS[@]} > 0 )); then
cur=${COMP_WORDS[COMP_CWORD]}
@@ -256,7 +260,7 @@ _vyatta_op_expand ()
eval "$restore_shopts"
return
fi
-
+
if [ "${COMP_WORDS[*]}" != "$_vyatta_op_last_comp" ] ; then
if ! _vyatta_op_set_node_path ; then
echo -e \\a
@@ -264,10 +268,23 @@ _vyatta_op_expand ()
eval "$restore_shopts"
return 1
fi
- _vyatta_op_set_completions
+ _vyatta_set_comptype
+ case $_vyatta_comptype in
+ 'imagefiles')
+ _has_comptype=1
+ _vyatta_image_file_complete
+ ;;
+ *)
+ _has_comptype=0
+ _vyatta_op_set_completions
+ ;;
+ esac
+ fi
+ if [[ $_has_comptype == 1 ]]; then
+ COMPREPLY=( "${_vyatta_op_completions[@]}" )
+ else
+ COMPREPLY=($( compgen -W "${_vyatta_op_completions[*]}" -- $cur ))
fi
-
- COMPREPLY=($( compgen -W "${_vyatta_op_completions[*]}" -- $cur ))
# if the last command line arg is empty and we have
# an empty completion option (meaning wild card),
@@ -285,11 +302,11 @@ _vyatta_op_expand ()
fi
if [ "${COMP_WORDS[*]}" == "$_vyatta_op_last_comp" ] ; then
- _vyatta_op_help "$cur" \
- ${_vyatta_op_noncompletions[@]} \
- ${_vyatta_op_completions[@]} \
- | ${VYATTA_PAGER:-cat}
- COMPREPLY=( "" " " )
+ _vyatta_op_help "$cur" \
+ ${_vyatta_op_noncompletions[@]} \
+ ${_vyatta_op_completions[@]} \
+ | ${VYATTA_PAGER:-cat}
+ COMPREPLY=( "" " " )
_vyatta_op_last_comp=${_vyatta_op_last_comp_init}
else
_vyatta_op_last_comp="${COMP_WORDS[*]}"
@@ -388,6 +405,138 @@ _vyatta_pipe_completion ()
return 0
}
+# comptype
+_vyatta_set_comptype ()
+{
+ local comptype
+ unset _vyatta_comptype
+ for ndef in ${_vyatta_op_node_path}/*/node.def ; do
+ if [[ $ndef == */node.tag/node.def ]] ; then
+ local comptype=$( _vyatta_op_get_node_def_field $ndef comptype )
+ if [[ $comptype == "imagefiles" ]] ; then
+ _vyatta_comptype=$comptype
+ return 0
+ else
+ _vyatta_comptype=""
+ return 1
+ fi
+ else
+ _vyatta_comptype=""
+ return 1
+ fi
+ done
+}
+
+_vyatta_image_is_file()
+{
+ local cur=$1
+ cur=${cur/:/}
+ topdir=${cur%%/*}
+ cur=${cur#$topdir/}
+ if [[ $topdir == "running" ]]; then
+ cur="/${cur}"
+ else
+ cur="/live/image/boot/${topdir}/live-rw/${cur}"
+ fi
+ if [[ -f ${cur} ]]; then
+ return 0;
+ else
+ return 1;
+ fi
+}
+
+_vyatta_image_file_complete()
+{
+ if _vyatta_image_is_file ${COMP_WORDS[(( ${#COMP_WORDS[@]}-2 ))]}; then
+ _vyatta_op_completions=( "" " " )
+ return 0;
+ fi
+ _vyatta_image_path_complete
+}
+
+_vyatta_image_path_complete()
+{
+ compopt -o nospace
+ local -a reply
+ if _vyatta_image_is_file $cur ; then
+ foundfile=1
+ _vyatta_op_completions=( "${cur} " )
+ return 0;
+ fi
+ if [[ ${cur} == "" ]]; then
+ reply=( $(compgen -f /live/image/boot/ | grep -v grub) )
+ for i in `seq 0 $[${#reply[@]}-1]`; do
+ file=${reply[$i]}
+ reply[$i]=${file/#\/live\/image\/boot\//}
+ reply[$i]="${reply[$i]}://config/"
+ done
+ reply+=( "running://config/" )
+ else
+ if ! [[ $cur =~ .*:\/\/ ]]; then
+ if [[ $cur =~ .*:\/ ]]; then
+ cur=${cur/:\//}
+ fi
+ if [[ $cur =~ .*: ]]; then
+ cur=${cur/:/}
+ fi
+ local isrunningimg=$(compgen -W "running" -- ${cur})
+ if [[ $isrunningimg == "running" ]];then
+ cur="/"
+ else
+ cur="/live/image/boot/${cur}"
+ fi
+ reply=( $(compgen -f ${cur}) )
+ for i in `seq 0 $[${#reply[@]}-1]`; do
+ file=${reply[$i]}
+ if [[ $isrunningimg == "running" ]];then
+ reply[$i]="running://config/"
+ else
+ reply[$i]=${file/#\/live\/image\/boot\//}
+ if [[ -d /live/image/boot/${reply[$i]} ]]; then
+ reply[$i]="${reply[$i]/#\//}://config/"
+ fi
+ fi
+ done
+ else
+ cur=${cur/:/}
+ topdir=${cur%%/*}
+ cur=${cur#$topdir//}
+ if [[ $topdir == "running" ]]; then
+ cur="/${cur}"
+ else
+ cur="/live/image/boot/${topdir}/live-rw/${cur}"
+ fi
+ reply=( $(compgen -f ${cur}) )
+ # for loop from _filedirs() in /etc/bash_completion
+ for ((i=0; i < ${#reply[@]}; i++)); do
+ if [[ ${cur:0:1} != "'" ]]; then
+ [[ -d ${reply[i]} ]] && reply[i]="${reply[i]}"/
+ if [[ ${cur:0:1} == '"' ]]; then
+ reply[i]=${reply[i]//\\/\\\\}
+ reply[i]=${reply[i]//\"/\\\"}
+ reply[i]=${reply[i]//\$/\\\$}
+ else
+ reply[i]=$(printf %q ${reply[i]})
+ fi
+ fi
+ done
+ for i in `seq 0 $[${#reply[@]}-1]`; do
+ file=${reply[$i]}
+ if [[ $topdir == "running" ]]; then
+ reply[$i]=${file/#\//"$topdir://"}
+ else
+ reply[$i]=${file/#\/live\/image\/boot\/$topdir/"$topdir://"}
+ reply[$i]=${reply[$i]/\/live-rw\/}
+ fi
+ done
+ fi
+ fi
+ _vyatta_op_completions=( "${reply[@]}" )
+ return 0
+}
+
+
+
nullglob_save=$( shopt -p nullglob )
shopt -s nullglob
for f in ${vyatta_datadir}/vyatta-op/functions/allowed/* ; do
diff --git a/scripts/vyatta-image-tools.pl b/scripts/vyatta-image-tools.pl
new file mode 100755
index 0000000..abb0090
--- /dev/null
+++ b/scripts/vyatta-image-tools.pl
@@ -0,0 +1,171 @@
+#!/usr/bin/perl -w
+use Getopt::Long;
+use lib "/opt/vyatta/share/perl5/";
+
+use strict;
+
+my ($show, $delete, $updateone);
+my @copy;
+my @update;
+
+GetOptions("show=s" => \$show,
+ "delete=s" => \$delete,
+ "update=s{2}" => \@update,
+ "updateone=s" => \$updateone,
+ "copy=s{2}" => \@copy);
+
+if (defined $show){
+ show($show);
+}
+if (defined $delete){
+ delete_file($delete);
+}
+if (@update){
+ update(@update);
+}
+if (defined($updateone)){
+ update($updateone, "running://");
+}
+if (@copy){
+ copy(@copy);
+}
+
+sub conv_file {
+ my $file = " ";
+ $file = pop(@_);
+ $file =~ s/://;
+ $file =~ /(.+?)\/\/(.*)/;
+ my $topdir = $1;
+ $file = $2;
+ if ( $topdir eq "running" ) {
+ $file = "/$file";
+ } else {
+ $file = "/live/image/boot/$topdir/live-rw/$file";
+ }
+ return ($topdir, $file);
+}
+
+sub conv_file_to_rel {
+ my ($topdir, $filename) = @_;
+ if ($topdir eq "running"){
+ $filename =~ s?/?$topdir://?;
+ } else {
+ $filename =~ s?/live/image/boot/$topdir/live-rw/?$topdir://?;
+ }
+ return $filename;
+}
+
+sub delete_file {
+ my ($file) = @_;
+ (my $topdir, $file) = conv_file($file);
+ if (-d $file){
+ my $print_dir = conv_file_to_rel($topdir,$file);
+ if (y_or_n("Do you want to erase the entire $print_dir directory?")){
+ system("rm -rf $file");
+ print("Directory erased\n");
+ }
+ } elsif (-f $file) {
+ my $print_file = conv_file_to_rel($topdir,$file);
+ if (y_or_n("Do you want to erase the $print_file file?")){
+ system("rm -rf $file");
+ print("File erased\n");
+ }
+ }
+}
+
+sub copy {
+ my ($from, $to) = @_;
+ my ($f_topdir, $t_topdir);
+ ($f_topdir, $from) = conv_file($from);
+ ($t_topdir, $to) = conv_file($to);
+ $from =~ /.*\/(.*)/;
+ my $from_file = $1;
+ if ( -d $from && -e $to && !( -d $to ) ){
+ print "Cannot copy a directory to a file.\n";
+ return 1;
+ } elsif ( -f $to || (-d $to && -f "$to/$from_file") ) {
+ if (y_or_n("This file exists; overwrite if needed?")){
+ rsync($from, $to);
+ }
+ } elsif ( -d $to && -d $from ){
+ my $print_from = conv_file_to_rel($f_topdir, $from);
+ my $print_to = conv_file_to_rel($t_topdir, $to);
+ if (y_or_n("Merge directory $print_from with $print_to?")){
+ rsync($from, $to);
+ }
+ } else {
+ rsync($from, $to);
+ }
+}
+
+sub update {
+ my ($to, $from) = @_;
+ my ($t_topdir, $f_topdir);
+ ($f_topdir, $from) = conv_file($from);
+ ($t_topdir, $to) = conv_file($to);
+ my $print_from = conv_file_to_rel($f_topdir, $from);
+ my $print_to = conv_file_to_rel($t_topdir, $to);
+ my $msg = "WARNING: This is a destructive copy of the /config directories\n"
+ . "This will erase all data in the ".$print_to."config directory\n"
+ . "This data will be replaced with the data from $print_from\n"
+ . "Do you wish to continue?";
+ if (y_or_n("$msg")){
+ system("rm -rf $to/config");
+ rsync("$from/config", $to);
+ }
+}
+
+sub rsync {
+ my ($from,$to) = @_;
+ system("rsync -av --progress $from $to");
+}
+
+sub y_or_n {
+ my ($msg) = @_;
+ print "$msg (Y/N): ";
+ my $input = <>;
+ return 1 if ($input =~ /Y|y/);
+ return 0;
+}
+
+sub show {
+ my ($topdir, $file) = conv_file(pop(@_));
+ my $output = "";
+ if ( -d $file ) {
+ print "########### DIRECTORY LISTING ###########\n";
+ system("ls -lGph --group-directories-first $file");
+ } elsif ( -T $file ) {
+ print "########### FILE INFO ###########\n";
+ my $filename = conv_file_to_rel($topdir, $file);
+ print "File Name: $filename\n";
+ print "Text File: \n";
+ my $lsstr = `ls -lGh $file`;
+ parsels($lsstr);
+ print " Description:\t";
+ system("file -sb $file");
+ print "\n########### FILE DATA ###########\n";
+ system("cat $file");
+ } elsif ( -B $file ) {
+ print "########### FILE INFO ###########\n";
+ my $filename = conv_file_to_rel($topdir, $file);
+ print "File Name: $filename\n";
+ print "Binary File: \n";
+ my $lsstr = `ls -lGh $file`;
+ parsels($lsstr);
+ print " Description:\t";
+ system("file -sb $file");
+ print "\n########### FILE DATA ###########\n";
+ system("hexdump -C $file| less");
+ } else {
+ print "File Not Found\n";
+ }
+}
+
+sub parsels {
+ my $lsout = pop(@_);
+ my @ls = split(' ', $lsout);
+ print " Permissions: $ls[0]\n";
+ print " Owner:\t$ls[2]\n";
+ print " Size:\t\t$ls[3]\n";
+ print " Modified:\t$ls[4] $ls[5] $ls[6]\n";
+}
diff --git a/scripts/vyatta-op-cmd-wrapper b/scripts/vyatta-op-cmd-wrapper
new file mode 100755
index 0000000..6610afd
--- /dev/null
+++ b/scripts/vyatta-op-cmd-wrapper
@@ -0,0 +1,5 @@
+#!/bin/vbash -l
+VYATTA_USER_LEVEL_DIR=/opt/vyatta/etc/shell/level/admin
+source /etc/default/vyatta
+source /etc/bash_completion.d/vyatta-op-run
+_vyatta_op_run $@
diff --git a/templates/copy/files/node.def b/templates/copy/files/node.def
new file mode 100644
index 0000000..e1b2447
--- /dev/null
+++ b/templates/copy/files/node.def
@@ -0,0 +1 @@
+help: Copy files
diff --git a/templates/copy/files/node.tag/node.def b/templates/copy/files/node.tag/node.def
new file mode 100644
index 0000000..8df0e7c
--- /dev/null
+++ b/templates/copy/files/node.tag/node.def
@@ -0,0 +1,3 @@
+help: Directory to copy files from
+comptype: imagefiles
+allowed: echo -n "<imagefiles>"
diff --git a/templates/copy/files/node.tag/to/node.def b/templates/copy/files/node.tag/to/node.def
new file mode 100644
index 0000000..21f3ade
--- /dev/null
+++ b/templates/copy/files/node.tag/to/node.def
@@ -0,0 +1 @@
+help: Path to copy into
diff --git a/templates/copy/files/node.tag/to/node.tag/node.def b/templates/copy/files/node.tag/to/node.tag/node.def
new file mode 100644
index 0000000..751783b
--- /dev/null
+++ b/templates/copy/files/node.tag/to/node.tag/node.def
@@ -0,0 +1,4 @@
+help: Directory to copy files to
+comptype: imagefiles
+allowed: echo -n "<imagefiles>"
+run: sudo ${vyatta_sbindir}/vyatta-image-tools.pl --copy $3 $5
diff --git a/templates/copy/node.def b/templates/copy/node.def
new file mode 100644
index 0000000..9557b10
--- /dev/null
+++ b/templates/copy/node.def
@@ -0,0 +1 @@
+help: Copy data
diff --git a/templates/delete/files/node.def b/templates/delete/files/node.def
new file mode 100644
index 0000000..92c8f6c
--- /dev/null
+++ b/templates/delete/files/node.def
@@ -0,0 +1 @@
+help: Delete files in a particular image
diff --git a/templates/delete/files/node.tag/node.def b/templates/delete/files/node.tag/node.def
new file mode 100644
index 0000000..715ba48
--- /dev/null
+++ b/templates/delete/files/node.tag/node.def
@@ -0,0 +1,4 @@
+help: Delete files in the specified directory
+comptype: imagefiles
+allowed: echo -n "<imagefiles>"
+run: sudo ${vyatta_sbindir}/vyatta-image-tools.pl --delete=$3
diff --git a/templates/show/files/node.def b/templates/show/files/node.def
index 7f9efd0..a6c408d 100644
--- a/templates/show/files/node.def
+++ b/templates/show/files/node.def
@@ -1 +1 @@
-help: Show file information
+help: Show files for a particular image
diff --git a/templates/show/files/node.tag/node.def b/templates/show/files/node.tag/node.def
index 0448ad4..7e205da 100644
--- a/templates/show/files/node.tag/node.def
+++ b/templates/show/files/node.tag/node.def
@@ -1,3 +1,4 @@
help: Show files in the specified directory
-allowed: echo -n '<pathname>'
-run: ls -lh "$3"
+comptype: imagefiles
+allowed: echo -n "<imagefiles>"
+run: sudo ${vyatta_sbindir}/vyatta-image-tools.pl --show=$3
diff --git a/templates/show/log/image/node.def b/templates/show/log/image/node.def
new file mode 100644
index 0000000..60b0ab3
--- /dev/null
+++ b/templates/show/log/image/node.def
@@ -0,0 +1 @@
+help: Show logs from an image
diff --git a/templates/show/log/image/node.tag/all/node.def b/templates/show/log/image/node.tag/all/node.def
new file mode 100644
index 0000000..eb3c87c
--- /dev/null
+++ b/templates/show/log/image/node.tag/all/node.def
@@ -0,0 +1,5 @@
+help: Show contents of all master log files for image
+run: eval $(lesspipe)
+ less $_vyatta_less_options \
+ --prompt=".log?m, file %i of %m., page %dt of %D" \
+ -- `printf "%s\n" /live/image/boot/$4/live-rw/var/log/messages* | sort -nr`
diff --git a/templates/show/log/image/node.tag/authorization/node.def b/templates/show/log/image/node.tag/authorization/node.def
new file mode 100644
index 0000000..aec45cc
--- /dev/null
+++ b/templates/show/log/image/node.tag/authorization/node.def
@@ -0,0 +1,4 @@
+help: Show listing of authorization attempts for image
+run: less $_vyatta_less_options \
+ --prompt=".log, page %dt of %D" \
+ -- /live/image/boot/$4/live-rw/var/log/auth.log
diff --git a/templates/show/log/image/node.tag/directory/node.def b/templates/show/log/image/node.tag/directory/node.def
new file mode 100644
index 0000000..d9cb9cb
--- /dev/null
+++ b/templates/show/log/image/node.tag/directory/node.def
@@ -0,0 +1,4 @@
+help: Show listing of user-defined log files for image
+run: if [ -d /live/image/boot/$4/live-rw/var/log/user ]
+ then ls /live/image/boot/$4/live-rw/var/log/user
+ fi
diff --git a/templates/show/log/image/node.tag/file/node.def b/templates/show/log/image/node.tag/file/node.def
new file mode 100644
index 0000000..cad207b
--- /dev/null
+++ b/templates/show/log/image/node.tag/file/node.def
@@ -0,0 +1,2 @@
+help: Show contents of user-defined log file for image
+
diff --git a/templates/show/log/image/node.tag/file/node.tag/node.def b/templates/show/log/image/node.tag/file/node.tag/node.def
new file mode 100644
index 0000000..41c170d
--- /dev/null
+++ b/templates/show/log/image/node.tag/file/node.tag/node.def
@@ -0,0 +1,7 @@
+help: Show contents of specified user-defined log file for image
+allowed: local -a array ;
+ array=( /live/image/boot/$4/live-rw/var/log/user/* ) ;
+ [ ${#array[@]} -gt 0 ] && echo -n ${array[@]##*/} || echo -n none
+run: less $_vyatta_less_options \
+ --prompt=".$4 log, page %dt of %D" \
+ -- /live/image/boot/$4/live-rw/var/log/user/$5
diff --git a/templates/show/log/image/node.tag/node.def b/templates/show/log/image/node.tag/node.def
new file mode 100644
index 0000000..daeb44e
--- /dev/null
+++ b/templates/show/log/image/node.tag/node.def
@@ -0,0 +1,11 @@
+help: Show contents of master log file for image
+allowed: reply=( $(compgen -f /live/image/boot/ | grep -v grub) )
+ for i in `seq 0 $[${#reply[@]}-1]`; do
+ file=${reply[$i]}
+ reply[$i]=${file/#\/live\/image\/boot\//}
+ done
+ echo "${reply[*]}"
+
+run: less $_vyatta_less_options \
+ --prompt=".log, page %dt of %D" \
+ -- /live/image/boot/$4/live-rw/var/log/messages
diff --git a/templates/update/config/node.def b/templates/update/config/node.def
new file mode 100644
index 0000000..4bf41da
--- /dev/null
+++ b/templates/update/config/node.def
@@ -0,0 +1 @@
+help: Update image config
diff --git a/templates/update/config/node.tag/from/node.def b/templates/update/config/node.tag/from/node.def
new file mode 100644
index 0000000..413f817
--- /dev/null
+++ b/templates/update/config/node.tag/from/node.def
@@ -0,0 +1 @@
+help: Image to update from
diff --git a/templates/update/config/node.tag/from/node.tag/node.def b/templates/update/config/node.tag/from/node.tag/node.def
new file mode 100644
index 0000000..d540b9c
--- /dev/null
+++ b/templates/update/config/node.tag/from/node.tag/node.def
@@ -0,0 +1,10 @@
+help: Image to update from
+allowed: reply=( $(compgen -f /live/image/boot/ | grep -v grub) )
+ for i in `seq 0 $[${#reply[@]}-1]`; do
+ file=${reply[$i]}
+ reply[$i]=${file/#\/live\/image\/boot\//}
+ reply[$i]="${reply[$i]}://"
+ done
+ reply+=( "running://" )
+ echo "${reply[*]}"
+run: sudo ${vyatta_sbindir}/vyatta-image-tools.pl --update $3 $5
diff --git a/templates/update/config/node.tag/node.def b/templates/update/config/node.tag/node.def
new file mode 100644
index 0000000..8a4a2eb
--- /dev/null
+++ b/templates/update/config/node.tag/node.def
@@ -0,0 +1,10 @@
+help: Image to update
+allowed: reply=( $(compgen -f /live/image/boot/ | grep -v grub) )
+ for i in `seq 0 $[${#reply[@]}-1]`; do
+ file=${reply[$i]}
+ reply[$i]=${file/#\/live\/image\/boot\//}
+ reply[$i]="${reply[$i]}://"
+ done
+ reply+=( "running://" )
+ echo "${reply[*]}"
+run: sudo ${vyatta_sbindir}/vyatta-image-tools.pl --updateone $3