summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorJohn Southworth <john.southworth@vyatta.com>2011-05-03 12:46:36 -0500
committerJohn Southworth <john.southworth@vyatta.com>2011-05-03 12:46:36 -0500
commiteec79ba0b96caefa3579439b70c71c9656694205 (patch)
tree2146f696241d9a0fa7c5fe3b5addbe54489de42a
parent9e63d55a7bc21a92f0cbb23ad551fb06b51b3b91 (diff)
downloadvyatta-op-eec79ba0b96caefa3579439b70c71c9656694205.tar.gz
vyatta-op-eec79ba0b96caefa3579439b70c71c9656694205.zip
Change behavior of image tools as per discussion in design meeting
* Copy and delete are simplier * 'update config' has been moved to 'clone system config'
-rwxr-xr-xscripts/vyatta-image-tools.pl36
-rw-r--r--templates/clone/system/config/node.def1
-rw-r--r--templates/clone/system/config/node.tag/from/node.def1
-rw-r--r--templates/clone/system/config/node.tag/from/node.tag/node.def (renamed from templates/update/config/node.tag/from/node.tag/node.def)2
-rw-r--r--templates/clone/system/config/node.tag/node.def (renamed from templates/update/config/node.tag/node.def)2
-rw-r--r--templates/update/config/node.def1
-rw-r--r--templates/update/config/node.tag/from/node.def1
7 files changed, 8 insertions, 36 deletions
diff --git a/scripts/vyatta-image-tools.pl b/scripts/vyatta-image-tools.pl
index 946d817..66731b4 100755
--- a/scripts/vyatta-image-tools.pl
+++ b/scripts/vyatta-image-tools.pl
@@ -80,19 +80,9 @@ sub delete_file {
}
if (-d $file){
my $print_dir = conv_file_to_rel($topdir,$file);
- print "This is a directory. Would you like to delete:\n"
- ." Entire directory (D)\n"
- ." Files in directory (F): ";
- my $answer = <>;
- if ($answer =~ /F|f/){
- system("rm -rf $file/*");
- } elsif ($answer =~ /D|d/){
- if (y_or_n("Do you want to erase the entire $print_dir directory?")){
- system("rm -rf $file");
- print("Directory erased\n");
- }
- } else {
- print "Unsupported operation\n";
+ 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);
@@ -154,27 +144,9 @@ sub copy {
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);
- print "Directory exists. Would you like to:\n"
- ." Merge (M)\n"
- ." Overwrite (O)\n"
- ." Create subdirectory (S): ";
- my $answer = <>;
- if ($answer =~ /M|m/){
+ if (y_or_n("This directory exists; would you like to merge?")){
rsync($from, $to);
- } elsif ($answer =~ /O|o/){
- system("rm -rf $to");
- rsync($from, $to);
- } elsif ($answer =~ /S|s/){
- $from =~ /.*\/(.*?)\//;
- my $from_lastdir = $1;
- copy($from, "$to/$from_lastdir");
- } else {
- print "Unsupported operation\n";
}
- } else {
- rsync($from, $to);
}
}
diff --git a/templates/clone/system/config/node.def b/templates/clone/system/config/node.def
new file mode 100644
index 0000000..0b1b387
--- /dev/null
+++ b/templates/clone/system/config/node.def
@@ -0,0 +1 @@
+help: Clone system configuration
diff --git a/templates/clone/system/config/node.tag/from/node.def b/templates/clone/system/config/node.tag/from/node.def
new file mode 100644
index 0000000..6c2682c
--- /dev/null
+++ b/templates/clone/system/config/node.tag/from/node.def
@@ -0,0 +1 @@
+help: Image to clone from
diff --git a/templates/update/config/node.tag/from/node.tag/node.def b/templates/clone/system/config/node.tag/from/node.tag/node.def
index d540b9c..d099dc8 100644
--- a/templates/update/config/node.tag/from/node.tag/node.def
+++ b/templates/clone/system/config/node.tag/from/node.tag/node.def
@@ -7,4 +7,4 @@ allowed: reply=( $(compgen -f /live/image/boot/ | grep -v grub) )
done
reply+=( "running://" )
echo "${reply[*]}"
-run: sudo ${vyatta_sbindir}/vyatta-image-tools.pl --update $3 $5
+run: sudo ${vyatta_sbindir}/vyatta-image-tools.pl --update $4 $6
diff --git a/templates/update/config/node.tag/node.def b/templates/clone/system/config/node.tag/node.def
index 8a4a2eb..415b665 100644
--- a/templates/update/config/node.tag/node.def
+++ b/templates/clone/system/config/node.tag/node.def
@@ -7,4 +7,4 @@ allowed: reply=( $(compgen -f /live/image/boot/ | grep -v grub) )
done
reply+=( "running://" )
echo "${reply[*]}"
-run: sudo ${vyatta_sbindir}/vyatta-image-tools.pl --updateone $3
+run: sudo ${vyatta_sbindir}/vyatta-image-tools.pl --updateone $4
diff --git a/templates/update/config/node.def b/templates/update/config/node.def
deleted file mode 100644
index 4bf41da..0000000
--- a/templates/update/config/node.def
+++ /dev/null
@@ -1 +0,0 @@
-help: Update image config
diff --git a/templates/update/config/node.tag/from/node.def b/templates/update/config/node.tag/from/node.def
deleted file mode 100644
index 413f817..0000000
--- a/templates/update/config/node.tag/from/node.def
+++ /dev/null
@@ -1 +0,0 @@
-help: Image to update from