mirror of
https://github.com/YunoHost-Apps/roundcube_ynh.git
synced 2024-09-03 20:16:28 +02:00
45 lines
1.5 KiB
Diff
45 lines
1.5 KiB
Diff
--- a/bin/installto.sh 2016-03-30 15:46:11.686447589 +0200
|
|
+++ b/bin/installto.sh 2016-03-30 15:49:27.184064426 +0200
|
|
@@ -23,6 +23,9 @@
|
|
|
|
require_once INSTALL_PATH . 'program/include/clisetup.php';
|
|
|
|
+// get arguments
|
|
+$opts = rcube_utils::get_opt(array('f' => 'force', 'y' => 'accept'));
|
|
+
|
|
$target_dir = unslashify($_SERVER['argv'][1]);
|
|
|
|
if (empty($target_dir) || !is_dir(realpath($target_dir)))
|
|
@@ -35,13 +38,15 @@
|
|
|
|
$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') {
|
|
$err = false;
|
|
echo "Copying files to target location...";
|
|
$dirs = array('program','installer','bin','SQL','plugins','skins');
|
|
@@ -77,7 +82,11 @@
|
|
|
|
if (!$err) {
|
|
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";
|
|
}
|
|
}
|