summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorJohn Southworth <john.southworth@vyatta.com>2011-06-28 11:32:51 -0500
committerJohn Southworth <john.southworth@vyatta.com>2011-06-28 11:32:51 -0500
commit296c15ab9819d01948f719cc09c1afd4e4265eca (patch)
treee181f18047c8f4148408121253d98ce42a339a4c
parent7047a00b552d83464a0a0e78285379098b75bf14 (diff)
downloadvyatta-op-296c15ab9819d01948f719cc09c1afd4e4265eca.tar.gz
vyatta-op-296c15ab9819d01948f719cc09c1afd4e4265eca.zip
Add a disk-install uri for old disk based installs in image tools
-rw-r--r--etc/bash_completion.d/vyatta-op12
-rwxr-xr-xscripts/vyatta-image-tools.pl8
-rw-r--r--templates/clone/system/config/node.tag/from/node.tag/node.def3
-rw-r--r--templates/clone/system/config/node.tag/node.def1
4 files changed, 23 insertions, 1 deletions
diff --git a/etc/bash_completion.d/vyatta-op b/etc/bash_completion.d/vyatta-op
index 7a33563..081e8a6 100644
--- a/etc/bash_completion.d/vyatta-op
+++ b/etc/bash_completion.d/vyatta-op
@@ -471,6 +471,9 @@ _vyatta_image_path_complete()
reply[$i]="${reply[$i]}://config/"
done
reply+=( "running://config/" )
+ if [[ -d /live/image/opt/vyatta/etc/config || -d /live/image/config ]]; then
+ reply+=( "disk-install://config/" )
+ fi
else
if ! [[ $cur =~ .*:\/\/ ]]; then
if [[ $cur =~ .*:\/ ]]; then
@@ -480,8 +483,11 @@ _vyatta_image_path_complete()
cur=${cur/:/}
fi
local isrunningimg=$(compgen -W "running" -- ${cur})
+ local isdiskinstall=$(compgen -W "disk-install" -- ${cur})
if [[ $isrunningimg == "running" ]];then
cur="/"
+ elif [[ $isdiskinstall == "disk-install" ]]; then
+ cur="/live/image/"
else
cur="/live/image/boot/${cur}"
fi
@@ -490,6 +496,8 @@ _vyatta_image_path_complete()
file=${reply[$i]}
if [[ $isrunningimg == "running" ]];then
reply[$i]="running://config/"
+ elif [[ $isdiskinstall == "disk-install" ]]; then
+ reply[$i]="disk-install://config/"
else
reply[$i]=${file/#\/live\/image\/boot\//}
if [[ -d /live/image/boot/${reply[$i]} ]]; then
@@ -503,6 +511,8 @@ _vyatta_image_path_complete()
cur=${cur#$topdir//}
if [[ $topdir == "running" ]]; then
cur="/${cur}"
+ elif [[ $topdir == "disk-install" ]]; then
+ cur="/live/image/${cur}"
else
cur="/live/image/boot/${topdir}/live-rw/${cur}"
fi
@@ -524,6 +534,8 @@ _vyatta_image_path_complete()
file=${reply[$i]}
if [[ $topdir == "running" ]]; then
reply[$i]=${file/#\//"$topdir://"}
+ elif [[ $topdir == "disk-install" ]]; then
+ reply[$i]=${file/#\/live\/image\//$"$topdir://"}
else
reply[$i]=${file/#\/live\/image\/boot\/$topdir/"$topdir://"}
reply[$i]=${reply[$i]/\/live-rw\/}
diff --git a/scripts/vyatta-image-tools.pl b/scripts/vyatta-image-tools.pl
index 1fd139c..2edeb10 100755
--- a/scripts/vyatta-image-tools.pl
+++ b/scripts/vyatta-image-tools.pl
@@ -46,6 +46,8 @@ sub conv_file {
}
if ( $topdir eq "running" ) {
$file = "/$file";
+ } elsif ( lc($topdir) eq 'disk-install' ) {
+ $file = "/live/image/$file";
} elsif ( lc($topdir) eq 'tftp') {
$file = $filein;
$topdir = 'url';
@@ -72,6 +74,8 @@ sub conv_file_to_rel {
my ($topdir, $filename) = @_;
if ($topdir eq "running"){
$filename =~ s?/?$topdir://?;
+ } elsif ($topdir eq "disk-install") {
+ $filename =~ s?/live/image/?$topdir://?;
} else {
$filename =~ s?/live/image/boot/$topdir/live-rw/?$topdir://?;
}
@@ -175,6 +179,10 @@ sub update {
print "Cannot clone to running\n";
exit 1;
}
+ if ($t_topdir eq 'disk-install'){
+ print "Cannot clone to running\n";
+ exit 1;
+ }
if ($t_topdir eq 'url'){
print "Cannot clone to a url\n";
exit 1;
diff --git a/templates/clone/system/config/node.tag/from/node.tag/node.def b/templates/clone/system/config/node.tag/from/node.tag/node.def
index 42ef94e..6061efd 100644
--- a/templates/clone/system/config/node.tag/from/node.tag/node.def
+++ b/templates/clone/system/config/node.tag/from/node.tag/node.def
@@ -6,6 +6,9 @@ allowed: reply=( $(compgen -f /live/image/boot/ | grep -v grub) )
reply[$i]="${reply[$i]}://"
done
reply+=( "running://" )
+ if [[ -d /live/image/config ]];then
+ reply+=( "disk-install://" )
+ fi
echo "${reply[*]}"
run: if [ "$VYATTA_USER_LEVEL_DIR" == "/opt/vyatta/etc/shell/level/admin" ];
then
diff --git a/templates/clone/system/config/node.tag/node.def b/templates/clone/system/config/node.tag/node.def
index d54a4cf..d4a04c0 100644
--- a/templates/clone/system/config/node.tag/node.def
+++ b/templates/clone/system/config/node.tag/node.def
@@ -5,7 +5,6 @@ allowed: reply=( $(compgen -f /live/image/boot/ | grep -v grub) )
reply[$i]=${file/#\/live\/image\/boot\//}
reply[$i]="${reply[$i]}://"
done
- reply+=( "running://" )
echo "${reply[*]}"
run: if [ "$VYATTA_USER_LEVEL_DIR" == "/opt/vyatta/etc/shell/level/admin" ];
then