1
0
Fork 0
mirror of https://github.com/YunoHost-Apps/horde_ynh.git synced 2024-09-03 19:16:08 +02:00

Merge pull request #18 from YunoHost-Apps/upgrade

Upgrade
This commit is contained in:
Éric Gaspar 2023-01-12 09:09:06 +01:00 committed by GitHub
commit 420db8c03b
No known key found for this signature in database
GPG key ID: 4AEE18F83AFDEB23
14 changed files with 319 additions and 146 deletions

65
.github/workflows/updater.sh vendored Normal file
View file

@ -0,0 +1,65 @@
#!/bin/bash
#=================================================
# PACKAGE UPDATING HELPER
#=================================================
# This script is meant to be run by GitHub Actions
# The YunoHost-Apps organisation offers a template Action to run this script periodically
# Since each app is different, maintainers can adapt its contents so as to perform
# automatic actions when a new upstream release is detected.
#=================================================
# FETCHING LATEST RELEASE AND ITS ASSETS
#=================================================
# Fetching information
current_version=$(cat manifest.json | jq -j '.version|split("~")[0]')
repo=$(cat manifest.json | jq -j '.upstream.code|split("https://github.com/")[1]')
# Some jq magic is needed, because the latest upstream release is not always the latest version (e.g. security patches for older versions)
version=$(curl --silent "https://api.github.com/repos/$repo/tags" | jq -r '.[] | select( .prerelease != true ) | .name' | sort -V | tail -1)
# Later down the script, we assume the version has only digits and dots
# Sometimes the release name starts with a "v", so let's filter it out.
# You may need more tweaks here if the upstream repository has different naming conventions.
if [[ ${version:0:1} == "v" || ${version:0:1} == "V" ]]; then
version=${version:1}
fi
# Setting up the environment variables
echo "Current version: $current_version"
echo "Latest release from upstream: $version"
echo "VERSION=$version" >> $GITHUB_ENV
echo "REPO=$repo" >> $GITHUB_ENV
# For the time being, let's assume the script will fail
echo "PROCEED=false" >> $GITHUB_ENV
# Proceed only if the retrieved version is greater than the current one
if ! dpkg --compare-versions "$current_version" "lt" "$version" ; then
echo "::warning ::No new version available"
exit 0
# Proceed only if a PR for this new version does not already exist
elif git ls-remote -q --exit-code --heads https://github.com/$GITHUB_REPOSITORY.git ci-auto-update-v$version ; then
echo "::warning ::A branch already exists for this update"
exit 0
fi
#=================================================
# SPECIFIC UPDATE STEPS
#=================================================
# Any action on the app's source code can be done.
# The GitHub Action workflow takes care of committing all changes after this script ends.
#=================================================
# GENERIC FINALIZATION
#=================================================
# Replace new version in manifest
echo "$(jq -s --indent 4 ".[] | .version = \"$version~ynh1\"" manifest.json)" > manifest.json
# No need to update the README, yunohost-bot takes care of it
# The Action will proceed only if the PROCEED environment variable is set to true
echo "PROCEED=true" >> $GITHUB_ENV
exit 0

49
.github/workflows/updater.yml vendored Normal file
View file

@ -0,0 +1,49 @@
# This workflow allows GitHub Actions to automagically update your app whenever a new upstream release is detected.
# You need to enable Actions in your repository settings, and fetch this Action from the YunoHost-Apps organization.
# This file should be enough by itself, but feel free to tune it to your needs.
# It calls updater.sh, which is where you should put the app-specific update steps.
name: Check for new upstream releases
on:
# Allow to manually trigger the workflow
workflow_dispatch:
# Run it every day at 6:00 UTC
schedule:
- cron: '0 6 * * *'
jobs:
updater:
runs-on: ubuntu-latest
steps:
- name: Fetch the source code
uses: actions/checkout@v2
with:
token: ${{ secrets.GITHUB_TOKEN }}
- name: Run the updater script
id: run_updater
run: |
# Setting up Git user
git config --global user.name 'yunohost-bot'
git config --global user.email 'yunohost-bot@users.noreply.github.com'
# Run the updater script
/bin/bash .github/workflows/updater.sh
- name: Commit changes
id: commit
if: ${{ env.PROCEED == 'true' }}
run: |
git commit -am "Upgrade to v$VERSION"
- name: Create Pull Request
id: cpr
if: ${{ env.PROCEED == 'true' }}
uses: peter-evans/create-pull-request@v3
with:
token: ${{ secrets.GITHUB_TOKEN }}
commit-message: Update to version ${{ env.VERSION }}
committer: 'yunohost-bot <yunohost-bot@users.noreply.github.com>'
author: 'yunohost-bot <yunohost-bot@users.noreply.github.com>'
signoff: false
base: testing
branch: ci-auto-update-v${{ env.VERSION }}
delete-branch: true
title: 'Upgrade to version ${{ env.VERSION }}'
body: |
Upgrade to v${{ env.VERSION }}
draft: false

View file

@ -18,7 +18,7 @@ If you don't have YunoHost, please consult [the guide](https://yunohost.org/#/in
A groupware (webmail, adressbook, calendar) witch use PHP
**Shipped version:** 5.2.22~ynh5
**Shipped version:** 5.2.23~ynh1
**Demo:** http://demo.horde.org
@ -83,7 +83,7 @@ For calendar, task and addressbook activeSync has been configured but not yet te
* Official app website: <https://www.horde.org>
* Official admin documentation: <https://wiki.horde.org>
* Upstream app code repository: <https://github.com/horde>
* Upstream app code repository: <https://github.com/horde/base>
* YunoHost documentation for this app: <https://yunohost.org/app_horde>
* Report a bug: <https://github.com/YunoHost-Apps/horde_ynh/issues>

View file

@ -18,7 +18,7 @@ Si vous n'avez pas YunoHost, regardez [ici](https://yunohost.org/#/install) pour
A groupware (webmail, adressbook, calendar) witch use PHP
**Version incluse :** 5.2.22~ynh5
**Version incluse :** 5.2.23~ynh1
**Démo :** http://demo.horde.org
@ -83,7 +83,7 @@ For calendar, task and addressbook activeSync has been configured but not yet te
* Site officiel de l'app : <https://www.horde.org>
* Documentation officielle de l'admin : <https://wiki.horde.org>
* Dépôt de code officiel de l'app : <https://github.com/horde>
* Dépôt de code officiel de l'app : <https://github.com/horde/base>
* Documentation YunoHost pour cette app : <https://yunohost.org/app_horde>
* Signaler un bug : <https://github.com/YunoHost-Apps/horde_ynh/issues>

View file

@ -2,10 +2,10 @@
; Manifest
domain="domain.tld"
path="/path"
is_public=1
is_public=1
language="fr"
admin="john"
service_autodiscovery=1
service_autodiscovery=1
whups_install=1
sesha_install=1
ansel_install=1

View file

@ -2,11 +2,11 @@
location __PATH__/ {
# Path to source
alias __FINALPATH__/horde/ ;
alias __FINALPATH__/horde/;
index index.php;
# Common parameter to increase upload size limit in conjuction with dedicated php-fpm file
# Common parameter to increase upload size limit in conjunction with dedicated php-fpm file
client_max_body_size 50M;
# Protect all not necessary files

View file

@ -6,14 +6,14 @@
"en": "A groupware (webmail, adressbook, calendar) that uses PHP",
"fr": "Un groupware (webmail, carnet adresses, agenda), utilisant PHP."
},
"version": "5.2.22~ynh5",
"version": "5.2.23~ynh1",
"url": "https://www.horde.org/",
"upstream": {
"license": "LGPL-2.0",
"website": "https://www.horde.org",
"demo": "http://demo.horde.org",
"admindoc": "https://wiki.horde.org",
"code": "https://github.com/horde"
"code": "https://github.com/horde/base"
},
"license": "LGPL-2.0",
"maintainer": {
@ -30,7 +30,7 @@
"mysql"
],
"arguments": {
"install" : [
"install": [
{
"name": "domain",
"type": "domain"
@ -54,10 +54,34 @@
"fr": "Choisissez la langue de l'application"
},
"choices": [
"bg", "de", "en", "es", "fi", "fo", "fr", "hr", "hu",
"id", "is", "it", "lt", "lv", "mg", "mk", "mt", "nl",
"pl", "pt", "ro", "ru", "sk", "so", "th", "tr", "uz"
],
"bg",
"de",
"en",
"es",
"fi",
"fo",
"fr",
"hr",
"hu",
"id",
"is",
"it",
"lt",
"lv",
"mg",
"mk",
"mt",
"nl",
"pl",
"pt",
"ro",
"ru",
"sk",
"so",
"th",
"tr",
"uz"
],
"default": "en"
},
{

View file

@ -1,19 +1,20 @@
#!/bin/bash
#=================================================
# SET ALL CONSTANTS
# COMMON VARIABLES
#=================================================
# PHP APP SPECIFIC
#=================================================
php_dependencies="php$YNH_DEFAULT_PHP_VERSION-pear php$YNH_DEFAULT_PHP_VERSION-imagick php$YNH_DEFAULT_PHP_VERSION-tidy php$YNH_DEFAULT_PHP_VERSION-bcmath"
# dependencies used by the app (must be on a single line)
pkg_dependencies="expect $php_dependencies"
#=================================================
# DEFINE ALL COMMON FONCTIONS
# PERSONAL HELPERS
#=================================================
install_dependance() {
ynh_install_app_dependencies php-pear expect 'php5-imagick|php-imagick' 'php5-tidy|php-tidy' php-bcmath
}
patch_app() {
local old_dir=$(pwd)
(cd "$final_path/horde" && patch -p1 < $YNH_CWD/../sources/sso_auth.patch) || echo "Unable to apply patches"
@ -95,3 +96,11 @@ set_permission() {
chmod u=rwX,g=rwX,o= -R $final_path
chmod u=rwX,g=rwX,o= -R $gollem_data_dir
}
#=================================================
# EXPERIMENTAL HELPERS
#=================================================
#=================================================
# FUTURE OFFICIAL HELPERS
#=================================================

View file

@ -17,14 +17,14 @@ old_domain=$YNH_APP_OLD_DOMAIN
old_path=$YNH_APP_OLD_PATH
new_domain=$YNH_APP_NEW_DOMAIN
new_path=$(ynh_normalize_url_path --path_url ${YNH_APP_NEW_PATH:-'/'})
new_path=$YNH_APP_NEW_PATH
app=$YNH_APP_INSTANCE_NAME
#=================================================
# LOAD SETTINGS
#=================================================
ynh_script_progression --message="Loading installation settings..."
ynh_script_progression --message="Loading installation settings..." --weight=1
# Needed for helper "ynh_add_nginx_config"
final_path=$(ynh_app_setting_get --app=$app --key=final_path)
@ -35,19 +35,18 @@ port=$(ynh_app_setting_get --app=$app --key=port)
secret_key=$(ynh_app_setting_get --app=$app --key=secret_key)
service_autodiscovery=$(ynh_app_setting_get --app=$app --key=service_autodiscovery)
db_name=$(ynh_app_setting_get --app=$app --key=db_name)
db_user=$(ynh_app_setting_get --app=$app --key=db_user)
db_user=$db_name
db_pwd=$(ynh_app_setting_get --app=$app --key=mysqlpwd)
gollem_data_dir=$(ynh_app_setting_get --app=$app --key=gollem_data_dir)
#=================================================
# BACKUP BEFORE CHANGE URL THEN ACTIVE TRAP
#=================================================
ynh_script_progression --message="Backing up the app before changing its URL (may take a while)..."
ynh_script_progression --message="Backing up the app before changing its URL (may take a while)..." --weight=1
# Backup the current version of the app
ynh_backup_before_upgrade
ynh_clean_setup () {
ynh_clean_check_starting
# Remove the new domain config file, the remove script won't do it as it doesn't know yet its location.
ynh_secure_remove --file="/etc/nginx/conf.d/$new_domain.d/$app.conf"
@ -78,10 +77,22 @@ fi
#=================================================
# MODIFY URL IN NGINX CONF
#=================================================
ynh_script_progression --message="Updating NGINX web server configuration..."
ynh_script_progression --message="Updating NGINX web server configuration..." --weight=1
nginx_conf_path=/etc/nginx/conf.d/$old_domain.d/$app.conf
# Change the path in the NGINX config file
if [ $change_path -eq 1 ]
then
# Make a backup of the original NGINX config file if modified
ynh_backup_if_checksum_is_different --file="$nginx_conf_path"
# Set global variables for NGINX helper
domain="$old_domain"
path_url="$new_path"
# Create a dedicated NGINX config
ynh_add_nginx_config
fi
# Change the domain for NGINX
if [ $change_domain -eq 1 ]
then
@ -92,18 +103,17 @@ then
ynh_store_file_checksum --file="/etc/nginx/conf.d/$new_domain.d/$app.conf"
fi
#=================================================
# SPECIFIC MODIFICATIONS
#=================================================
# ...
#=================================================
domain=$new_domain
path_url=$new_path
config_nginx
# Update horde config
#=================================================
# SPECIFIC MODIFICATIONS
#=================================================
# UPDATE HORDE CONFIG
#=================================================
ynh_script_progression --message="Configuring application..." --weight=3
config_horde
#=================================================
@ -111,7 +121,7 @@ config_horde
#=================================================
# RELOAD NGINX
#=================================================
ynh_script_progression --message="Reloading NGINX web server..."
ynh_script_progression --message="Reloading NGINX web server..." --weight=1
ynh_systemd_action --service_name=nginx --action=reload
@ -119,4 +129,4 @@ ynh_systemd_action --service_name=nginx --action=reload
# END OF SCRIPT
#=================================================
ynh_script_progression --message="Change of URL completed for $app"
ynh_script_progression --message="Change of URL completed for $app" --last

View file

@ -14,7 +14,7 @@ source /usr/share/yunohost/helpers
#=================================================
ynh_clean_setup () {
ynh_clean_check_starting
true
}
# Exit if an error occurs during the execution of the script
ynh_abort_if_errors
@ -24,7 +24,7 @@ ynh_abort_if_errors
#=================================================
domain=$YNH_APP_ARG_DOMAIN
path_url=$(ynh_normalize_url_path --path_url $YNH_APP_ARG_PATH)
path_url=$YNH_APP_ARG_PATH
is_public=$YNH_APP_ARG_IS_PUBLIC
language=$YNH_APP_ARG_LANGUAGE
admin=$YNH_APP_ARG_ADMIN
@ -103,12 +103,12 @@ fi
#=================================================
ynh_script_progression --message="Installing dependencies..." --weight=7
install_dependance
ynh_install_app_dependencies $pkg_dependencies
#=================================================
# CREATE DEDICATED USER
#=================================================
ynh_script_progression --message="Configuring system user..."
ynh_script_progression --message="Configuring system user..." --weight=1
# Create a system user
ynh_system_user_create --username=$app --home_dir="$final_path"
@ -116,18 +116,17 @@ ynh_system_user_create --username=$app --home_dir="$final_path"
#=================================================
# CREATE A MYSQL DATABASE
#=================================================
ynh_script_progression --message="Creating a MySQL database..."
ynh_script_progression --message="Creating a MySQL database..." --weight=1
db_name=$(ynh_sanitize_dbid --db_name=$app)
db_user=$db_name
ynh_app_setting_set --app=$app --key=db_name --value=$db_name
ynh_app_setting_set --app=$app --key=db_user --value=$db_user
ynh_mysql_setup_db --db_user=$db_user --db_name=$db_name
#=================================================
# DOWNLOAD, CHECK AND UNPACK SOURCE
#=================================================
ynh_script_progression --message="Setting up source files..."
ynh_script_progression --message="Setting up source files..." --weight=1
ynh_app_setting_set --app=$app --key=final_path --value=$final_path
# Download, check integrity, uncompress and patch the source from app.src
@ -138,6 +137,14 @@ chmod 750 "$final_path"
chmod -R o-rwx "$final_path"
chown -R $app:www-data "$final_path"
#=================================================
# PHP-FPM CONFIGURATION
#=================================================
ynh_script_progression --message="Configuring PHP-FPM..." --weight=1
# Create a dedicated PHP-FPM config
ynh_add_fpm_config
#=================================================
# NGINX CONFIGURATION
#=================================================
@ -146,14 +153,6 @@ ynh_script_progression --message="Configuring NGINX web server..."
# Create a dedicated NGINX config
config_nginx
#=================================================
# PHP-FPM CONFIGURATION
#=================================================
ynh_script_progression --message="Configuring PHP-FPM..."
# Create a dedicated PHP-FPM config
ynh_add_fpm_config
#=================================================
# SPECIFIC SETUP
#=================================================
@ -171,14 +170,14 @@ chmod -R o-rwx "$gollem_data_dir"
chown -R $app:www-data "$gollem_data_dir"
#=================================================
# ...
# INSTALL SOURCE FILES
#=================================================
ynh_script_progression --message="Installing sources files..." --weight=7
# Set execution for expect scripts
chmod +x ../conf/init_horde_install.exp
chmod +x ../conf/config_horde.exp
ynh_script_progression --message="Installing sources files..." --weight=7
pear config-create "$final_path" "$final_path/pear.conf"
pear -c "$final_path/pear.conf" install -o -f pear
@ -199,16 +198,25 @@ PHP_PEAR_SYSCONF_DIR=$final_path ../conf/config_horde.exp "$final_path" "$db_nam
secret_key=$(grep 'secret_key' "$final_path/horde/config/conf.php" | cut -d"'" -f4)
ynh_app_setting_set --app=$app --key=secret_key --value="$secret_key"
# Patch the app
#=================================================
# PATCH APPLICATION
#=================================================
ynh_script_progression --message="Patching application..." --weight=7
patch_app
# Configure Horde
#=================================================
# CONFIGURE HORDE
#=================================================
ynh_script_progression --message="Configuring application..." --weight=3
config_horde
#=================================================
# SECURE FILES AND DIRECTORIES
#=================================================
ynh_script_progression --message="Protecting directory..."
set_permission
#=================================================
@ -216,16 +224,16 @@ set_permission
#=================================================
# SETUP LOGROTATE
#=================================================
ynh_script_progression --message="Configuring log rotation..."
ynh_script_progression --message="Configuring log rotation..." --weight=1
ynh_use_logrotate $final_path/horde --nonappend --specific_user www-data/horde
ynh_use_logrotate $final_path/horde/services --append --specific_user www-data/horde
ynh_use_logrotate $final_path/horde/services/portal --append --specific_user www-data/horde
ynh_use_logrotate --logfile="$final_path/horde" --nonappend --specific_user www-data/horde
ynh_use_logrotate --logfile="$final_path/horde/services" --specific_user www-data/horde
ynh_use_logrotate --logfile="$final_path/horde/services/portal" --specific_user www-data/horde
#=================================================
# SETUP SSOWAT
#=================================================
ynh_script_progression --message="Configuring permissions..."
ynh_script_progression --message="Configuring permissions..." --weight=1
if [ "$is_public" = "0" ];
then # Retire l'accès public
@ -237,7 +245,7 @@ fi
#=================================================
# RELOAD NGINX
#=================================================
ynh_script_progression --message="Reloading NGINX web server..."
ynh_script_progression --message="Reloading NGINX web server..." --weight=1
ynh_systemd_action --service_name=nginx --action=reload
@ -245,4 +253,4 @@ ynh_systemd_action --service_name=nginx --action=reload
# END OF SCRIPT
#=================================================
ynh_script_progression --message="Installation of $app completed"
ynh_script_progression --message="Installation of $app completed" --last

View file

@ -12,14 +12,14 @@ source /usr/share/yunohost/helpers
#=================================================
# LOAD SETTINGS
#=================================================
ynh_script_progression --message="Loading installation settings..."
ynh_script_progression --message="Loading installation settings..." --weight=1
app=$YNH_APP_INSTANCE_NAME
domain=$(ynh_app_setting_get --app=$app --key=domain)
port=$(ynh_app_setting_get --app=$app --key=port)
db_name=$(ynh_app_setting_get --app=$app --key=db_name)
db_user=$(ynh_app_setting_get --app=$app --key=db_user)
db_user=$db_name
final_path=$(ynh_app_setting_get --app=$app --key=final_path)
#=================================================
@ -27,7 +27,7 @@ final_path=$(ynh_app_setting_get --app=$app --key=final_path)
#=================================================
# REMOVE LOGROTATE CONFIGURATION
#=================================================
ynh_script_progression --message="Removing logrotate configuration..."
ynh_script_progression --message="Removing logrotate configuration..." --weight=1
# Remove the app-specific logrotate config
ynh_remove_logrotate
@ -35,7 +35,7 @@ ynh_remove_logrotate
#=================================================
# REMOVE THE MYSQL DATABASE
#=================================================
ynh_script_progression --message="Removing the MySQL database..."
ynh_script_progression --message="Removing the MySQL database..." --weight=1
# Remove a database if it exists, along with the associated user
ynh_mysql_remove_db --db_user=$db_user --db_name=$db_name
@ -43,7 +43,7 @@ ynh_mysql_remove_db --db_user=$db_user --db_name=$db_name
#=================================================
# REMOVE APP MAIN DIR
#=================================================
ynh_script_progression --message="Removing app main directory..."
ynh_script_progression --message="Removing app main directory..." --weight=1
# Remove the app directory securely
ynh_secure_remove --file="$final_path"
@ -51,7 +51,7 @@ ynh_secure_remove --file="$final_path"
#=================================================
# REMOVE NGINX CONFIGURATION
#=================================================
ynh_script_progression --message="Removing NGINX web server configuration..."
ynh_script_progression --message="Removing NGINX web server configuration..." --weight=1
# Remove the dedicated NGINX config
ynh_remove_nginx_config
@ -59,7 +59,7 @@ ynh_remove_nginx_config
#=================================================
# REMOVE PHP-FPM CONFIGURATION
#=================================================
ynh_script_progression --message="Removing PHP-FPM configuration..."
ynh_script_progression --message="Removing PHP-FPM configuration..." --weight=1
# Remove the dedicated PHP-FPM config
ynh_remove_fpm_config
@ -67,7 +67,7 @@ ynh_remove_fpm_config
#=================================================
# REMOVE DEPENDENCIES
#=================================================
ynh_script_progression --message="Removing dependencies..."
ynh_script_progression --message="Removing dependencies..." --weight=1
# Remove metapackage and its dependencies
ynh_remove_app_dependencies
@ -77,7 +77,7 @@ ynh_remove_app_dependencies
#=================================================
# REMOVE VARIOUS FILES
#=================================================
ynh_script_progression --message="Removing various files..."
ynh_script_progression --message="Removing various files..." --weight=1
ynh_secure_remove --file="$gollem_data_dir"
@ -86,7 +86,7 @@ ynh_secure_remove --file="$gollem_data_dir"
#=================================================
# REMOVE DEDICATED USER
#=================================================
ynh_script_progression --message="Removing the dedicated system user..."
ynh_script_progression --message="Removing the dedicated system user..." --weight=1
# Delete a system user
ynh_system_user_delete --username=$app
@ -95,4 +95,4 @@ ynh_system_user_delete --username=$app
# END OF SCRIPT
#=================================================
ynh_script_progression --message="Removal of $app completed"
ynh_script_progression --message="Removal of $app completed" --last

View file

@ -15,7 +15,7 @@ source /usr/share/yunohost/helpers
#=================================================
ynh_clean_setup () {
ynh_clean_check_starting
true
}
# Exit if an error occurs during the execution of the script
ynh_abort_if_errors
@ -23,7 +23,7 @@ ynh_abort_if_errors
#=================================================
# LOAD SETTINGS
#=================================================
ynh_script_progression --message="Loading installation settings..."
ynh_script_progression --message="Loading installation settings..." --weight=1
app=$YNH_APP_INSTANCE_NAME
@ -31,31 +31,24 @@ domain=$(ynh_app_setting_get --app=$app --key=domain)
path_url=$(ynh_app_setting_get --app=$app --key=path)
final_path=$(ynh_app_setting_get --app=$app --key=final_path)
db_name=$(ynh_app_setting_get --app=$app --key=db_name)
db_user=$(ynh_app_setting_get --app=$app --key=db_user)
db_user=$db_name
phpversion=$(ynh_app_setting_get --app=$app --key=phpversion)
gollem_data_dir=$(ynh_app_setting_get --app=$app --key=gollem_data_dir)
#=================================================
# CHECK IF THE APP CAN BE RESTORED
#=================================================
ynh_script_progression --message="Validating restoration parameters..."
ynh_script_progression --message="Validating restoration parameters..." --weight=1
test ! -d $final_path \
|| ynh_die --message="There is already a directory: $final_path "
#=================================================
# STANDARD RESTORATION STEPS
#=================================================
# RESTORE THE NGINX CONFIGURATION
#=================================================
ynh_script_progression --message="Restoring the NGINX web server configuration..."
ynh_restore_file --origin_path="/etc/nginx/conf.d/$domain.d/$app.conf"
#=================================================
# RECREATE THE DEDICATED USER
#=================================================
ynh_script_progression --message="Recreating the dedicated system user..."
ynh_script_progression --message="Recreating the dedicated system user..." --weight=1
# Create the dedicated user (if not existing)
ynh_system_user_create --username=$app --home_dir="$final_path"
@ -63,27 +56,19 @@ ynh_system_user_create --username=$app --home_dir="$final_path"
#=================================================
# RESTORE THE APP MAIN DIR
#=================================================
ynh_script_progression --message="Restoring the app main directory..."
ynh_script_progression --message="Restoring the app main directory..." --weight=1
ynh_restore_file --origin_path="$final_path"
#=================================================
# RESTORE THE DATA DIRECTORY
#=================================================
ynh_script_progression --message="Restoring the data directory..."
ynh_script_progression --message="Restoring the data directory..." --weight=1
ynh_restore_file --origin_path="$gollem_data_dir"
mkdir -p $gollem_data_dir
#=================================================
# RESTORE THE PHP-FPM CONFIGURATION
#=================================================
ynh_script_progression --message="Restoring the PHP-FPM configuration..."
ynh_restore_file --origin_path="/etc/php/$phpversion/fpm/pool.d/$app.conf"
#=================================================
# SPECIFIC RESTORATION
#=================================================
@ -91,13 +76,27 @@ ynh_restore_file --origin_path="/etc/php/$phpversion/fpm/pool.d/$app.conf"
#=================================================
ynh_script_progression --message="Reinstalling dependencies..." --weight=5
install_dependance
# Define and install dependencies
ynh_install_app_dependencies $pkg_dependencies
#=================================================
# RESTORE THE PHP-FPM CONFIGURATION
#=================================================
ynh_script_progression --message="Restoring the PHP-FPM configuration..." --weight=1
ynh_restore_file --origin_path="/etc/php/$phpversion/fpm/pool.d/$app.conf"
#=================================================
# RESTORE THE NGINX CONFIGURATION
#=================================================
ynh_script_progression --message="Restoring the NGINX web server configuration..." --weight=1
ynh_restore_file --origin_path="/etc/nginx/conf.d/$domain.d/$app.conf"
#=================================================
# RESTORE THE MYSQL DATABASE
#=================================================
ynh_script_progression --message="Restoring the MySQL database..."
ynh_script_progression --message="Restoring the MySQL database..." --weight=1
db_pwd=$(ynh_app_setting_get --app=$app --key=mysqlpwd)
ynh_mysql_setup_db --db_user=$db_user --db_name=$db_name --db_pwd=$db_pwd
@ -106,25 +105,25 @@ ynh_mysql_connect_as --user=$db_user --password=$db_pwd --database=$db_name < ./
#=================================================
# RESTORE VARIOUS FILES
#=================================================
ynh_script_progression --message="Restoring various files..."
ynh_script_progression --message="Restoring various files..." --weight=1
set_permission
#=================================================
# RESTORE THE LOGROTATE CONFIGURATION
#=================================================
ynh_script_progression --message="Restoring the logrotate configuration..."
ynh_script_progression --message="Restoring the logrotate configuration..." --weight=1
ynh_use_logrotate $final_path/horde --nonappend --specific_user www-data/horde
ynh_use_logrotate $final_path/horde/services --append --specific_user www-data/horde
ynh_use_logrotate $final_path/horde/services/portal --append --specific_user www-data/horde
ynh_use_logrotate --logfile="$final_path/horde" --nonappend --specific_user www-data/horde
ynh_use_logrotate --logfile="$final_path/horde/services" --specific_user www-data/horde
ynh_use_logrotate --logfile="$final_path/horde/services/portal" --specific_user www-data/horde
#=================================================
# GENERIC FINALIZATION
#=================================================
# RELOAD NGINX AND PHP-FPM
#=================================================
ynh_script_progression --message="Reloading NGINX web server and PHP-FPM..."
ynh_script_progression --message="Reloading NGINX web server and PHP-FPM..." --weight=1
ynh_systemd_action --service_name=php$phpversion-fpm --action=reload
ynh_systemd_action --service_name=nginx --action=reload
@ -133,4 +132,4 @@ ynh_systemd_action --service_name=nginx --action=reload
# END OF SCRIPT
#=================================================
ynh_script_progression --message="Restoration completed for $app"
ynh_script_progression --message="Restoration completed for $app" --last

View file

@ -12,7 +12,7 @@ source /usr/share/yunohost/helpers
#=================================================
# LOAD SETTINGS
#=================================================
ynh_script_progression --message="Loading installation settings..."
ynh_script_progression --message="Loading installation settings..." --weight=1
app=$YNH_APP_INSTANCE_NAME
@ -24,7 +24,7 @@ final_path=$(ynh_app_setting_get --app=$app --key=final_path)
port=$(ynh_app_setting_get --app=$app --key=port)
secret_key=$(ynh_app_setting_get --app=$app --key=secret_key)
db_name=$(ynh_app_setting_get --app=$app --key=db_name)
db_user=$(ynh_app_setting_get --app=$app --key=db_user)
db_user=$db_name
db_pwd=$(ynh_app_setting_get --app=$app --key=mysqlpwd)
gollem_data_dir=$(ynh_app_setting_get --app=$app --key=gollem_data_dir)
@ -38,12 +38,11 @@ upgrade_type=$(ynh_check_app_version_changed)
#=================================================
# BACKUP BEFORE UPGRADE THEN ACTIVE TRAP
#=================================================
ynh_script_progression --message="Backing up the app before upgrading (may take a while)..."
ynh_script_progression --message="Backing up the app before upgrading (may take a while)..." --weight=1
# Backup the current version of the app
ynh_backup_before_upgrade
ynh_clean_setup () {
ynh_clean_check_starting
# Restore it if the upgrade fails
ynh_restore_upgradebackup
}
@ -55,7 +54,7 @@ ynh_abort_if_errors
#=================================================
# ENSURE DOWNWARD COMPATIBILITY
#=================================================
ynh_script_progression --message="Ensuring downward compatibility..."
ynh_script_progression --message="Ensuring downward compatibility..." --weight=1
# Cleaning legacy permissions
if ynh_legacy_permissions_exists; then
@ -69,58 +68,68 @@ if [ -z "$gollem_data_dir" ]; then
gollem_data_dir=/home/yunohost.app/$app
ynh_app_setting_set --app=$app --key=gollem_data_dir --value=$gollem_data_dir
fi
#=================================================
# CREATE DEDICATED USER
#=================================================
ynh_script_progression --message="Making sure dedicated system user exists..."
ynh_script_progression --message="Making sure dedicated system user exists..." --weight=1
# Create a dedicated user (if not existing)
ynh_system_user_create --username=$app --home_dir="$final_path"
#=================================================
# NGINX CONFIGURATION
#=================================================
ynh_script_progression --message="Upgrading NGINX web server configuration..."
# Create a dedicated NGINX config
config_nginx
#=================================================
# UPGRADE DEPENDENCIES
#=================================================
ynh_script_progression --message="Upgrading dependencies..."
ynh_script_progression --message="Upgrading dependencies..." --weight=1
install_dependance
ynh_install_app_dependencies $pkg_dependencies
#=================================================
# PHP-FPM CONFIGURATION
#=================================================
ynh_script_progression --message="Upgrading PHP-FPM configuration..."
ynh_script_progression --message="Upgrading PHP-FPM configuration..." --weight=1
# Create a dedicated PHP-FPM config
ynh_add_fpm_config
#=================================================
# NGINX CONFIGURATION
#=================================================
ynh_script_progression --message="Upgrading NGINX web server configuration..." --weight=1
# Create a dedicated NGINX config
config_nginx
#=================================================
# SPECIFIC UPGRADE
#=================================================
# ...
# UPGRADE SOURCE FILE
#=================================================
# Upgrade Horde by PEAR
ynh_script_progression --message="Upgrading source files..." --weight=6
pear_cmd="$final_path/pear/pear -c $final_path/pear.conf"
$pear_cmd channel-update pear.horde.org
$pear_cmd upgrade -R $final_path -a -B -c pear.horde.org || true
# Patch the app
#=================================================
# PATCH APPLICATION
#=================================================
ynh_script_progression --message="Patching application..." --weight=7
patch_app
# Configure Horde
#=================================================
# CONFIGURE HORDE
#=================================================
ynh_script_progression --message="Configuring application..." --weight=3
config_horde
#=================================================
# SECURE FILES AND DIRECTORIES
#=================================================
ynh_script_progression --message="Protecting directory..."
set_permission
#=================================================
@ -128,16 +137,16 @@ set_permission
#=================================================
# SETUP LOGROTATE
#=================================================
ynh_script_progression --message="Upgrading logrotate configuration..."
ynh_script_progression --message="Upgrading logrotate configuration..." --weight=1
ynh_use_logrotate $final_path/horde --nonappend --specific_user www-data/horde
ynh_use_logrotate $final_path/horde/services --append --specific_user www-data/horde
ynh_use_logrotate $final_path/horde/services/portal --append --specific_user www-data/horde
ynh_use_logrotate --logfile="$final_path/horde" --nonappend --specific_user www-data/horde
ynh_use_logrotate --logfile="$final_path/horde/services" --specific_user www-data/horde
ynh_use_logrotate --logfile="$final_path/horde/services/portal" --specific_user www-data/horde
#=================================================
# RELOAD NGINX
#=================================================
ynh_script_progression --message="Reloading NGINX web server..."
ynh_script_progression --message="Reloading NGINX web server..." --weight=1
ynh_systemd_action --service_name=nginx --action=reload
@ -145,4 +154,4 @@ ynh_systemd_action --service_name=nginx --action=reload
# END OF SCRIPT
#=================================================
ynh_script_progression --message="Upgrade of $app completed"
ynh_script_progression --message="Upgrade of $app completed" --last