1
0
Fork 0
mirror of https://github.com/YunoHost-Apps/roundcube_ynh.git synced 2024-09-03 20:16:28 +02:00

[fix] upgrade script

This commit is contained in:
magikcypress 2017-06-18 17:09:53 +02:00
parent d28b39f08e
commit 5a40ea9210
No known key found for this signature in database
GPG key ID: 3B3C7CD61957AC9A
4 changed files with 36 additions and 39 deletions

View file

@ -1,21 +1,11 @@
--- a/bin/installto.sh 2016-03-30 15:46:11.686447589 +0200 --- a/bin/installto.sh
+++ b/bin/installto.sh 2016-03-30 15:49:27.184064426 +0200 +++ b/bin/installto.sh
@@ -23,6 +23,9 @@ @@ -38,13 +38,15 @@ if (!preg_match('/define\(.RCMAIL_VERSION.,\s*.([0-9.]+[a-z-]*)/', $iniset, $m))
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]; $oldversion = $m[1];
-if (version_compare(version_parse($oldversion), version_parse(RCMAIL_VERSION), '>=')) -if (version_compare(version_parse($oldversion), version_parse(RCMAIL_VERSION), '>='))
+if (version_compare(version_parse($oldversion), version_parse(RCMAIL_VERSION), '>=') && !opts['force']) +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); 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"; -echo "Upgrading from $oldversion. Do you want to continue? (y/N)\n";
@ -27,19 +17,19 @@
-if (strtolower($input) == 'y') { -if (strtolower($input) == 'y') {
+if ($opts['accept'] || strtolower($input) == 'y') { +if ($opts['accept'] || strtolower($input) == 'y') {
$err = false;
echo "Copying files to target location..."; echo "Copying files to target location...";
$dirs = array('program','installer','bin','SQL','plugins','skins');
@@ -77,7 +82,11 @@
if (!$err) { // Save a copy of original .htaccess file (#1490623)
echo "Running update script at target...\n"; @@ -99,7 +101,11 @@ if (strtolower($input) == 'y') {
- 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";
} }
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 {

View file

@ -17,6 +17,14 @@ ROUNDCUBE_SOURCE_URL="https://github.com/roundcube/roundcubemail/releases/downlo
# App package root directory should be the parent folder # App package root directory should be the parent folder
PKGDIR=$(cd ../; pwd) PKGDIR=$(cd ../; pwd)
QUIET () { # Redirect standard out into /dev/null
$@ > /dev/null
}
WARNING () { # Writes on the error channel to go into warning.
eval "$@" >&2
}
# #
# Common helpers # Common helpers
# #
@ -37,9 +45,9 @@ extract_roundcube() {
sudo rm "$rc_tarball" sudo rm "$rc_tarball"
# apply patches # apply patches
# (cd "$DESTDIR" \ (cd "$DESTDIR" \
# && for p in ${PKGDIR}/patches/*.patch; do patch -p1 < $p; done) \ && for p in ${PKGDIR}/patches/*.patch; do patch -p1 < $p; done) \
# || ynh_die "Unable to apply patches to Roundcube" || ynh_die "Unable to apply patches to Roundcube"
# copy composer.json-dist for Roundcube with complete dependencies # copy composer.json-dist for Roundcube with complete dependencies
sudo cp "${PKGDIR}/sources/composer.json-dist" "${DESTDIR}/composer.json-dist" sudo cp "${PKGDIR}/sources/composer.json-dist" "${DESTDIR}/composer.json-dist"

View file

@ -7,15 +7,16 @@ set -eu
source ./_common.sh source ./_common.sh
source /usr/share/yunohost/helpers source /usr/share/yunohost/helpers
app=$YNH_APP_INSTANCE_NAME
# Retrieve arguments # Retrieve arguments
domain=$YNH_APP_ARG_DOMAIN domain=$YNH_APP_ARG_DOMAIN
path=$(ynh_normalize_url_path $YNH_APP_ARG_PATH) path=$(ynh_normalize_url_path $YNH_APP_ARG_PATH)
with_carddav=$YNH_APP_ARG_WITH_CARDDAV with_carddav=$YNH_APP_ARG_WITH_CARDDAV
app=$YNH_APP_INSTANCE_NAME
# Check domain/path availability # Check domain/path availability
sudo yunohost app checkurl "${domain}${path}" -a "$app" sudo yunohost app checkurl "${domain}${path}" -a "$app" \
|| ynh_die "Path not available: ${domain}${path}"
# Set app specific variables # Set app specific variables
dbname=$app dbname=$app
@ -24,9 +25,6 @@ dbuser=$app
deskey=$(ynh_string_random 24) deskey=$(ynh_string_random 24)
dbpass=$(ynh_string_random) dbpass=$(ynh_string_random)
# Check domain/path availability
sudo yunohost app checkurl "${domain}${path}" -a "$app"
# Save app settings # Save app settings
ynh_app_setting_set $app domain $domain ynh_app_setting_set $app domain $domain
ynh_app_setting_set $app path $path ynh_app_setting_set $app path $path

View file

@ -68,10 +68,9 @@ ynh_substitute_char "#DBNAME#" "$dbname" "$rc_conf"
# Install files and set permissions # Install files and set permissions
sudo mkdir -p "${final_path}/logs" "${final_path}/temp" sudo mkdir -p "${final_path}/logs" "${final_path}/temp"
sudo chown -R $app: "${final_path}"
# Check if dependencies need to be updated with composer # Check if dependencies need to be updated with composer
if [[ -f ${DESTDIR}/composer.json ]]; then if [[ -f ${final_path}/composer.json ]]; then
exec_composer admin "${final_path}" update --no-dev --prefer-dist exec_composer admin "${final_path}" update --no-dev --prefer-dist
else else
init_composer "${final_path}" admin init_composer "${final_path}" admin
@ -80,7 +79,7 @@ fi
# Install some plugins manually # Install some plugins manually
sudo rm -rf "${final_path}/plugins/ldapAliasSync" sudo rm -rf "${final_path}/plugins/ldapAliasSync"
sudo cp -r ../sources/plugins/ldapAliasSync "${final_path}/plugins" sudo cp -r ../sources/plugins/ldapAliasSync "${final_path}/plugins"
sudo chown -R $app: "${final_path}/plugins/ldapAliasSync" # sudo chown -R $app: "${final_path}/plugins/ldapAliasSync"
installed_plugins=" 'ldapAliasSync'," installed_plugins=" 'ldapAliasSync',"
# Update or install additional plugins # Update or install additional plugins
@ -108,6 +107,9 @@ fi
sudo sed -i "s#^\s*// installed plugins#&\n ${installed_plugins}#" \ sudo sed -i "s#^\s*// installed plugins#&\n ${installed_plugins}#" \
"$rc_conf" "$rc_conf"
# Owner user app
sudo chown -R $app: "${final_path}"
# Modify Nginx configuration file and copy it to Nginx conf directory # Modify Nginx configuration file and copy it to Nginx conf directory
ynh_nginx_config ynh_nginx_config
@ -115,5 +117,4 @@ ynh_nginx_config
ynh_fpm_config ynh_fpm_config
# Reload services # Reload services
sudo systemctl restart php5-fpm
sudo systemctl reload nginx sudo systemctl reload nginx