1
0
Fork 0
mirror of https://github.com/YunoHost-Apps/roundcube_ynh.git synced 2024-09-03 20:16:28 +02:00
roundcube_ynh/patches/00-installto-opts.patch
2017-06-18 17:09:53 +02:00

35 lines
1.2 KiB
Diff

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