summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorJohn Southworth <john.southworth@vyatta.com>2011-05-27 11:26:30 -0700
committerJohn Southworth <john.southworth@vyatta.com>2011-05-27 11:26:30 -0700
commitc7885e380a3d7c7f19bfa7866a59629f105c4d31 (patch)
treecc9bd27cef1bea5f7ce61932f0c1a90784295cfa
parentb08c1b62183466d4a9d3f709c911c66c01b4f2a6 (diff)
downloadvyatta-op-c7885e380a3d7c7f19bfa7866a59629f105c4d31.tar.gz
vyatta-op-c7885e380a3d7c7f19bfa7866a59629f105c4d31.zip
Bugfix: 7091 make clone restore old config directory if it fails
-rwxr-xr-xscripts/vyatta-image-tools.pl6
1 files changed, 5 insertions, 1 deletions
diff --git a/scripts/vyatta-image-tools.pl b/scripts/vyatta-image-tools.pl
index 4eaf7bb..79627bc 100755
--- a/scripts/vyatta-image-tools.pl
+++ b/scripts/vyatta-image-tools.pl
@@ -185,13 +185,17 @@ sub update {
if (y_or_n("$msg")){
system("rm -rf $to/config.preclone");
system("mv $to/config $to/config.preclone") if ( -d "$to/config" );
- rsync("$from/config", $to);
+ if (rsync("$from/config", $to) > 0){
+ print "Clone Failed!\nRestoring old config\n";
+ system("mv $to/config.preclone $to/config");
+ }
}
}
sub rsync {
my ($from,$to) = @_;
system("rsync -a --progress --exclude '.wh.*' $from $to");
+ return $?;
}
sub curl_to {