--- a/bin/installto.sh +++ b/bin/installto.sh @@ -38,13 +38,15 @@ if (!preg_match('/define\(.RCMAIL_VERSION.,\s*.([0-9.]+[a-z-]*)/', $iniset, $m)) $oldversion = $m[1]; -if (version_compare(version_parse($oldversion), version_parse(RCMAIL_VERSION), '>=')) +if (version_compare(version_parse($oldversion), version_parse(RCMAIL_VERSION), '>=') && !opts['force']) rcube::raise_error("Installation at target location is up-to-date!", false, true); -echo "Upgrading from $oldversion. Do you want to continue? (y/N)\n"; -$input = trim(fgets(STDIN)); +if (!opts['accept']) { + echo "Upgrading from $oldversion. Do you want to continue? (y/N)\n"; + $input = trim(fgets(STDIN)); +} -if (strtolower($input) == 'y') { +if ($opts['accept'] || strtolower($input) == 'y') { echo "Copying files to target location..."; // Save a copy of original .htaccess file (#1490623) @@ -99,7 +101,11 @@ if (strtolower($input) == 'y') { } echo "Running update script at target...\n"; - system("cd $target_dir && php bin/update.sh --version=$oldversion"); + $command = "cd $target_dir && php bin/update.sh --version=$oldversion"; + if ($opts['accept']) { + $command .= " --accept"; + } + system($command); echo "All done.\n"; } else {