diff --git a/ALL_README.md b/ALL_README.md new file mode 100644 index 0000000..152f2e7 --- /dev/null +++ b/ALL_README.md @@ -0,0 +1,8 @@ +# All available README files by language + +- [Read the README in English](README.md) +- [Lea el README en español](README_es.md) +- [Irakurri README euskaraz](README_eu.md) +- [Lire le README en français](README_fr.md) +- [Le o README en galego](README_gl.md) +- [阅读中文(简体)的 README](README_zh_Hans.md) diff --git a/README.md b/README.md index 17fa90b..1c08532 100644 --- a/README.md +++ b/README.md @@ -1,5 +1,5 @@ @@ -9,10 +9,10 @@ It shall NOT be edited by hand. [![Install EmailPoubelle with YunoHost](https://install-app.yunohost.org/install-with-yunohost.svg)](https://install-app.yunohost.org/?app=emailpoubelle) -*[Lire ce readme en français.](./README_fr.md)* +*[Read this README in other languages.](./ALL_README.md)* -> *This package allows you to install EmailPoubelle quickly and simply on a YunoHost server. -If you don't have YunoHost, please consult [the guide](https://yunohost.org/#/install) to learn how to install it.* +> *This package allows you to install EmailPoubelle quickly and simply on a YunoHost server.* +> *If you don't have YunoHost, please consult [the guide](https://yunohost.org/install) to learn how to install it.* ## Overview @@ -21,23 +21,23 @@ EmailPoubelle (Trash email) is a script to create temporay email adresses that a **Shipped version:** 2023.05.17~ynh1 -**Demo:** https://poubelle.zici.fr +**Demo:** ## Documentation and resources -* Upstream app code repository: -* YunoHost Store: -* Report a bug: +- Upstream app code repository: +- YunoHost Store: +- Report a bug: ## Developer info -Please send your pull request to the [testing branch](https://github.com/YunoHost-Apps/emailpoubelle_ynh/tree/testing). +Please send your pull request to the [`testing` branch](https://github.com/YunoHost-Apps/emailpoubelle_ynh/tree/testing). -To try the testing branch, please proceed like that. +To try the `testing` branch, please proceed like that: -``` bash +```bash sudo yunohost app install https://github.com/YunoHost-Apps/emailpoubelle_ynh/tree/testing --debug or sudo yunohost app upgrade emailpoubelle -u https://github.com/YunoHost-Apps/emailpoubelle_ynh/tree/testing --debug ``` -**More info regarding app packaging:** \ No newline at end of file +**More info regarding app packaging:** diff --git a/README_es.md b/README_es.md new file mode 100644 index 0000000..9347ba5 --- /dev/null +++ b/README_es.md @@ -0,0 +1,43 @@ + + +# EmailPoubelle para Yunohost + +[![Nivel de integración](https://dash.yunohost.org/integration/emailpoubelle.svg)](https://dash.yunohost.org/appci/app/emailpoubelle) ![Estado funcional](https://ci-apps.yunohost.org/ci/badges/emailpoubelle.status.svg) ![Estado En Mantención](https://ci-apps.yunohost.org/ci/badges/emailpoubelle.maintain.svg) + +[![Instalar EmailPoubelle con Yunhost](https://install-app.yunohost.org/install-with-yunohost.svg)](https://install-app.yunohost.org/?app=emailpoubelle) + +*[Leer este README en otros idiomas.](./ALL_README.md)* + +> *Este paquete le permite instalarEmailPoubelle rapidamente y simplement en un servidor YunoHost.* +> *Si no tiene YunoHost, visita [the guide](https://yunohost.org/install) para aprender como instalarla.* + +## Descripción general + +EmailPoubelle (Trash email) is a script to create temporay email adresses that aims to your real email address. + + +**Versión actual:** 2023.05.17~ynh1 + +**Demo:** +## Documentaciones y recursos + +- Repositorio del código fuente oficial de la aplicación : +- Catálogo YunoHost: +- Reportar un error: + +## Información para desarrolladores + +Por favor enviar sus correcciones a la [`branch testing`](https://github.com/YunoHost-Apps/emailpoubelle_ynh/tree/testing + +Para probar la rama `testing`, sigue asÍ: + +```bash +sudo yunohost app install https://github.com/YunoHost-Apps/emailpoubelle_ynh/tree/testing --debug +o +sudo yunohost app upgrade emailpoubelle -u https://github.com/YunoHost-Apps/emailpoubelle_ynh/tree/testing --debug +``` + +**Mas informaciones sobre el empaquetado de aplicaciones:** diff --git a/README_eu.md b/README_eu.md new file mode 100644 index 0000000..4ed4007 --- /dev/null +++ b/README_eu.md @@ -0,0 +1,43 @@ + + +# EmailPoubelle YunoHost-erako + +[![Integrazio maila](https://dash.yunohost.org/integration/emailpoubelle.svg)](https://dash.yunohost.org/appci/app/emailpoubelle) ![Funtzionamendu egoera](https://ci-apps.yunohost.org/ci/badges/emailpoubelle.status.svg) ![Mantentze egoera](https://ci-apps.yunohost.org/ci/badges/emailpoubelle.maintain.svg) + +[![Instalatu EmailPoubelle YunoHost-ekin](https://install-app.yunohost.org/install-with-yunohost.svg)](https://install-app.yunohost.org/?app=emailpoubelle) + +*[Irakurri README hau beste hizkuntzatan.](./ALL_README.md)* + +> *Pakete honek EmailPoubelle YunoHost zerbitzari batean azkar eta zailtasunik gabe instalatzea ahalbidetzen dizu.* +> *YunoHost ez baduzu, kontsultatu [gida](https://yunohost.org/install) nola instalatu ikasteko.* + +## Aurreikuspena + +EmailPoubelle (Trash email) is a script to create temporay email adresses that aims to your real email address. + + +**Paketatutako bertsioa:** 2023.05.17~ynh1 + +**Demoa:** +## Dokumentazioa eta baliabideak + +- Jatorrizko aplikazioaren kode-gordailua: +- YunoHost Denda: +- Eman errore baten berri: + +## Garatzaileentzako informazioa + +Bidali `pull request`a [`testing` abarrera](https://github.com/YunoHost-Apps/emailpoubelle_ynh/tree/testing). + +`testing` abarra probatzeko, ondorengoa egin: + +```bash +sudo yunohost app install https://github.com/YunoHost-Apps/emailpoubelle_ynh/tree/testing --debug +edo +sudo yunohost app upgrade emailpoubelle -u https://github.com/YunoHost-Apps/emailpoubelle_ynh/tree/testing --debug +``` + +**Informazio gehiago aplikazioaren paketatzeari buruz:** diff --git a/README_fr.md b/README_fr.md index 7793d0d..96347fc 100644 --- a/README_fr.md +++ b/README_fr.md @@ -1,6 +1,6 @@ # EmailPoubelle pour YunoHost @@ -9,34 +9,34 @@ It shall NOT be edited by hand. [![Installer EmailPoubelle avec YunoHost](https://install-app.yunohost.org/install-with-yunohost.svg)](https://install-app.yunohost.org/?app=emailpoubelle) -*[Read this readme in english.](./README.md)* +*[Lire le README dans d'autres langues.](./ALL_README.md)* -> *Ce package vous permet d’installer EmailPoubelle rapidement et simplement sur un serveur YunoHost. -Si vous n’avez pas YunoHost, regardez [ici](https://yunohost.org/#/install) pour savoir comment l’installer et en profiter.* +> *Ce package vous permet d’installer EmailPoubelle rapidement et simplement sur un serveur YunoHost.* +> *Si vous n’avez pas YunoHost, consultez [ce guide](https://yunohost.org/install) pour savoir comment l’installer et en profiter.* ## Vue d’ensemble EmailPoubelle est un script pour créer des adresses e-mail temporaires qui visent votre véritable adresse e-mail. -**Version incluse :** 2023.05.17~ynh1 +**Version incluse :** 2023.05.17~ynh1 -**Démo :** https://poubelle.zici.fr +**Démo :** ## Documentations et ressources -* Dépôt de code officiel de l’app : -* YunoHost Store: -* Signaler un bug : +- Dépôt de code officiel de l’app : +- YunoHost Store : +- Signaler un bug : ## Informations pour les développeurs -Merci de faire vos pull request sur la [branche testing](https://github.com/YunoHost-Apps/emailpoubelle_ynh/tree/testing). +Merci de faire vos pull request sur la [branche `testing`](https://github.com/YunoHost-Apps/emailpoubelle_ynh/tree/testing). -Pour essayer la branche testing, procédez comme suit. +Pour essayer la branche `testing`, procédez comme suit : -``` bash +```bash sudo yunohost app install https://github.com/YunoHost-Apps/emailpoubelle_ynh/tree/testing --debug ou sudo yunohost app upgrade emailpoubelle -u https://github.com/YunoHost-Apps/emailpoubelle_ynh/tree/testing --debug ``` -**Plus d’infos sur le packaging d’applications :** \ No newline at end of file +**Plus d’infos sur le packaging d’applications :** diff --git a/README_gl.md b/README_gl.md new file mode 100644 index 0000000..2d73a90 --- /dev/null +++ b/README_gl.md @@ -0,0 +1,43 @@ + + +# EmailPoubelle para YunoHost + +[![Nivel de integración](https://dash.yunohost.org/integration/emailpoubelle.svg)](https://dash.yunohost.org/appci/app/emailpoubelle) ![Estado de funcionamento](https://ci-apps.yunohost.org/ci/badges/emailpoubelle.status.svg) ![Estado de mantemento](https://ci-apps.yunohost.org/ci/badges/emailpoubelle.maintain.svg) + +[![Instalar EmailPoubelle con YunoHost](https://install-app.yunohost.org/install-with-yunohost.svg)](https://install-app.yunohost.org/?app=emailpoubelle) + +*[Le este README en outros idiomas.](./ALL_README.md)* + +> *Este paquete permíteche instalar EmailPoubelle de xeito rápido e doado nun servidor YunoHost.* +> *Se non usas YunoHost, le a [documentación](https://yunohost.org/install) para saber como instalalo.* + +## Vista xeral + +EmailPoubelle (Trash email) is a script to create temporay email adresses that aims to your real email address. + + +**Versión proporcionada:** 2023.05.17~ynh1 + +**Demo:** +## Documentación e recursos + +- Repositorio de orixe do código: +- Tenda YunoHost: +- Informar dun problema: + +## Info de desenvolvemento + +Envía a túa colaboración á [rama `testing`](https://github.com/YunoHost-Apps/emailpoubelle_ynh/tree/testing). + +Para probar a rama `testing`, procede deste xeito: + +```bash +sudo yunohost app install https://github.com/YunoHost-Apps/emailpoubelle_ynh/tree/testing --debug +ou +sudo yunohost app upgrade emailpoubelle -u https://github.com/YunoHost-Apps/emailpoubelle_ynh/tree/testing --debug +``` + +**Máis info sobre o empaquetado da app:** diff --git a/README_it.md b/README_it.md new file mode 100644 index 0000000..6a1d43f --- /dev/null +++ b/README_it.md @@ -0,0 +1,43 @@ + + +# EmailPoubelle per YunoHost + +[![Livello di integrazione](https://dash.yunohost.org/integration/emailpoubelle.svg)](https://dash.yunohost.org/appci/app/emailpoubelle) ![Stato di funzionamento](https://ci-apps.yunohost.org/ci/badges/emailpoubelle.status.svg) ![Stato di manutenzione](https://ci-apps.yunohost.org/ci/badges/emailpoubelle.maintain.svg) + +[![Installa EmailPoubelle con YunoHost](https://install-app.yunohost.org/install-with-yunohost.svg)](https://install-app.yunohost.org/?app=emailpoubelle) + +*[Leggi questo README in altre lingue.](./ALL_README.md)* + +> *Questo pacchetto ti permette di installare EmailPoubelle su un server YunoHost in modo semplice e veloce.* +> *Se non hai YunoHost, consulta [la guida](https://yunohost.org/install) per imparare a installarlo.* + +## Panoramica + +EmailPoubelle (Trash email) is a script to create temporay email adresses that aims to your real email address. + + +**Versione pubblicata:** 2023.05.17~ynh1 + +**Prova:** +## Documentazione e risorse + +- Repository upstream del codice dell’app: +- Store di YunoHost: +- Segnala un problema: + +## Informazioni per sviluppatori + +Si prega di inviare la tua pull request alla [branch di `testing`](https://github.com/YunoHost-Apps/emailpoubelle_ynh/tree/testing). + +Per provare la branch di `testing`, si prega di procedere in questo modo: + +```bash +sudo yunohost app install https://github.com/YunoHost-Apps/emailpoubelle_ynh/tree/testing --debug +o +sudo yunohost app upgrade emailpoubelle -u https://github.com/YunoHost-Apps/emailpoubelle_ynh/tree/testing --debug +``` + +**Maggiori informazioni riguardo il pacchetto di quest’app:** diff --git a/README_zh_Hans.md b/README_zh_Hans.md new file mode 100644 index 0000000..9e0bfa7 --- /dev/null +++ b/README_zh_Hans.md @@ -0,0 +1,43 @@ + + +# YunoHost 上的 EmailPoubelle + +[![集成程度](https://dash.yunohost.org/integration/emailpoubelle.svg)](https://dash.yunohost.org/appci/app/emailpoubelle) ![工作状态](https://ci-apps.yunohost.org/ci/badges/emailpoubelle.status.svg) ![维护状态](https://ci-apps.yunohost.org/ci/badges/emailpoubelle.maintain.svg) + +[![使用 YunoHost 安装 EmailPoubelle](https://install-app.yunohost.org/install-with-yunohost.svg)](https://install-app.yunohost.org/?app=emailpoubelle) + +*[阅读此 README 的其它语言版本。](./ALL_README.md)* + +> *通过此软件包,您可以在 YunoHost 服务器上快速、简单地安装 EmailPoubelle。* +> *如果您还没有 YunoHost,请参阅[指南](https://yunohost.org/install)了解如何安装它。* + +## 概况 + +EmailPoubelle (Trash email) is a script to create temporay email adresses that aims to your real email address. + + +**分发版本:** 2023.05.17~ynh1 + +**演示:** +## 文档与资源 + +- 上游应用代码库: +- YunoHost 商店: +- 报告 bug: + +## 开发者信息 + +请向 [`testing` 分支](https://github.com/YunoHost-Apps/emailpoubelle_ynh/tree/testing) 发送拉取请求。 + +如要尝试 `testing` 分支,请这样操作: + +```bash +sudo yunohost app install https://github.com/YunoHost-Apps/emailpoubelle_ynh/tree/testing --debug +或 +sudo yunohost app upgrade emailpoubelle -u https://github.com/YunoHost-Apps/emailpoubelle_ynh/tree/testing --debug +``` + +**有关应用打包的更多信息:** diff --git a/conf/emailpoubelle.cron b/conf/emailpoubelle.cron index e84e545..2d11de3 100644 --- a/conf/emailpoubelle.cron +++ b/conf/emailpoubelle.cron @@ -1 +1 @@ -0 */2 * * * www-data /usr/bin/php__PHPVERSION__ __INSTALL_DIR__/www/index.php > /dev/null 2>&1 \ No newline at end of file +0 */2 * * * www-data /usr/bin/php__PHP_VERSION__ __INSTALL_DIR__/www/index.php > /dev/null 2>&1 \ No newline at end of file diff --git a/conf/extra_php-fpm.conf b/conf/extra_php-fpm.conf deleted file mode 100644 index 700c37c..0000000 --- a/conf/extra_php-fpm.conf +++ /dev/null @@ -1,4 +0,0 @@ -; Additional php.ini defines, specific to this pool of workers. - -php_admin_value[upload_max_filesize] = 50M -php_admin_value[post_max_size] = 50M diff --git a/conf/nginx.conf b/conf/nginx.conf index 4bf6109..dbe81d0 100644 --- a/conf/nginx.conf +++ b/conf/nginx.conf @@ -12,7 +12,7 @@ location __PATH__/ { try_files $uri $uri/ index.php; location ~ [^/]\.php(/|$) { fastcgi_split_path_info ^(.+?\.php)(/.*)$; - fastcgi_pass unix:/var/run/php/php__PHPVERSION__-fpm-__NAME__.sock; + fastcgi_pass unix:/var/run/php/php__PHP_VERSION__-fpm-__APP__.sock; fastcgi_index index.php; include fastcgi_params; diff --git a/manifest.toml b/manifest.toml index 74cc3e1..f95c035 100644 --- a/manifest.toml +++ b/manifest.toml @@ -15,7 +15,8 @@ demo = "https://poubelle.zici.fr" code = "https://framagit.org/kepon/emailPoubellePhp" [integration] -yunohost = ">= 11.1.19" +yunohost = ">= 11.2.18" +helpers_version = "2.1" architectures = "all" multi_instance = false ldap = false @@ -34,7 +35,7 @@ ram.runtime = "50M" [install.init_main_permission] type = "group" - default = false + default = "visitors" [install.admin] type = "user" @@ -51,6 +52,7 @@ ram.runtime = "50M" [resources.system_user] [resources.install_dir] + group = "www-data:r-x" [resources.permissions] main.url = "/" diff --git a/scripts/_common.sh b/scripts/_common.sh index 5129bd4..72e04eb 100644 --- a/scripts/_common.sh +++ b/scripts/_common.sh @@ -1,19 +1,7 @@ #!/bin/bash #================================================= -# COMMON VARIABLES +# COMMON VARIABLES AND CUSTOM HELPERS #================================================= lang="fr_FR.UTF-8 en_US.UTF-8 it_IT.UTF-8" - -#================================================= -# PERSONAL HELPERS -#================================================= - -#================================================= -# EXPERIMENTAL HELPERS -#================================================= - -#================================================= -# FUTURE OFFICIAL HELPERS -#================================================= diff --git a/scripts/backup b/scripts/backup index bf24d21..3d30971 100644 --- a/scripts/backup +++ b/scripts/backup @@ -1,37 +1,28 @@ #!/bin/bash -#================================================= -# GENERIC START -#================================================= -# 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 -#================================================= -# DECLARE DATA AND CONF FILES TO BACKUP -#================================================= -ynh_print_info --message="Declaring files to be backed up..." +ynh_print_info "Declaring files to be backed up..." #================================================= # BACKUP THE APP MAIN DIR #================================================= -ynh_backup --src_path="$install_dir" +ynh_backup "$install_dir" #================================================= # BACKUP THE NGINX CONFIGURATION #================================================= -ynh_backup --src_path="/etc/nginx/conf.d/$domain.d/$app.conf" +ynh_backup "/etc/nginx/conf.d/$domain.d/$app.conf" #================================================= # BACKUP THE PHP-FPM CONFIGURATION #================================================= -ynh_backup --src_path="/etc/php/$phpversion/fpm/pool.d/$app.conf" +ynh_backup "/etc/php/$php_version/fpm/pool.d/$app.conf" #================================================= # SPECIFIC BACKUP @@ -39,19 +30,19 @@ ynh_backup --src_path="/etc/php/$phpversion/fpm/pool.d/$app.conf" # BACKUP VARIOUS FILES #================================================= -ynh_backup --src_path="/etc/cron.d/$app" +ynh_backup "/etc/cron.d/$app" -ynh_backup --src_path="/usr/share/yunohost/hooks/conf_regen/98-postfix_emailpoubelle" +ynh_backup "/usr/share/yunohost/hooks/conf_regen/98-postfix_emailpoubelle" #================================================= # BACKUP THE MYSQL DATABASE #================================================= -ynh_print_info --message="Backing up the MySQL database..." +ynh_print_info "Backing up the MySQL database..." -ynh_mysql_dump_db --database="$db_name" > db.sql +ynh_mysql_dump_db > db.sql #================================================= # END OF SCRIPT #================================================= -ynh_print_info --message="Backup script completed for $app. (YunoHost will then actually copy those files to the archive)." +ynh_print_info "Backup script completed for $app. (YunoHost will then actually copy those files to the archive)." diff --git a/scripts/change_url b/scripts/change_url index 09f776b..67918ff 100644 --- a/scripts/change_url +++ b/scripts/change_url @@ -1,26 +1,20 @@ #!/bin/bash -#================================================= -# GENERIC STARTING -#================================================= -# IMPORT GENERIC HELPERS -#================================================= - source _common.sh source /usr/share/yunohost/helpers #================================================= # MODIFY URL IN NGINX CONF #================================================= -ynh_script_progression --message="Updating NGINX web server configuration..." --weight=1 +ynh_script_progression "Updating NGINX web server configuration..." -ynh_change_url_nginx_config +ynh_config_change_url_nginx #================================================= # SPECIFIC MODIFICATIONS #================================================= -ynh_add_config --template="../conf/conf-dist.php" --destination="$install_dir/conf.php" +ynh_config_add --template="conf-dist.php" --destination="$install_dir/conf.php" chmod 400 "$install_dir/conf.php" chown $app:$app "$install_dir/conf.php" @@ -29,4 +23,4 @@ chown $app:$app "$install_dir/conf.php" # END OF SCRIPT #================================================= -ynh_script_progression --message="Change of URL completed for $app" --last +ynh_script_progression "Change of URL completed for $app" diff --git a/scripts/install b/scripts/install index 5e09a50..a8c308b 100644 --- a/scripts/install +++ b/scripts/install @@ -1,11 +1,5 @@ #!/bin/bash -#================================================= -# GENERIC START -#================================================= -# IMPORT GENERIC HELPERS -#================================================= - source _common.sh source /usr/share/yunohost/helpers @@ -14,18 +8,16 @@ source /usr/share/yunohost/helpers #================================================= password=$YNH_APP_ARG_PASSWORD -ynh_app_setting_set --app=$app --key=password --value=$password +ynh_app_setting_set --key=password --value=$password -#================================================= -# STANDARD MODIFICATIONS #================================================= # INSTALL DEPENDENCIES #================================================= -ynh_script_progression --message="Installing dependencies..." --weight=15 +ynh_script_progression "Installing dependencies..." #install locale (nginx will restart at the end of the install) for i in $lang ; do - ynh_replace_string --match_string="# $i" --replace_string="$i" --target_file="/etc/locale.gen" + ynh_replace --match="# $i" --replace="$i" --file="/etc/locale.gen" done locale-gen @@ -33,42 +25,41 @@ locale-gen #================================================= # DOWNLOAD, CHECK AND UNPACK SOURCE #================================================= -ynh_script_progression --message="Setting up source files..." --weight=5 +ynh_script_progression "Setting up source files..." # Download, check integrity, uncompress and patch the source from app.src ynh_setup_source --dest_dir="$install_dir" -ynh_add_config --template="../conf/index_source.php" --destination="$install_dir/www/index.php" -ynh_secure_remove --file="$install_dir/www/admin.php" +ynh_config_add --template="index_source.php" --destination="$install_dir/www/index.php" +ynh_safe_rm "$install_dir/www/admin.php" ln -s $install_dir/lib $install_dir/www/lib -chmod -R o-rwx "$install_dir" -chown -R $app:www-data "$install_dir" - +#REMOVEME? Assuming the install dir is setup using ynh_setup_source, the proper chmod/chowns are now already applied and it shouldn't be necessary to tweak perms | chmod -R o-rwx "$install_dir" +#REMOVEME? Assuming the install dir is setup using ynh_setup_source, the proper chmod/chowns are now already applied and it shouldn't be necessary to tweak perms | chown -R $app:www-data "$install_dir" #================================================= # PHP-FPM CONFIGURATION #================================================= -ynh_script_progression --message="Configuring PHP-FPM..." +ynh_script_progression "Configuring PHP-FPM..." # Create a dedicated PHP-FPM config -ynh_add_fpm_config --usage=low --footprint=low +ynh_config_add_phpfpm #================================================= # NGINX CONFIGURATION #================================================= -ynh_script_progression --message="Configuring NGINX web server..." +ynh_script_progression "Configuring NGINX web server..." # Create a dedicated NGINX config -ynh_add_nginx_config +ynh_config_add_nginx #================================================= # SPECIFIC SETUP #================================================= # ADD A CONFIGURATION #================================================= -ynh_script_progression --message="Adding a configuration file..." +ynh_script_progression "Adding $app's configuration..." -ynh_add_config --template="../conf/conf-dist.php" --destination="$install_dir/conf.php" +ynh_config_add --template="conf-dist.php" --destination="$install_dir/conf.php" chmod 400 "$install_dir/conf.php" chown $app:$app "$install_dir/conf.php" @@ -78,24 +69,25 @@ chown $app:$app "$install_dir/conf.php" cp -R ../sources/hooks/conf_regen/98-postfix_emailpoubelle /usr/share/yunohost/hooks/conf_regen/ yunohost tools regen-conf postfix -# Create the virtual aliases file +# Create the virtual aliases file + touch $install_dir/var/virtual postmap $install_dir/var/virtual -chown -R $app:www-data "$install_dir" - +#REMOVEME? Assuming the install dir is setup using ynh_setup_source, the proper chmod/chowns are now already applied and it shouldn't be necessary to tweak perms | chown -R $app:www-data "$install_dir" # Create an alias for deleted junk adresses -cp /etc/aliases /etc/aliases.emailpoubelle.bak #backup it +cp /etc/aliases /etc/aliases.emailpoubelle.bak #backup it + echo "devnull:/dev/null" | tee -a /etc/aliases newaliases -ynh_systemd_action --service_name=postfix --action=reload +ynh_systemctl --service=postfix --action=reload # Adding cronjob for removing expired email addresses -ynh_add_config --template="../conf/emailpoubelle.cron" --destination="/etc/cron.d/$app" -chown root:root /etc/cron.d/$app -chmod 644 /etc/cron.d/$app +ynh_config_add --template="emailpoubelle.cron" --destination="/etc/cron.d/$app" +#REMOVEME? Assuming the file is setup using ynh_config_add, the proper chmod/chowns are now already applied and it shouldn't be necessary to tweak perms | chown root:root /etc/cron.d/$app +#REMOVEME? Assuming the file is setup using ynh_config_add, the proper chmod/chowns are now already applied and it shouldn't be necessary to tweak perms | chmod 644 /etc/cron.d/$app #================================================= # END OF SCRIPT #================================================= -ynh_script_progression --message="Installation of $app completed" --last +ynh_script_progression "Installation of $app completed" diff --git a/scripts/remove b/scripts/remove index 7b738d9..2545d37 100644 --- a/scripts/remove +++ b/scripts/remove @@ -1,49 +1,43 @@ #!/bin/bash -#================================================= -# GENERIC START -#================================================= -# IMPORT GENERIC HELPERS -#================================================= - source _common.sh source /usr/share/yunohost/helpers #================================================= # REMOVE NGINX CONFIGURATION #================================================= -ynh_script_progression --message="Removing NGINX web server configuration..." +ynh_script_progression "Removing NGINX web server configuration..." # Remove the dedicated NGINX config -ynh_remove_nginx_config +ynh_config_remove_nginx #================================================= # REMOVE PHP-FPM CONFIGURATION #================================================= -ynh_script_progression --message="Removing PHP-FPM configuration..." +ynh_script_progression "Removing PHP-FPM configuration..." # Remove the dedicated PHP-FPM config -ynh_remove_fpm_config +ynh_config_remove_phpfpm #================================================= # SPECIFIC REMOVE #================================================= # REMOVE VARIOUS FILES #================================================= -ynh_script_progression --message="Removing various files..." +ynh_script_progression "Removing various files..." # Remove a cron file -ynh_secure_remove --file="/etc/cron.d/$app" +ynh_safe_rm "/etc/cron.d/$app" -ynh_replace_string --match_string="devnull:/dev/null" --replace_string="" --target_file="/etc/aliases" +ynh_replace --match="devnull:/dev/null" --replace="" --file="/etc/aliases" newaliases -ynh_secure_remove --file="/usr/share/yunohost/hooks/conf_regen/98-postfix_emailpoubelle" +ynh_safe_rm "/usr/share/yunohost/hooks/conf_regen/98-postfix_emailpoubelle" yunohost tools regen-conf postfix -ynh_systemd_action --service_name=postfix --action=reload +ynh_systemctl --service=postfix --action=reload #================================================= # END OF SCRIPT #================================================= -ynh_script_progression --message="Removal of $app completed" +ynh_script_progression "Removal of $app completed" diff --git a/scripts/restore b/scripts/restore index c718e9c..0f20ea5 100644 --- a/scripts/restore +++ b/scripts/restore @@ -1,11 +1,5 @@ #!/bin/bash -#================================================= -# GENERIC START -#================================================= -# 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 @@ -13,78 +7,76 @@ source /usr/share/yunohost/helpers #================================================= # RESTORE THE APP MAIN DIR #================================================= -ynh_script_progression --message="Restoring the app main directory..." --weight=1 +ynh_script_progression "Restoring the app main directory..." -ynh_restore_file --origin_path="$install_dir" - -chmod -R o-rwx "$install_dir" -chown -R $app:www-data "$install_dir" +ynh_restore "$install_dir" +#REMOVEME? Assuming the install dir is setup using ynh_setup_source, the proper chmod/chowns are now already applied and it shouldn't be necessary to tweak perms | chmod -R o-rwx "$install_dir" +#REMOVEME? Assuming the install dir is setup using ynh_setup_source, the proper chmod/chowns are now already applied and it shouldn't be necessary to tweak perms | chown -R $app:www-data "$install_dir" #================================================= # SPECIFIC RESTORATION #================================================= # REINSTALL DEPENDENCIES #================================================= -ynh_script_progression --message="Reinstalling dependencies..." --weight=15 +ynh_script_progression "Reinstalling dependencies..." #Check & regen local for i in $lang ; do - ynh_replace_string --match_string="# $i" --replace_string="$i" --target_file="/etc/locale.gen" + ynh_replace --match="# $i" --replace="$i" --file="/etc/locale.gen" done locale-gen #================================================= # RESTORE THE PHP-FPM CONFIGURATION #================================================= -ynh_script_progression --message="Restoring the PHP-FPM configuration..." +ynh_script_progression "Restoring the PHP-FPM configuration..." -ynh_restore_file --origin_path="/etc/php/$phpversion/fpm/pool.d/$app.conf" +ynh_restore "/etc/php/$php_version/fpm/pool.d/$app.conf" #================================================= # RESTORE THE NGINX CONFIGURATION #================================================= -ynh_script_progression --message="Restoring the NGINX web server configuration..." --weight=1 +ynh_script_progression "Restoring the NGINX web server configuration..." -ynh_restore_file --origin_path="/etc/nginx/conf.d/$domain.d/$app.conf" +ynh_restore "/etc/nginx/conf.d/$domain.d/$app.conf" #================================================= # RESTORE THE MYSQL DATABASE #================================================= -ynh_script_progression --message="Restoring the MySQL database..." --weight=1 +ynh_script_progression "Restoring the MySQL database..." -ynh_mysql_connect_as --user=$db_user --password=$db_pwd --database=$db_name < ./db.sql +ynh_mysql_db_shell < ./db.sql #================================================= # RESTORE VARIOUS FILES #================================================= -ynh_script_progression --message="Restoring various files..." --weight=10 +ynh_script_progression "Restoring various files..." -ynh_restore_file --origin_path="/etc/cron.d/$app" +ynh_restore "/etc/cron.d/$app" -ynh_restore_file --origin_path="/usr/share/yunohost/hooks/conf_regen/98-postfix_emailpoubelle" +ynh_restore "/usr/share/yunohost/hooks/conf_regen/98-postfix_emailpoubelle" yunohost tools regen-conf postfix #create an alias for deleted junk adresses if ! grep -q "devnull:/dev/null" /etc/aliases ; then - cp /etc/aliases /etc/aliases.emailpoubelle.bak #backup it + cp /etc/aliases /etc/aliases.emailpoubelle.bak #backup it + echo "devnull:/dev/null" | tee -a /etc/aliases newaliases fi -ynh_systemd_action --service_name=postfix --action=reload +ynh_systemctl --service=postfix --action=reload -#================================================= -# GENERIC FINALIZATION #================================================= # RELOAD NGINX AND PHP-FPM #================================================= -ynh_script_progression --message="Reloading NGINX web server and PHP-FPM..." +ynh_script_progression "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 +ynh_systemctl --service=php$php_version-fpm --action=reload +ynh_systemctl --service=nginx --action=reload #================================================= # END OF SCRIPT #================================================= -ynh_script_progression --message="Restoration completed for $app" --last +ynh_script_progression "Restoration completed for $app" diff --git a/scripts/upgrade b/scripts/upgrade index fd0ec39..7641ae9 100644 --- a/scripts/upgrade +++ b/scripts/upgrade @@ -1,64 +1,50 @@ #!/bin/bash -#================================================= -# GENERIC START -#================================================= -# IMPORT GENERIC HELPERS -#================================================= - source _common.sh source /usr/share/yunohost/helpers -#================================================= -# CHECK VERSION -#================================================= - -upgrade_type=$(ynh_check_app_version_changed) - #================================================= # DOWNLOAD, CHECK AND UNPACK SOURCE #================================================= -if [ "$upgrade_type" == "UPGRADE_APP" ] +# FIXME: this is still supported but the recommendation is now to *always* re-setup the app sources wether or not the upstream sources changed +if ynh_app_upstream_version_changed then - ynh_script_progression --message="Upgrading source files..." + ynh_script_progression "Upgrading source files..." # Download, check integrity, uncompress and patch the source from app.src ynh_setup_source --dest_dir="$install_dir" --keep="conf.php www/index.php" - ynh_add_config --template="../conf/index_source.php" --destination="$install_dir/www/index.php" - ynh_secure_remove --file="$install_dir/www/admin.php" + ynh_config_add --template="index_source.php" --destination="$install_dir/www/index.php" + ynh_safe_rm "$install_dir/www/admin.php" ln -s $install_dir/lib $install_dir/www/lib fi -chmod -R o-rwx "$install_dir" -chown -R $app:www-data "$install_dir" - +#REMOVEME? Assuming the install dir is setup using ynh_setup_source, the proper chmod/chowns are now already applied and it shouldn't be necessary to tweak perms | chmod -R o-rwx "$install_dir" +#REMOVEME? Assuming the install dir is setup using ynh_setup_source, the proper chmod/chowns are now already applied and it shouldn't be necessary to tweak perms | chown -R $app:www-data "$install_dir" #================================================= # PHP-FPM CONFIGURATION #================================================= -ynh_script_progression --message="Upgrading PHP-FPM configuration..." +ynh_script_progression "Upgrading PHP-FPM configuration..." # Create a dedicated PHP-FPM config -ynh_add_fpm_config --usage=low --footprint=low +ynh_config_add_phpfpm #================================================= # NGINX CONFIGURATION #================================================= -ynh_script_progression --message="Upgrading NGINX web server configuration..." +ynh_script_progression "Upgrading NGINX web server configuration..." # Create a dedicated NGINX config -ynh_add_nginx_config +ynh_config_add_nginx -#================================================= -# SPECIFIC UPGRADE #================================================= # UPDATE A CONFIG FILE #================================================= -ynh_script_progression --message="Updating a configuration file..." +ynh_script_progression "Updating configuration..." -password=$(ynh_app_setting_get --app=$app --key=password) -ynh_add_config --template="../conf/conf-dist.php" --destination="$install_dir/conf.php" +password=$(ynh_app_setting_get --key=password) +ynh_config_add --template="conf-dist.php" --destination="$install_dir/conf.php" chmod 400 "$install_dir/conf.php" chown $app:$app "$install_dir/conf.php" @@ -66,15 +52,15 @@ chown $app:$app "$install_dir/conf.php" cp -R ../sources/hooks/conf_regen/98-postfix_emailpoubelle /usr/share/yunohost/hooks/conf_regen/ mv /etc/postfix/main.cf /etc/postfix/main.cf.emailpoubelle.bak yunohost tools regen-conf postfix -f -ynh_systemd_action --service_name=postfix --action=reload +ynh_systemctl --service=postfix --action=reload # Adding cronjob for removing expired email addresses -ynh_add_config --template="../conf/emailpoubelle.cron" --destination="/etc/cron.d/$app" -chown root:root /etc/cron.d/$app -chmod 644 /etc/cron.d/$app +ynh_config_add --template="emailpoubelle.cron" --destination="/etc/cron.d/$app" +#REMOVEME? Assuming the file is setup using ynh_config_add, the proper chmod/chowns are now already applied and it shouldn't be necessary to tweak perms | chown root:root /etc/cron.d/$app +#REMOVEME? Assuming the file is setup using ynh_config_add, the proper chmod/chowns are now already applied and it shouldn't be necessary to tweak perms | chmod 644 /etc/cron.d/$app #================================================= # END OF SCRIPT #================================================= -ynh_script_progression --message="Upgrade of $app completed" +ynh_script_progression "Upgrade of $app completed"