Fix rsync error handling in installto.sh script (#5562)

pull/135/merge
Aleksander Machniak 8 years ago
parent 68c9b669e4
commit ab429dbef2

@ -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
-------------

@ -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)
@ -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);
}
}
@ -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";
}
?>

Loading…
Cancel
Save