Skip to content

Commit

Permalink
Fix rsync error handling in installto.sh script (#5562)
Browse files Browse the repository at this point in the history
  • Loading branch information
alecpl committed Dec 23, 2016
1 parent 68c9b66 commit ab429db
Show file tree
Hide file tree
Showing 2 changed files with 13 additions and 14 deletions.
1 change: 1 addition & 0 deletions CHANGELOG
Original file line number Diff line number Diff line change
Expand Up @@ -80,6 +80,7 @@ CHANGELOG Roundcube Webmail
- Fix variable substitution in ldap host for some use-cases, e.g. new_user_identity (#5544)
- Enigma: Fix PHP fatal error when decrypting a message with invalid signature (#5555)
- Fix adding images to new identity signatures
- Fix rsync error handling in installto.sh script (#5562)

RELEASE 1.2.3
-------------
Expand Down
26 changes: 12 additions & 14 deletions bin/installto.sh
Original file line number Diff line number Diff line change
Expand Up @@ -42,7 +42,6 @@ echo "Upgrading from $oldversion. Do you want to continue? (y/N)\n";
$input = trim(fgets(STDIN));

if (strtolower($input) == 'y') {
$err = false;
echo "Copying files to target location...";

// Save a copy of original .htaccess file (#1490623)
Expand All @@ -56,16 +55,16 @@ if (strtolower($input) == 'y') {
}
foreach ($dirs as $dir) {
// @FIXME: should we use --delete for all directories?
$delete = in_array($dir, array('program', 'installer')) ? '--delete ' : '';
if (!system("rsync -avC " . $delete . INSTALL_PATH . "$dir/* $target_dir/$dir/")) {
$err = true;
break;
$delete = in_array($dir, array('program', 'installer')) ? '--delete ' : '';
$command = "rsync -aC --out-format \"%n\" " . $delete . INSTALL_PATH . "$dir/* $target_dir/$dir/";
if (!system($command, $ret) || $ret > 0) {
rcube::raise_error("Failed to execute command: $command", false, true);
}
}
foreach (array('index.php','.htaccess','config/defaults.inc.php','composer.json-dist','CHANGELOG','README.md','UPGRADING','LICENSE','INSTALL') as $file) {
if (!system("rsync -av " . INSTALL_PATH . "$file $target_dir/$file")) {
$err = true;
break;
$command = "rsync -a --out-format \"%n\" " . INSTALL_PATH . "$file $target_dir/$file";
if (file_exists(INSTALL_PATH . $file) && (!system($command, $ret) || $ret > 0)) {
rcube::raise_error("Failed to execute command: $command", false, true);
}
}

Expand Down Expand Up @@ -96,13 +95,12 @@ if (strtolower($input) == 'y') {
echo "done.\n\n";
}

if (!$err) {
echo "Running update script at target...\n";
system("cd $target_dir && php bin/update.sh --version=$oldversion");
echo "All done.\n";
}
echo "Running update script at target...\n";
system("cd $target_dir && php bin/update.sh --version=$oldversion");
echo "All done.\n";
}
else
else {
echo "Update cancelled. See ya!\n";
}

?>

0 comments on commit ab429db

Please sign in to comment.