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:
parent
d28b39f08e
commit
5a40ea9210
4 changed files with 36 additions and 39 deletions
|
@ -1,16 +1,6 @@
|
|||
--- 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 @@
|
||||
--- 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];
|
||||
|
||||
|
@ -27,12 +17,12 @@
|
|||
|
||||
-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) {
|
||||
// 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";
|
||||
|
@ -42,4 +32,4 @@
|
|||
+ system($command);
|
||||
echo "All done.\n";
|
||||
}
|
||||
}
|
||||
else {
|
||||
|
|
|
@ -17,6 +17,14 @@ ROUNDCUBE_SOURCE_URL="https://github.com/roundcube/roundcubemail/releases/downlo
|
|||
# App package root directory should be the parent folder
|
||||
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
|
||||
#
|
||||
|
@ -37,9 +45,9 @@ extract_roundcube() {
|
|||
sudo rm "$rc_tarball"
|
||||
|
||||
# apply patches
|
||||
# (cd "$DESTDIR" \
|
||||
# && for p in ${PKGDIR}/patches/*.patch; do patch -p1 < $p; done) \
|
||||
# || ynh_die "Unable to apply patches to Roundcube"
|
||||
(cd "$DESTDIR" \
|
||||
&& for p in ${PKGDIR}/patches/*.patch; do patch -p1 < $p; done) \
|
||||
|| ynh_die "Unable to apply patches to Roundcube"
|
||||
|
||||
# copy composer.json-dist for Roundcube with complete dependencies
|
||||
sudo cp "${PKGDIR}/sources/composer.json-dist" "${DESTDIR}/composer.json-dist"
|
||||
|
|
|
@ -7,15 +7,16 @@ set -eu
|
|||
source ./_common.sh
|
||||
source /usr/share/yunohost/helpers
|
||||
|
||||
app=$YNH_APP_INSTANCE_NAME
|
||||
|
||||
# Retrieve arguments
|
||||
domain=$YNH_APP_ARG_DOMAIN
|
||||
path=$(ynh_normalize_url_path $YNH_APP_ARG_PATH)
|
||||
with_carddav=$YNH_APP_ARG_WITH_CARDDAV
|
||||
|
||||
app=$YNH_APP_INSTANCE_NAME
|
||||
|
||||
# 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
|
||||
dbname=$app
|
||||
|
@ -24,9 +25,6 @@ dbuser=$app
|
|||
deskey=$(ynh_string_random 24)
|
||||
dbpass=$(ynh_string_random)
|
||||
|
||||
# Check domain/path availability
|
||||
sudo yunohost app checkurl "${domain}${path}" -a "$app"
|
||||
|
||||
# Save app settings
|
||||
ynh_app_setting_set $app domain $domain
|
||||
ynh_app_setting_set $app path $path
|
||||
|
|
|
@ -68,10 +68,9 @@ ynh_substitute_char "#DBNAME#" "$dbname" "$rc_conf"
|
|||
|
||||
# Install files and set permissions
|
||||
sudo mkdir -p "${final_path}/logs" "${final_path}/temp"
|
||||
sudo chown -R $app: "${final_path}"
|
||||
|
||||
# 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
|
||||
else
|
||||
init_composer "${final_path}" admin
|
||||
|
@ -80,7 +79,7 @@ fi
|
|||
# Install some plugins manually
|
||||
sudo rm -rf "${final_path}/plugins/ldapAliasSync"
|
||||
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',"
|
||||
|
||||
# Update or install additional plugins
|
||||
|
@ -108,6 +107,9 @@ fi
|
|||
sudo sed -i "s#^\s*// installed plugins#&\n ${installed_plugins}#" \
|
||||
"$rc_conf"
|
||||
|
||||
# Owner user app
|
||||
sudo chown -R $app: "${final_path}"
|
||||
|
||||
# Modify Nginx configuration file and copy it to Nginx conf directory
|
||||
ynh_nginx_config
|
||||
|
||||
|
@ -115,5 +117,4 @@ ynh_nginx_config
|
|||
ynh_fpm_config
|
||||
|
||||
# Reload services
|
||||
sudo systemctl restart php5-fpm
|
||||
sudo systemctl reload nginx
|
||||
|
|
Loading…
Reference in a new issue