From 817206228a415fe39a9aba364cd21e5fedd82f46 Mon Sep 17 00:00:00 2001 From: yalh76 Date: Tue, 30 Aug 2022 23:27:00 +0200 Subject: [PATCH 1/4] Fix logrotate --- scripts/install | 6 +++--- scripts/restore | 6 +++--- scripts/upgrade | 6 +++--- 3 files changed, 9 insertions(+), 9 deletions(-) diff --git a/scripts/install b/scripts/install index 140ed0b..ffafbb2 100755 --- a/scripts/install +++ b/scripts/install @@ -218,9 +218,9 @@ set_permission #================================================= ynh_script_progression --message="Configuring log rotation..." -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 diff --git a/scripts/restore b/scripts/restore index 19bdbdd..939e6a8 100755 --- a/scripts/restore +++ b/scripts/restore @@ -115,9 +115,9 @@ set_permission #================================================= ynh_script_progression --message="Restoring the logrotate configuration..." -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 diff --git a/scripts/upgrade b/scripts/upgrade index 6ee3b41..84233a3 100755 --- a/scripts/upgrade +++ b/scripts/upgrade @@ -130,9 +130,9 @@ set_permission #================================================= ynh_script_progression --message="Upgrading logrotate configuration..." -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 From 7c2453bcf4d0fdc8cad338ecb7e3440b8b03b78c Mon Sep 17 00:00:00 2001 From: yalh76 Date: Wed, 31 Aug 2022 00:06:07 +0200 Subject: [PATCH 2/4] Apply last example_ynh --- .github/workflows/updater.sh | 65 +++++++++++++++++++++++++++++++++++ .github/workflows/updater.yml | 49 ++++++++++++++++++++++++++ check_process | 4 +-- conf/nginx.conf | 4 +-- conf/php-fpm.conf | 28 +++++++-------- manifest.json | 38 ++++++++++++++++---- scripts/_common.sh | 21 +++++++---- scripts/change_url | 40 +++++++++++++-------- scripts/install | 56 +++++++++++++++++------------- scripts/remove | 22 ++++++------ scripts/restore | 55 +++++++++++++++-------------- scripts/upgrade | 57 +++++++++++++++++------------- 12 files changed, 306 insertions(+), 133 deletions(-) create mode 100644 .github/workflows/updater.sh create mode 100644 .github/workflows/updater.yml diff --git a/.github/workflows/updater.sh b/.github/workflows/updater.sh new file mode 100644 index 0000000..9976773 --- /dev/null +++ b/.github/workflows/updater.sh @@ -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 diff --git a/.github/workflows/updater.yml b/.github/workflows/updater.yml new file mode 100644 index 0000000..fb72ba0 --- /dev/null +++ b/.github/workflows/updater.yml @@ -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 ' + author: 'yunohost-bot ' + 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 diff --git a/check_process b/check_process index abac979..ac2ef6b 100644 --- a/check_process +++ b/check_process @@ -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 diff --git a/conf/nginx.conf b/conf/nginx.conf index 36efec1..cbee582 100644 --- a/conf/nginx.conf +++ b/conf/nginx.conf @@ -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 diff --git a/conf/php-fpm.conf b/conf/php-fpm.conf index 2ca53b8..38fbc33 100644 --- a/conf/php-fpm.conf +++ b/conf/php-fpm.conf @@ -41,7 +41,7 @@ listen = /var/run/php/php__PHPVERSION__-fpm-__NAMETOCHANGE__.sock ; Set permissions for unix socket, if one is used. In Linux, read/write ; permissions must be set in order to allow connections from a web server. Many -; BSD-derived systems allow connections regardless of permissions. +; BSD-derived systems allow connections regardless of permissions. ; Default Values: user and group are set as the running user ; mode is set to 0660 listen.owner = www-data @@ -52,7 +52,7 @@ listen.group = www-data ; When set, listen.owner and listen.group are ignored ;listen.acl_users = ;listen.acl_groups = - + ; List of addresses (IPv4/IPv6) of FastCGI clients which are allowed to connect. ; Equivalent to the FCGI_WEB_SERVER_ADDRS environment variable in the original ; PHP FCGI (5.2.2+). Makes sense only with a tcp listening socket. Each address @@ -131,7 +131,7 @@ pm.max_spare_servers = 3 ; Note: Used only when pm is set to 'ondemand' ; Default Value: 10s ;pm.process_idle_timeout = 10s; - + ; The number of requests each child process should execute before respawning. ; This can be useful to work around memory leaks in 3rd party libraries. For ; endless request processing specify '0'. Equivalent to PHP_FCGI_MAX_REQUESTS. @@ -184,7 +184,7 @@ pm.max_requests = 500 ; ; By default the status page only outputs short status. Passing 'full' in the ; query string will also return status for each pool process. -; Example: +; Example: ; http://www.foo.bar/status?full ; http://www.foo.bar/status?json&full ; http://www.foo.bar/status?html&full @@ -297,7 +297,7 @@ pm.max_requests = 500 ; - .... ; %p: PID of the child that serviced the request ; %P: PID of the parent of the child that serviced the request -; %q: the query string +; %q: the query string ; %Q: the '?' character if query string exists ; %r: the request URI (without the query string, see %q and %Q) ; %R: remote IP address @@ -316,40 +316,40 @@ pm.max_requests = 500 ; ; Default: "%R - %u %t \"%m %r\" %s" ;access.format = "%R - %u %t \"%m %r%Q%q\" %s %f %{mili}d %{kilo}M %C%%" - + ; The log file for slow requests ; Default Value: not set ; Note: slowlog is mandatory if request_slowlog_timeout is set slowlog = /var/log/nginx/__NAMETOCHANGE__.slow.log - + ; The timeout for serving a single request after which a PHP backtrace will be ; dumped to the 'slowlog' file. A value of '0s' means 'off'. ; Available units: s(econds)(default), m(inutes), h(ours), or d(ays) ; Default Value: 0 request_slowlog_timeout = 5s - + ; The timeout for serving a single request after which the worker process will ; be killed. This option should be used when the 'max_execution_time' ini option ; does not stop script execution for some reason. A value of '0' means 'off'. ; Available units: s(econds)(default), m(inutes), h(ours), or d(ays) ; Default Value: 0 request_terminate_timeout = 1d - + ; Set open file descriptor rlimit. ; Default Value: system defined value ;rlimit_files = 1024 - + ; Set max core size rlimit. ; Possible Values: 'unlimited' or an integer greater or equal to 0 ; Default Value: system defined value ;rlimit_core = 0 - + ; Chroot to this directory at the start. This value must be defined as an ; absolute path. When this value is not set, chroot is not used. ; Note: you can prefix with '$prefix' to chroot to the pool prefix or one ; of its subdirectories. If the pool prefix is not set, the global prefix ; will be used instead. -; Note: chrooting is a great security feature and should be used whenever +; Note: chrooting is a great security feature and should be used whenever ; possible. However, all PHP paths will be relative to the chroot ; (error_log, sessions.save_path, ...). ; Default Value: not set @@ -383,7 +383,7 @@ catch_workers_output = yes ; Note: set an empty value to allow all extensions. ; Default Value: .php ;security.limit_extensions = .php .php3 .php4 .php5 .php7 - + ; Pass environment variables like LD_LIBRARY_PATH. All $VARIABLEs are taken from ; the current environment. ; Default Value: clean env @@ -397,7 +397,7 @@ catch_workers_output = yes ; overwrite the values previously defined in the php.ini. The directives are the ; same as the PHP SAPI: ; php_value/php_flag - you can set classic ini defines which can -; be overwritten from PHP call 'ini_set'. +; be overwritten from PHP call 'ini_set'. ; php_admin_value/php_admin_flag - these directives won't be overwritten by ; PHP call 'ini_set' ; For php_*flag, valid values are on, off, 1, 0, true, false, yes or no. diff --git a/manifest.json b/manifest.json index e393fb6..246f220 100644 --- a/manifest.json +++ b/manifest.json @@ -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" }, { diff --git a/scripts/_common.sh b/scripts/_common.sh index 15f2ff5..7fbedc0 100644 --- a/scripts/_common.sh +++ b/scripts/_common.sh @@ -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 +#================================================= diff --git a/scripts/change_url b/scripts/change_url index 3b0fbb9..45a63ba 100644 --- a/scripts/change_url +++ b/scripts/change_url @@ -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 diff --git a/scripts/install b/scripts/install index ffafbb2..7d16e63 100755 --- a/scripts/install +++ b/scripts/install @@ -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,7 +224,7 @@ set_permission #================================================= # SETUP LOGROTATE #================================================= -ynh_script_progression --message="Configuring log rotation..." +ynh_script_progression --message="Configuring log rotation..." --weight=1 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 @@ -225,7 +233,7 @@ ynh_use_logrotate --logfile="$final_path/horde/services/portal" --specific_user #================================================= # 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 diff --git a/scripts/remove b/scripts/remove index 842a6aa..f74d710 100755 --- a/scripts/remove +++ b/scripts/remove @@ -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 diff --git a/scripts/restore b/scripts/restore index 939e6a8..9aba51d 100755 --- a/scripts/restore +++ b/scripts/restore @@ -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,14 +105,14 @@ 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 --logfile="$final_path/horde" --nonappend --specific_user www-data/horde ynh_use_logrotate --logfile="$final_path/horde/services" --specific_user www-data/horde @@ -124,7 +123,7 @@ ynh_use_logrotate --logfile="$final_path/horde/services/portal" --specific_user #================================================= # 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 diff --git a/scripts/upgrade b/scripts/upgrade index 84233a3..3241fc5 100755 --- a/scripts/upgrade +++ b/scripts/upgrade @@ -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,7 +137,7 @@ set_permission #================================================= # SETUP LOGROTATE #================================================= -ynh_script_progression --message="Upgrading logrotate configuration..." +ynh_script_progression --message="Upgrading logrotate configuration..." --weight=1 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 @@ -137,7 +146,7 @@ ynh_use_logrotate --logfile="$final_path/horde/services/portal" --specific_user #================================================= # 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 From fc06ac6b1af6c738f9ed72196e7c7143adaa3b90 Mon Sep 17 00:00:00 2001 From: yunohost-bot Date: Tue, 30 Aug 2022 22:06:12 +0000 Subject: [PATCH 3/4] Auto-update README --- README.md | 4 ++-- README_fr.md | 4 ++-- 2 files changed, 4 insertions(+), 4 deletions(-) diff --git a/README.md b/README.md index ebed694..4d558c2 100644 --- a/README.md +++ b/README.md @@ -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 @@ -84,7 +84,7 @@ For calendar, task and addressbook activeSync has been configured but not yet te * Official app website: * Official admin documentation: -* Upstream app code repository: +* Upstream app code repository: * YunoHost documentation for this app: * Report a bug: diff --git a/README_fr.md b/README_fr.md index d825e07..4af43a5 100644 --- a/README_fr.md +++ b/README_fr.md @@ -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 @@ -84,7 +84,7 @@ For calendar, task and addressbook activeSync has been configured but not yet te * Site officiel de l'app : * Documentation officielle de l'admin : -* Dépôt de code officiel de l'app : +* Dépôt de code officiel de l'app : * Documentation YunoHost pour cette app : * Signaler un bug : From 3188862a6e7208f9e8718466657985548ff050ba Mon Sep 17 00:00:00 2001 From: yunohost-bot Date: Fri, 4 Nov 2022 07:11:21 +0000 Subject: [PATCH 4/4] Auto-update README --- README_fr.md | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/README_fr.md b/README_fr.md index 6ab155b..990e8e6 100644 --- a/README_fr.md +++ b/README_fr.md @@ -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.23~ynh1 +**Version incluse :** 5.2.23~ynh1 **Démo :** http://demo.horde.org