From da7a2491a8b757db84baffe0eef46beb67d35345 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?=C3=89ric=20Gaspar?= <46165813+ericgaspar@users.noreply.github.com> Date: Mon, 2 Nov 2020 08:07:27 +0100 Subject: [PATCH 1/8] Update manifest.json --- manifest.json | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/manifest.json b/manifest.json index 4684cdd6..aeaf676a 100644 --- a/manifest.json +++ b/manifest.json @@ -15,7 +15,7 @@ }, "services": [ "nginx", - "php7.3-fpm", + "php7.0-fpm", "mysql", "postgresql" ], From faf02d2cbedf0b0a9b24908c27854b6b31abcf40 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?=C3=89ric=20Gaspar?= <46165813+ericgaspar@users.noreply.github.com> Date: Wed, 4 Nov 2020 22:17:01 +0100 Subject: [PATCH 2/8] Update README.md --- README.md | 46 ++++++++++++++++++++++++++-------------------- 1 file changed, 26 insertions(+), 20 deletions(-) diff --git a/README.md b/README.md index 26dd0219..985d0652 100644 --- a/README.md +++ b/README.md @@ -1,6 +1,6 @@ # Hubzilla for YunoHost -[![Integration level](https://dash.yunohost.org/integration/hubzilla.svg)](https://dash.yunohost.org/appci/app/hubzilla) +[![Integration level](https://dash.yunohost.org/integration/hubzilla.svg)](https://dash.yunohost.org/appci/app/hubzilla) ![](https://ci-apps.yunohost.org/ci/badges/hubzilla.status.svg) ![](https://ci-apps.yunohost.org/ci/badges/hubzilla.maintain.svg) [![Install Nextcloud with YunoHost](https://install-app.yunohost.org/install-with-yunohost.png)](https://install-app.yunohost.org/?app=hubzilla) > *This package allow you to install Hubzilla quickly and simply on a YunoHost server. @@ -8,39 +8,26 @@ If you don't have YunoHost, please see [here](https://yunohost.org/#/install) to Version: **4.7.2** -### Interesting links - -- [YunoHost project](https://yunohost.org) -- [Hubzilla website](https://zotlabs.org/page/hubzilla/hubzilla-project) -- [Hubzilla code on Framagit](https://framagit.org/hubzilla/core) -- [Hubzilla addons on Framagit](https://framagit.org/hubzilla/addons) - - -## Hubzilla +## Overview [Hubzilla](https://hub.libranet.de/directory?f=&global=1&pubforums=1) is a social networking platform built with control of your privacy at center stage. Your online communications can be as public as you wish or as private as you require. Private conversations, private photos, private videos. Your media isn't hidden behind an obscure URL which can be guessed, it is protected by state-of-the-art cross-domain authentication. What this all means for you: **less drama**. +## Screenshots + ![](https://fediverse.party/img/screenshots/hubzilla-1.png) - - ## This app claims following features: - [X] Ldap integration - [X] Multi-instance - [X] Adeed php.log in the root folder for debugging php, with logrotate applied on it (can be accesssed by **admin->logs** and entering the **php.log**). - [X] Fail2ban -- [X] Choose between **Mysql** and -**PostgreSQL** database to be used for the Hubzilla while installation. - - +- [X] Choose between **Mysql** and **PostgreSQL** database to be used for the Hubzilla while installation. ## Installation Before installing, read the [Hubzilla installation instructions](https://framagit.org/hubzilla/core/blob/master/install/INSTALL.txt) for important information about: - ### Register a new domain and add it to YunoHost - Hubzilla requires a dedicated domain, so obtain one and add it using the YunoHost admin panel. **Domains -> Add domain**. As Hubzilla uses the full domain and is installed on the root, you can create a subdomain such as hubzilla.domain.tld. Don't forget to update your DNS if you manage them manually. - ## Ldap Admin user rights, logs and failed database updates - **For admin rights**: When installation is complete, you will need to visit your new hub's page and login with the **admin account username** which was entered at the time of installation process. You should then be able to create your first channel and have the **admin rights** for the hub. @@ -55,6 +42,25 @@ Before installing, read the [Hubzilla installation instructions](https://framagi #### Supported architectures -* x86-64b - [![Build Status](https://ci-apps.yunohost.org/ci/logs/hubzilla%20%28Official%29.svg)](https://ci-apps.yunohost.org/ci/apps/hubzilla/) +* x86-64 - [![Build Status](https://ci-apps.yunohost.org/ci/logs/hubzilla%20%28Official%29.svg)](https://ci-apps.yunohost.org/ci/apps/hubzilla/) * ARMv8-A - [![Build Status](https://ci-apps-arm.yunohost.org/ci/logs/hubzilla%20%28Official%29.svg)](https://ci-apps-arm.yunohost.org/ci/apps/hubzilla/) -* Jessie x86-64b - [![Build Status](https://ci-stretch.nohost.me/ci/logs/hubzilla%20%28Official%29.svg)](https://ci-stretch.nohost.me/ci/apps/hubzilla/) + +## Links + + * Report a bug: https://github.com/YunoHost-Apps/hubzilla_ynh/issues + * App website: https://zotlabs.org/page/hubzilla/hubzilla-project + * Upstream app repository: https://framagit.org/hubzilla/core + * YunoHost website: https://yunohost.org/ + +--- + +## Developer info + +Please send your pull request to the [testing branch](https://github.com/YunoHost-Apps/hubzilla_ynh/tree/testing). + +To try the testing branch, please proceed like that. +``` +sudo yunohost app install https://github.com/YunoHost-Apps/hubzilla_ynh/tree/testing --debug +or +sudo yunohost app upgrade hubzilla -u https://github.com/YunoHost-Apps/hubzilla_ynh/tree/testing --debug +``` From 01cdea29e7d93c33e14a16a9faf2ec461d43eb68 Mon Sep 17 00:00:00 2001 From: Alexandre Aubin Date: Mon, 9 Nov 2020 15:56:33 +0100 Subject: [PATCH 3/8] rm -r -> ynh_secure_temove --- scripts/upgrade | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/scripts/upgrade b/scripts/upgrade index 88806148..c0b5135e 100755 --- a/scripts/upgrade +++ b/scripts/upgrade @@ -88,7 +88,7 @@ ynh_script_progression --message="Upgrading source files..." cp -a "$tmpdir/store" "${final_path}" cp -a "$tmpdir/.htconfig.php" "${final_path}" cp -a "$tmpdir/php.log" "${final_path}" -rm -Rf "$tmpdir" +ynh_secure_remove "$tmpdir" chmod -R 777 $final_path/store mkdir $final_path/addon ynh_setup_source --dest_dir="$final_path/addon" --source_id="app_addons" From fcea07e7ce2e0ef9f6418b7f1ae4ac9fbd73d1e4 Mon Sep 17 00:00:00 2001 From: anmol Date: Fri, 13 Nov 2020 04:15:25 +0530 Subject: [PATCH 4/8] Updated to version 5.0.1 --- README.md | 4 ++-- conf/app.src | 4 ++-- conf/app_addons.src | 4 ++-- manifest.json | 2 +- scripts/upgrade | 7 +++++-- 5 files changed, 12 insertions(+), 9 deletions(-) diff --git a/README.md b/README.md index 985d0652..244a742e 100644 --- a/README.md +++ b/README.md @@ -1,12 +1,12 @@ # Hubzilla for YunoHost -[![Integration level](https://dash.yunohost.org/integration/hubzilla.svg)](https://dash.yunohost.org/appci/app/hubzilla) ![](https://ci-apps.yunohost.org/ci/badges/hubzilla.status.svg) ![](https://ci-apps.yunohost.org/ci/badges/hubzilla.maintain.svg) +[![Integration level](https://dash.yunohost.org/integration/hubzilla.svg)](https://dash.yunohost.org/appci/app/hubzilla) ![](https://ci-apps.yunohost.org/ci/badges/hubzilla.status.svg) ![](https://ci-apps.yunohost.org/ci/badges/hubzilla.maintain.svg) [![Install Nextcloud with YunoHost](https://install-app.yunohost.org/install-with-yunohost.png)](https://install-app.yunohost.org/?app=hubzilla) > *This package allow you to install Hubzilla quickly and simply on a YunoHost server. If you don't have YunoHost, please see [here](https://yunohost.org/#/install) to know how to install and enjoy it.* -Version: **4.7.2** +Version: **5.0.1** ## Overview [Hubzilla](https://hub.libranet.de/directory?f=&global=1&pubforums=1) is a social networking platform built with control of your privacy at center stage. Your online communications can be as public as you wish or as private as you require. Private conversations, private photos, private videos. Your media isn't hidden behind an obscure URL which can be guessed, it is protected by state-of-the-art cross-domain authentication. What this all means for you: **less drama**. diff --git a/conf/app.src b/conf/app.src index 46d1761e..352212dd 100644 --- a/conf/app.src +++ b/conf/app.src @@ -1,5 +1,5 @@ -SOURCE_URL=https://framagit.org/hubzilla/core/-/archive/4.7.2/core-4.7.2.tar.gz -SOURCE_SUM=4e3e52e86fb4b722974d008bfbe3d70d3395725275b77db5ab6f4a053a27c659 +SOURCE_URL=https://framagit.org/hubzilla/core/-/archive/5.0.1/core-5.0.1.tar.gz +SOURCE_SUM=01be787c957d4d115b64bccd2ab4b958a206c27726456cc76e474373ad9f5ae3 SOURCE_SUM_PRG=sha256sum SOURCE_FORMAT=tar.gz SOURCE_IN_SUBDIR= diff --git a/conf/app_addons.src b/conf/app_addons.src index 31063efa..99b43496 100644 --- a/conf/app_addons.src +++ b/conf/app_addons.src @@ -1,5 +1,5 @@ -SOURCE_URL=https://framagit.org/hubzilla/addons/-/archive/4.6/addons-4.6.tar.gz -SOURCE_SUM=efa095918a8698a62fa6596aa403da9ee9ab4b11a76ec0fb101666a716b84324 +SOURCE_URL=https://framagit.org/hubzilla/addons/-/archive/5.0.1/addons-5.0.1.tar.gz +SOURCE_SUM=192c02fcd4ead32e0a1e00884c593d962a1339719e3fb24071693efc66d0c685 SOURCE_SUM_PRG=sha256sum SOURCE_FORMAT=tar.gz SOURCE_IN_SUBDIR= diff --git a/manifest.json b/manifest.json index aeaf676a..a2000547 100644 --- a/manifest.json +++ b/manifest.json @@ -8,7 +8,7 @@ }, "url": "https://zotlabs.org/page/hubzilla/hubzilla-project", "license": "MIT", - "version": "4.7.2~ynh2", + "version": "5.0.1~ynh2", "maintainer": { "name": "Anmol Sharma", "email": "anmol@datamol.org" diff --git a/scripts/upgrade b/scripts/upgrade index c0b5135e..ffbc0a53 100755 --- a/scripts/upgrade +++ b/scripts/upgrade @@ -164,12 +164,15 @@ if [ $database -eq 1 ]; then ynh_mysql_connect_as "$db_name" "$db_pwd" "$db_name" < "../conf/sql/385.sql" fi - elif [ $database -eq 2 ]; then ynh_install_app_dependencies $pkg_dependencies fi - +if [ -z "$last_update" ] && [ $version -lt 5.0.0 ] && [ $version -nt 5.0.0 ] && [ -f "$final_path/util/z6convert.php" ] ; then + pushd "$final_path" + php${YNH_PHP_VERSION} util/z6convert.php + popd +fi #================================================= # SETUP SSOWAT From 3cf4b8839160014fe1a0c6c8e45261475bdf2b77 Mon Sep 17 00:00:00 2001 From: anmol Date: Fri, 13 Nov 2020 04:16:26 +0530 Subject: [PATCH 5/8] Fix manifest version --- manifest.json | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/manifest.json b/manifest.json index a2000547..b7fa093d 100644 --- a/manifest.json +++ b/manifest.json @@ -8,7 +8,7 @@ }, "url": "https://zotlabs.org/page/hubzilla/hubzilla-project", "license": "MIT", - "version": "5.0.1~ynh2", + "version": "5.0.1~ynh1", "maintainer": { "name": "Anmol Sharma", "email": "anmol@datamol.org" From c267cb589e4862328891af0ffb955875fb0f006e Mon Sep 17 00:00:00 2001 From: anmol Date: Fri, 13 Nov 2020 05:44:46 +0530 Subject: [PATCH 6/8] Check version fix in upgrade script --- README.md | 3 ++- scripts/upgrade | 8 +++++--- 2 files changed, 7 insertions(+), 4 deletions(-) diff --git a/README.md b/README.md index 244a742e..67b74d03 100644 --- a/README.md +++ b/README.md @@ -1,7 +1,8 @@ # Hubzilla for YunoHost [![Integration level](https://dash.yunohost.org/integration/hubzilla.svg)](https://dash.yunohost.org/appci/app/hubzilla) ![](https://ci-apps.yunohost.org/ci/badges/hubzilla.status.svg) ![](https://ci-apps.yunohost.org/ci/badges/hubzilla.maintain.svg) -[![Install Nextcloud with YunoHost](https://install-app.yunohost.org/install-with-yunohost.png)](https://install-app.yunohost.org/?app=hubzilla) + +[![Install Hubzilla with YunoHost](https://install-app.yunohost.org/install-with-yunohost.png)](https://install-app.yunohost.org/?app=hubzilla) > *This package allow you to install Hubzilla quickly and simply on a YunoHost server. If you don't have YunoHost, please see [here](https://yunohost.org/#/install) to know how to install and enjoy it.* diff --git a/scripts/upgrade b/scripts/upgrade index ffbc0a53..64b3b711 100755 --- a/scripts/upgrade +++ b/scripts/upgrade @@ -160,17 +160,19 @@ if [ $database -eq 1 ]; then # Check version and if this version was a fresh install push mysq query db_name=$(ynh_app_setting_get --app=$app --key=db_name) db_pwd=$(ynh_app_setting_get --app=$app --key=mysqlpwd) - if [ -z "$last_update" ] && [ "$version" == "3.8.4" ]; then + is_version_equal_three_eight_four=$(awk 'BEGIN{ print "'$version'"<"'3.8.4'" }') + if [ -z "$last_update" ] && [ "$is_version_equal_three_eight_four" -eq 1 ]; then ynh_mysql_connect_as "$db_name" "$db_pwd" "$db_name" < "../conf/sql/385.sql" fi elif [ $database -eq 2 ]; then ynh_install_app_dependencies $pkg_dependencies fi +is_version_less_then_five=$(awk 'BEGIN{ print "'$version'"<"'5.0.0'" }') -if [ -z "$last_update" ] && [ $version -lt 5.0.0 ] && [ $version -nt 5.0.0 ] && [ -f "$final_path/util/z6convert.php" ] ; then +if [ "$is_version_less_then_five" -eq 1 ] && [ -f "$final_path/util/z6convert.php" ] ; then pushd "$final_path" - php${YNH_PHP_VERSION} util/z6convert.php + php${YNH_PHP_VERSION} util/z6convert.php popd fi From 2f65d50fb30e4481e7dfe28c26390a87ad59bc3a Mon Sep 17 00:00:00 2001 From: ericgaspar Date: Fri, 13 Nov 2020 11:25:58 +0100 Subject: [PATCH 7/8] Small Fixes --- README.md | 21 ++++++------ check_process | 11 ------- conf/php-fpm.conf | 2 +- manifest.json | 6 ++-- pull_request_template.md | 2 +- scripts/_common.sh | 3 +- scripts/backup | 22 ++++++------- scripts/install | 70 ---------------------------------------- scripts/remove | 11 +++---- scripts/restore | 4 --- scripts/upgrade | 20 +++++------- 11 files changed, 38 insertions(+), 134 deletions(-) diff --git a/README.md b/README.md index 67b74d03..dabd4098 100644 --- a/README.md +++ b/README.md @@ -1,26 +1,25 @@ # Hubzilla for YunoHost -[![Integration level](https://dash.yunohost.org/integration/hubzilla.svg)](https://dash.yunohost.org/appci/app/hubzilla) ![](https://ci-apps.yunohost.org/ci/badges/hubzilla.status.svg) ![](https://ci-apps.yunohost.org/ci/badges/hubzilla.maintain.svg) - +[![Integration level](https://dash.yunohost.org/integration/hubzilla.svg)](https://dash.yunohost.org/appci/app/hubzilla) ![](https://ci-apps.yunohost.org/ci/badges/hubzilla.status.svg) ![](https://ci-apps.yunohost.org/ci/badges/hubzilla.maintain.svg) [![Install Hubzilla with YunoHost](https://install-app.yunohost.org/install-with-yunohost.png)](https://install-app.yunohost.org/?app=hubzilla) > *This package allow you to install Hubzilla quickly and simply on a YunoHost server. If you don't have YunoHost, please see [here](https://yunohost.org/#/install) to know how to install and enjoy it.* -Version: **5.0.1** - ## Overview [Hubzilla](https://hub.libranet.de/directory?f=&global=1&pubforums=1) is a social networking platform built with control of your privacy at center stage. Your online communications can be as public as you wish or as private as you require. Private conversations, private photos, private videos. Your media isn't hidden behind an obscure URL which can be guessed, it is protected by state-of-the-art cross-domain authentication. What this all means for you: **less drama**. +**Shipped version:** 5.0.1 + ## Screenshots ![](https://fediverse.party/img/screenshots/hubzilla-1.png) ## This app claims following features: -- [X] Ldap integration +- [X] LDAP integration - [X] Multi-instance -- [X] Adeed php.log in the root folder for debugging php, with logrotate applied on it (can be accesssed by **admin->logs** and entering the **php.log**). -- [X] Fail2ban +- [X] Adeed php.log in the root folder for debugging PHP, with logrotate applied on it (can be accesssed by **admin->logs** and entering the **php.log**). +- [X] Fail2Ban - [X] Choose between **Mysql** and **PostgreSQL** database to be used for the Hubzilla while installation. ## Installation @@ -33,13 +32,13 @@ Before installing, read the [Hubzilla installation instructions](https://framagi - **For admin rights**: When installation is complete, you will need to visit your new hub's page and login with the **admin account username** which was entered at the time of installation process. You should then be able to create your first channel and have the **admin rights** for the hub. -- **For normal YunoHost users :** Normal LDAP users can login through Ldap authentication and create there channels. +- **For normal YunoHost users**: Normal LDAP users can login through LDAP authentication and create there channels. -- **Failing to get admin rights :** If the admin cannot access the admin settings at `https://hubzilla.example.com/admin` or you want to grant admin rights to any other user(s) on the hub, then you have to **manually add 4096** to the **account_roles** under **accounts** for that user in the **database through phpMYAdmin**. +- **Failing to get admin rights**: If the admin cannot access the admin settings at `https://hubzilla.example.com/admin` or you want to grant admin rights to any other user(s) on the hub, then you have to **manually add 4096** to the **account_roles** under **accounts** for that user in the **database through phpMyAdmin**. -- **For logs :** Go to **admin->logs** and enter the file name **php.log**. +- **For logs**: Go to **admin->logs** and enter the file name **php.log**. -- **Failed Database after Upgrade :** Some times databse upgrade fails after version upgrade. You can go to hub eg. `https://hubzilla.example.com/admin/dbsync/` and check the numbers of failled update. These updates will have to be ran manually by **phpMYAdmin**. +- **Failed Database after Upgrade:** Some times databse upgrade fails after version upgrade. You can go to hub eg. `https://hubzilla.example.com/admin/dbsync/` and check the numbers of failled update. These updates will have to be ran manually by **phpMyAdmin**. #### Supported architectures diff --git a/check_process b/check_process index 1735054e..1ba8a5ce 100644 --- a/check_process +++ b/check_process @@ -23,18 +23,7 @@ port_already_use=0 change_url=0 ;;; Levels - Level 1=auto - Level 2=auto - Level 3=auto -# Level 4: If the app supports LDAP and SSOwat, turn level 4 to '1' and add a link to an issue or a part of your code to show it. -# If the app does not use LDAP nor SSOwat, and can't use them, turn level 4 to 'na' and explain as well. - Level 4=1 Level 5=auto - Level 6=auto - Level 7=auto - Level 8=0 - Level 9=0 - Level 10=0 ;;; Options Email=anmol@datamol.org Notification=change diff --git a/conf/php-fpm.conf b/conf/php-fpm.conf index 8de19d96..aefd3279 100644 --- a/conf/php-fpm.conf +++ b/conf/php-fpm.conf @@ -33,7 +33,7 @@ group = __USER__ ; (IPv6 and IPv4-mapped) on a specific port; ; '/path/to/unix/socket' - to listen on a unix socket. ; Note: This value is mandatory. -listen = /var/run/php/php7.0-fpm-__NAMETOCHANGE__.sock +listen = /var/run/php/php__PHPVERSION__-fpm-__NAMETOCHANGE__.sock ; Set listen(2) backlog. ; Default Value: 511 (-1 on FreeBSD and OpenBSD) diff --git a/manifest.json b/manifest.json index b7fa093d..90771692 100644 --- a/manifest.json +++ b/manifest.json @@ -3,8 +3,8 @@ "id": "hubzilla", "name": "Hubzilla", "description": { - "en": "A decentralized publication platform and social network.", - "fr": "Une plateforme de publication décentralisée et un réseau social." + "en": "Decentralized publication platform and social network.", + "fr": "Plateforme de publication décentralisée et un réseau social." }, "url": "https://zotlabs.org/page/hubzilla/hubzilla-project", "license": "MIT", @@ -50,7 +50,7 @@ "type": "string", "ask": { "en": "Choose the database to be used for the Hubzilla [mysql:1,postgresql:2]", - "fr": "Choisissez la database de l'Hubzilla [mysql:1,postgresql:2]" + "fr": "Choisissez la database de Hubzilla [mysql:1,postgresql:2]" }, "choices": ["1", "2"], "default": "1" diff --git a/pull_request_template.md b/pull_request_template.md index 0287f9f8..a24e893c 100644 --- a/pull_request_template.md +++ b/pull_request_template.md @@ -15,4 +15,4 @@ --- *If you have access to [App Continuous Integration for packagers](https://yunohost.org/#/packaging_apps_ci) you can provide a link to the package_check results like below, replacing '-NUM-' in this link by the PR number and USERNAME by your username on the ci-apps-dev. Or you provide a screenshot or a pastebin of the results* -[![Build Status](https://ci-apps-dev.yunohost.org/jenkins/job/REPLACEBYYOURAPP_ynh%20PR-NUM-%20(USERNAME)/badge/icon)](https://ci-apps-dev.yunohost.org/jenkins/job/REPLACEBYYOURAPP_ynh%20PR-NUM-%20(USERNAME)/) +[![Build Status](https://ci-apps-dev.yunohost.org/jenkins/job/hubzilla_ynh%20PR-NUM-%20(USERNAME)/badge/icon)](https://ci-apps-dev.yunohost.org/jenkins/job/hubzilla_ynh%20PR-NUM-%20(USERNAME)/) diff --git a/scripts/_common.sh b/scripts/_common.sh index 1f7e8638..a39842c0 100644 --- a/scripts/_common.sh +++ b/scripts/_common.sh @@ -8,6 +8,7 @@ YNH_PHP_VERSION="7.3" extra_php_dependencies="php${YNH_PHP_VERSION}-mbstring php${YNH_PHP_VERSION}-cli php${YNH_PHP_VERSION}-imagick php${YNH_PHP_VERSION}-xml php${YNH_PHP_VERSION}-zip php${YNH_PHP_VERSION}-pgsql php${YNH_PHP_VERSION}-json php${YNH_PHP_VERSION}-gd" + # dependencies used by the app pkg_dependencies="postgresql postgresql-contrib" @@ -42,7 +43,7 @@ ynh_smart_mktemp () { ynh_die "Insufficient free space to continue..." fi - echo "$(sudo mktemp --directory --tmpdir="$tmpdir")" + echo "$(mktemp --directory --tmpdir="$tmpdir")" } #================================================= # FUTURE OFFICIAL HELPERS diff --git a/scripts/backup b/scripts/backup index 40bc780b..337578d3 100644 --- a/scripts/backup +++ b/scripts/backup @@ -6,7 +6,6 @@ # IMPORT GENERIC HELPERS #================================================= -#Keep this path for calling _common.sh inside the execution's context of backup and restore scripts source ../settings/scripts/_common.sh source /usr/share/yunohost/helpers @@ -34,49 +33,47 @@ phpversion=$(ynh_app_setting_get --app=$app --key=phpversion) database=$(ynh_app_setting_get --app=$app --key=database) #================================================= -# STANDARD BACKUP STEPS +# DECLARE DATA AND CONF FILES TO BACKUP +#================================================= +ynh_print_info --message="Declaring files to be backed up..." + #================================================= # BACKUP THE APP MAIN DIR #================================================= -ynh_script_progression --message="Backing up the main app directory..." ynh_backup --src_path="$final_path" #================================================= # BACKUP THE NGINX CONFIGURATION #================================================= -ynh_script_progression --message="Backing up nginx web server configuration..." ynh_backup --src_path="/etc/nginx/conf.d/$domain.d/$app.conf" #================================================= # BACKUP THE PHP-FPM CONFIGURATION #================================================= -ynh_script_progression --message="Backing up php-fpm configuration..." ynh_backup --src_path="/etc/php/$phpversion/fpm/pool.d/$app.conf" #================================================= # BACKUP OF THE DATABASE #================================================= -ynh_script_progression --message="Backing up the MySQL database..." if [ $database -eq 1 ]; then - ynh_script_progression --message="Backup of the MySQL database..." + # Backup MySQL database + ynh_print_info --message="Backup of the MySQL database..." ynh_mysql_dump_db --database="$db_name" > db.sql elif [ $database -eq 2 ]; then - # Removing postgresql database - ynh_script_progression --message="Backup of the postgresql database..." + # Backup PostgreSQL database + ynh_print_info --message="Backup of the PostgreSQL database..." ynh_psql_dump_db --database="$db_name" > db.sql fi - #================================================= # SPECIFIC BACKUP #================================================= # BACKUP LOGROTATE #================================================= -ynh_script_progression --message="Backing up logrotate configuration..." ynh_backup --src_path="/etc/logrotate.d/$app" @@ -89,7 +86,6 @@ ynh_backup --src_path="/etc/cron.d/$app" #================================================= # BACKUP FAIL2BAN CONFIGURATION #================================================= -ynh_script_progression --message="Backing up fail2ban configuration..." ynh_backup --src_path="/etc/fail2ban/jail.d/$app.conf" ynh_backup --src_path="/etc/fail2ban/filter.d/$app.conf" @@ -98,4 +94,4 @@ ynh_backup --src_path="/etc/fail2ban/filter.d/$app.conf" # END OF SCRIPT #================================================= -ynh_script_progression --message="Backup script completed for $app. (YunoHost will then actually copy those files to the archive)." +ynh_print_info --message="Backup script completed for $app. (YunoHost will then actually copy those files to the archive)." diff --git a/scripts/install b/scripts/install index c56feb3c..7d4ab060 100755 --- a/scripts/install +++ b/scripts/install @@ -32,33 +32,13 @@ upload="256M" random_string="$(ynh_string_random)$(ynh_string_random)$(ynh_string_random)" database=`expr $YNH_APP_ARG_DATABASE` -### If it's a multi-instance app, meaning it can be installed several times independently -### The id of the app as stated in the manifest is available as $YNH_APP_ID -### The instance number is available as $YNH_APP_INSTANCE_NUMBER (equals "1", "2", ...) -### The app instance name is available as $YNH_APP_INSTANCE_NAME -### - the first time the app is installed, YNH_APP_INSTANCE_NAME = ynhexample -### - the second time the app is installed, YNH_APP_INSTANCE_NAME = ynhexample__2 -### - ynhexample__{N} for the subsequent installations, with N=3,4, ... -### The app instance name is probably what interests you most, since this is -### guaranteed to be unique. This is a good unique identifier to define installation path, -### db names, ... app=$YNH_APP_INSTANCE_NAME #================================================= # CHECK IF THE APP CAN BE INSTALLED WITH THESE ARGS #================================================= -### About --weight and --time -### ynh_script_progression will show to your final users the progression of each scripts. -### In order to do that, --weight will represent the relative time of execution compared to the other steps in the script. -### --time is a packager option, it will show you the execution time since the previous call. -### This option should be removed before releasing your app. -### Use the execution time, given by --time, to estimate the weight of a step. -### A common way to do it is to set a weight equal to the execution time in second +1. -### The execution time is given for the duration since the previous call. So the weight should be applied to this previous call. ynh_script_progression --message="Validating installation parameters..." -### If the app uses nginx as web server (written in HTML/PHP in most cases), the final path should be "/var/www/$app". -### If the app provides an internal web server (or uses another application server such as uwsgi), the final path should be "/opt/yunohost/$app" final_path=/var/www/$app test ! -e "$final_path" || ynh_die --message="This path already contains a folder" @@ -85,14 +65,6 @@ ynh_app_setting_set --app=$app --key=random_string --value=$random_string #================================================= ynh_script_progression --message="Installing dependencies..." -### `ynh_install_app_dependencies` allows you to add any "apt" dependencies to the package. -### Those deb packages will be installed as dependencies of this package. -### If you're not using this helper: -### - Remove the section "REMOVE DEPENDENCIES" in the remove script -### - Remove the variable "pkg_dependencies" in _common.sh -### - As well as the section "REINSTALL DEPENDENCIES" in the restore script -### - And the section "UPGRADE DEPENDENCIES" in the upgrade script - if [ $database -eq 2 ]; then ynh_install_app_dependencies $pkg_dependencies fi @@ -104,10 +76,6 @@ fi # 1 - Hubzilla ynh_script_progression --message="Setting up Hubzilla source files..." -### `ynh_setup_source` is used to install an app from a zip or tar.gz file, -### downloaded from an upstream source, like a git repository. -### `ynh_setup_source` use the file conf/app.src - ynh_app_setting_set --app=$app --key=final_path --value=$final_path # Download, check integrity, uncompress and patch the source from app.src ynh_setup_source --dest_dir="$final_path" @@ -121,14 +89,12 @@ ynh_script_progression --message="Setting up Hubzilla addons source files..." ynh_setup_source --dest_dir="$final_path/addon" --source_id="app_addons" - # 3 - Some extra folders ynh_script_progression --message="Creating smarty3 folder for personal data..." mkdir -p "${final_path}/store/[data]/smarty3" chmod -R 777 $final_path/store - # Copy the template install/htconfig.sample.php to .htconfig.php ynh_script_progression --message="Moving .htconfig.php to root of Hubzilla ..." config="$final_path/.htconfig.php" @@ -142,16 +108,6 @@ touch "$final_path/php.log" # CREATE A DATABASE #================================================= - -### Use these lines if you need a database for the application. -### `ynh_mysql_setup_db` will create a database, an associated user and a ramdom password. -### The password will be stored as 'mysqlpwd' into the app settings, -### and will be available as $db_pwd -### If you're not using these lines: -### - Remove the section "BACKUP THE MYSQL DATABASE" in the backup script -### - Remove also the section "REMOVE THE MYSQL DATABASE" in the remove script -### - As well as the section "RESTORE THE MYSQL DATABASE" in the restore script - if [ $database -eq 1 ]; then ynh_script_progression --message="Creating a MySQL database..." db_name=$(ynh_sanitize_dbid --db_name=$app) @@ -180,8 +136,6 @@ fi # MODIFY A CONFIG FILE #================================================= -### `ynh_replace_string` is used to replace a string in a file. -### (It's compatible with sed regular expressions syntax) phpversion=$(ynh_app_setting_get --app=$app --key=phpversion) ynh_replace_string --match_string="your.mysqlhost.com" --replace_string="localhost" --target_file="$config" ynh_replace_string --match_string= "mysqlpassword" --replace_string="$db_pwd" --target_file="$config" @@ -201,7 +155,6 @@ ynh_script_progression --message="Push Ldap configuration to .htconfig.php..." cat ../conf/ldap_conf.php >> $final_path/.htconfig.php - #================================================= # NGINX CONFIGURATION #================================================= @@ -224,17 +177,6 @@ ynh_system_user_create --username=$app #================================================= ynh_script_progression --message="Configuring php-fpm..." -### `ynh_add_fpm_config` is used to set up a PHP config. -### You can remove it if your app doesn't use PHP. -### `ynh_add_fpm_config` will use the files conf/php-fpm.conf -### If you're not using these lines: -### - You can remove these files in conf/. -### - Remove the section "BACKUP THE PHP-FPM CONFIGURATION" in the backup script -### - Remove also the section "REMOVE PHP-FPM CONFIGURATION" in the remove script -### - As well as the section "RESTORE THE PHP-FPM CONFIGURATION" in the restore script -### With the reload at the end of the script. -### - And the section "PHP-FPM CONFIGURATION" in the upgrade script - # Create a dedicated php-fpm config ynh_add_fpm_config --package="$extra_php_dependencies" @@ -253,10 +195,6 @@ cp ../conf/poller-cron /etc/cron.d/$app # STORE THE CONFIG FILE CHECKSUM #================================================= -### `ynh_store_file_checksum` is used to store the checksum of a file. -### That way, during the upgrade script, by using `ynh_backup_if_checksum_is_different`, -### you can make a backup of this file before modifying it again if the admin had modified it. - # Calculate and store the config file checksum into the app settings ynh_store_file_checksum --file="$config" @@ -265,14 +203,6 @@ ynh_store_file_checksum --file="$config" #================================================= ynh_script_progression --message="Configuring log rotation..." -### `ynh_use_logrotate` is used to configure a logrotate configuration for the logs of this app. -### Use this helper only if there is effectively a log file for this app. -### If you're not using this helper: -### - Remove the section "BACKUP LOGROTATE" in the backup script -### - Remove also the section "REMOVE LOGROTATE CONFIGURATION" in the remove script -### - As well as the section "RESTORE THE LOGROTATE CONFIGURATION" in the restore script -### - And the section "SETUP LOGROTATE" in the upgrade script - # Use logrotate to manage application logfile(s) ynh_use_logrotate "$final_path/php.log" diff --git a/scripts/remove b/scripts/remove index 8a368955..65fde16d 100755 --- a/scripts/remove +++ b/scripts/remove @@ -22,24 +22,22 @@ db_user="$db_name" final_path=$(ynh_app_setting_get --app=$app --key=final_path) database=$(ynh_app_setting_get --app=$app --key=database) - #================================================= # STANDARD REMOVE -#================================================= - #================================================= # REMOVE THE DATABASE #================================================= + if [ $database -eq 1 ]; then + # Removing MySQL database ynh_script_progression --message="Removing MySQL database..." ynh_mysql_remove_db --db_user=$db_user --db_name=$db_name elif [ $database -eq 2 ]; then - # Removing postgresql database + # Removing PostgreSQL database ynh_script_progression --message="Removing postgresql database..." ynh_psql_remove_db --db_user=$db_user --db_name=$db_name fi - #================================================= # REMOVE DEPENDENCIES #================================================= @@ -87,7 +85,6 @@ ynh_remove_logrotate # Remove a cron file ynh_secure_remove --file="/etc/cron.d/$app" - #================================================= # REMOVE FAIL2BAN CONFIGURATION #================================================= @@ -109,4 +106,4 @@ ynh_system_user_delete --username=$app # END OF SCRIPT #================================================= -ynh_script_progression --message="Removal of $app completed" \ No newline at end of file +ynh_script_progression --message="Removal of $app completed" diff --git a/scripts/restore b/scripts/restore index cfaefc1d..3a7126e3 100644 --- a/scripts/restore +++ b/scripts/restore @@ -84,9 +84,6 @@ elif [ $database -eq 2 ]; then ynh_psql_execute_file_as_root --file="./db.sql" --database="$db_name" fi - - - #================================================= # RECREATE THE DEDICATED USER #================================================= @@ -108,7 +105,6 @@ ynh_add_fpm_config --package="$extra_php_dependencies" #================================================= # SPECIFIC RESTORATION #================================================= -#================================================= # RESTORE THE CRON FILE #================================================= diff --git a/scripts/upgrade b/scripts/upgrade index 64b3b711..e66d8979 100755 --- a/scripts/upgrade +++ b/scripts/upgrade @@ -35,7 +35,6 @@ if [ -z "$db_name" ]; then ynh_app_setting_set --app=$app --key=db_name --value=$db_name fi - #================================================= # BACKUP BEFORE UPGRADE THEN ACTIVE TRAP #================================================= @@ -50,13 +49,13 @@ ynh_clean_setup () { # Exit if an error occurs during the execution of the script ynh_abort_if_errors - #================================================= # STANDARD UPGRADE STEPS #================================================= # REMOVE APP MAIN DIR #================================================= ynh_print_info "Upgrading source files..." + # Create a temporary directory tmpdir="$(ynh_smart_mktemp 6000)" # Backup the config file in the temp dir @@ -64,7 +63,6 @@ cp -a "$final_path/.htconfig.php" "$tmpdir/.htconfig.php" cp -a "$final_path/store" "$tmpdir/store" cp -a "$final_path/php.log" "$tmpdir/php.log" - # Remove the app directory securely ynh_secure_remove "$final_path" @@ -79,11 +77,10 @@ fi #================================================= # DOWNLOAD, CHECK AND UNPACK SOURCE #================================================= - ynh_script_progression --message="Upgrading source files..." # Download, check integrity, uncompress and patch the source from app.src - ynh_setup_source --dest_dir="$final_path" +ynh_setup_source --dest_dir="$final_path" cp -a "$tmpdir/store" "${final_path}" cp -a "$tmpdir/.htconfig.php" "${final_path}" @@ -93,13 +90,12 @@ chmod -R 777 $final_path/store mkdir $final_path/addon ynh_setup_source --dest_dir="$final_path/addon" --source_id="app_addons" - #================================================= # NGINX CONFIGURATION #================================================= -ynh_script_progression --message="Upgrading nginx web server configuration..." +ynh_script_progression --message="Upgrading NGINX web server configuration..." -# Create a dedicated nginx config +# Create a dedicated NGINX config ynh_add_nginx_config #================================================= @@ -116,7 +112,7 @@ chown -R $app: $final_path #================================================= # PHP-FPM CONFIGURATION #================================================= -ynh_print_info "Upgrading php-fpm configuration..." +ynh_print_info "Upgrading PHP-FPM configuration..." # Create a dedicated php-fpm config ynh_add_fpm_config --package="$extra_php_dependencies" @@ -137,7 +133,7 @@ ynh_use_logrotate --non-append # UPGRADE FAIL2BAN #================================================= -ynh_script_progression --message="Re-configure fail2ban..." +ynh_script_progression --message="Re-configure Fail2Ban..." ynh_add_fail2ban_config --logpath="$final_path/php.log" --failregex="^.*auth\.php.*failed login attempt.*from IP .*$" --max_retry="5" @@ -146,7 +142,7 @@ ynh_print_info "Setting up cron job..." ynh_replace_string --match_string="YNH_WWW_PATH" --replace_string="$final_path" --target_file="../conf/poller-cron" ynh_replace_string --match_string="__USER__" --replace_string="$app" --target_file="../conf/poller-cron" ynh_replace_string --match_string="__PHP_VERSION__" --replace_string="$phpversion" --target_file="../conf/poller-cron" -sudo cp -f ../conf/poller-cron /etc/cron.d/$app +cp -f ../conf/poller-cron /etc/cron.d/$app #================================================= # UPGRADE DEPENDENCIES @@ -186,7 +182,7 @@ ynh_app_setting_set --app=$app --key=unprotected_uris --value="/" #================================================= # RELOAD NGINX #================================================= -ynh_script_progression --message="Reloading nginx web server..." +ynh_script_progression --message="Reloading NGINX web server..." ynh_systemd_action --service_name=nginx --action=reload From 7efd3d1ae30554cd5bb623ee275fb63223a7b431 Mon Sep 17 00:00:00 2001 From: ericgaspar Date: Fri, 13 Nov 2020 16:59:16 +0100 Subject: [PATCH 8/8] Small typos --- scripts/install | 15 +++++++-------- scripts/remove | 10 +++++----- scripts/restore | 8 ++++---- scripts/upgrade | 2 +- 4 files changed, 17 insertions(+), 18 deletions(-) diff --git a/scripts/install b/scripts/install index 7d4ab060..98d1465d 100755 --- a/scripts/install +++ b/scripts/install @@ -48,7 +48,7 @@ ynh_webpath_register --app=$app --domain=$domain --path_url=$path_url #================================================= # STORE SETTINGS FROM MANIFEST #================================================= -ynh_script_progression --message="Storing installation settings..." --time --weight=1 +ynh_script_progression --message="Storing installation settings..." ynh_app_setting_set --app=$app --key=domain --value=$domain ynh_app_setting_set --app=$app --key=path --value=$path_url @@ -129,7 +129,6 @@ elif [ $database -eq 2 ]; then ynh_psql_connect_as --user="$db_name" --password="$db_pwd" --database="$db_name" < $final_path/install/schema_postgres.sql else ynh_die --message="Some problem occured in creating the database, contact maintainer" - fi #================================================= @@ -151,17 +150,17 @@ ynh_replace_string --match_string= "//ini_set('display_errors', '0');" --replace sed -i "s/\['php_path'\] = 'php';/\['php_path'\] = 'php$phpversion';/g" "$config" # addon ldap config -ynh_script_progression --message="Push Ldap configuration to .htconfig.php..." +ynh_script_progression --message="Push LDAP configuration to .htconfig.php..." cat ../conf/ldap_conf.php >> $final_path/.htconfig.php #================================================= # NGINX CONFIGURATION #================================================= -ynh_script_progression --message="Configuring nginx web server..." +ynh_script_progression --message="Configuring NGINX web server..." ### `ynh_add_nginx_config` will use the file conf/nginx.conf -# Create a dedicated nginx config +# Create a dedicated NGINX config ynh_add_nginx_config #================================================= @@ -175,9 +174,9 @@ ynh_system_user_create --username=$app #================================================= # PHP-FPM CONFIGURATION #================================================= -ynh_script_progression --message="Configuring php-fpm..." +ynh_script_progression --message="Configuring PHP-FPM..." -# Create a dedicated php-fpm config +# Create a dedicated PHP-FPM config ynh_add_fpm_config --package="$extra_php_dependencies" # Set right permissions for Hubzilla @@ -222,7 +221,7 @@ ynh_app_setting_set --app=$app --key=unprotected_uris --value="/" #================================================= # RELOAD NGINX #================================================= -ynh_script_progression --message="Reloading nginx web server..." +ynh_script_progression --message="Reloading NGINX web server..." ynh_systemd_action --service_name=nginx --action=reload diff --git a/scripts/remove b/scripts/remove index 65fde16d..3232b7ca 100755 --- a/scripts/remove +++ b/scripts/remove @@ -57,17 +57,17 @@ 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..." -# Remove the dedicated nginx config +# Remove the dedicated NGINX config ynh_remove_nginx_config #================================================= # REMOVE PHP-FPM CONFIGURATION #================================================= -ynh_script_progression --message="Removing php-fpm configuration..." +ynh_script_progression --message="Removing PHP-FPM configuration..." -# Remove the dedicated php-fpm config +# Remove the dedicated PHP-FPM config ynh_remove_fpm_config #================================================= @@ -88,7 +88,7 @@ ynh_secure_remove --file="/etc/cron.d/$app" #================================================= # REMOVE FAIL2BAN CONFIGURATION #================================================= -ynh_script_progression --message="Removing fail2ban configuration..." +ynh_script_progression --message="Removing Fail2Ban configuration..." ynh_remove_fail2ban_config diff --git a/scripts/restore b/scripts/restore index 3a7126e3..5f8af875 100644 --- a/scripts/restore +++ b/scripts/restore @@ -65,7 +65,7 @@ ynh_restore_file --origin_path="$final_path" #================================================= # RESTORE THE MYSQL DATABASE #================================================= -ynh_script_progression --message="Restoring the MySQL database..." --time +ynh_script_progression --message="Restoring the MySQL database..." if [ $database -eq 1 ]; then ynh_script_progression --message="Restoring MySQL database..." @@ -119,7 +119,7 @@ ynh_restore_file --origin_path="/etc/logrotate.d/$app" #================================================= # RESTORE FAIL2BAN CONFIGURATION #================================================= -ynh_script_progression --message="Restoring the fail2ban configuration..." --time --weight=1 +ynh_script_progression --message="Restoring the Fail2Ban configuration..." ynh_restore_file "/etc/fail2ban/jail.d/$app.conf" ynh_restore_file "/etc/fail2ban/filter.d/$app.conf" @@ -133,7 +133,7 @@ ynh_app_setting_set $app skipped_uris "/" #================================================= # RELOAD NGINX AND PHP-FPM #================================================= -ynh_script_progression --message="Reloading nginx web server and php-fpm..." --time --weight=1 +ynh_script_progression --message="Reloading NGINX web server and PHP-FPM..." ynh_systemd_action --service_name=php$phpversion-fpm --action=reload ynh_systemd_action --service_name=nginx --action=reload @@ -142,4 +142,4 @@ ynh_systemd_action --service_name=nginx --action=reload # END OF SCRIPT #================================================= -ynh_script_progression --message="Restoration completed for $app" --time --last +ynh_script_progression --message="Restoration completed for $app" diff --git a/scripts/upgrade b/scripts/upgrade index e66d8979..b6f8812f 100755 --- a/scripts/upgrade +++ b/scripts/upgrade @@ -153,7 +153,7 @@ if [ $database -eq 1 ]; then # CHECK VERSION FOR SPECIFIC MYSQL UPDATE #================================================= - # Check version and if this version was a fresh install push mysq query + # Check version and if this version was a fresh install push mysql query db_name=$(ynh_app_setting_get --app=$app --key=db_name) db_pwd=$(ynh_app_setting_get --app=$app --key=mysqlpwd) is_version_equal_three_eight_four=$(awk 'BEGIN{ print "'$version'"<"'3.8.4'" }')