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
Jérôme Lebleu eb43d2e8c5 [enh] Initial commit for new app based on Kloadut/roundcube_ynh
Since sources where included in the last YunoHost app package, this
rebase is intended to have a lighter git repository.
2016-05-19 19:49:47 +02:00

32 lines
1.2 KiB
Diff

--- a/bin/installto.sh 2016-03-26 19:17:32.092002076 +0100
+++ b/bin/installto.sh 2016-03-26 19:26:37.787511189 +0100
@@ -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');