From c7885e380a3d7c7f19bfa7866a59629f105c4d31 Mon Sep 17 00:00:00 2001 From: John Southworth Date: Fri, 27 May 2011 11:26:30 -0700 Subject: Bugfix: 7091 make clone restore old config directory if it fails --- scripts/vyatta-image-tools.pl | 6 +++++- 1 file changed, 5 insertions(+), 1 deletion(-) (limited to 'scripts') 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 { -- cgit v1.2.3