diff --git a/README.md b/README.md index 410c48b..f515d4f 100755 --- a/README.md +++ b/README.md @@ -1,22 +1,31 @@ -# Lionwiki-t2t for YunoHost + -[![Integration level](https://dash.yunohost.org/integration/lionwiki-t2t.svg)](https://dash.yunohost.org/appci/app/lionwiki-t2t) ![](https://ci-apps.yunohost.org/ci/badges/lionwiki-t2t.status.svg) ![](https://ci-apps.yunohost.org/ci/badges/lionwiki-t2t.maintain.svg) -[![Install Lionwiki-t2t with YunoHost](https://install-app.yunohost.org/install-with-yunohost.svg)](https://install-app.yunohost.org/?app=lionwiki-t2t) +# Lionwiki for YunoHost + +[![Integration level](https://dash.yunohost.org/integration/lionwiki-t2t.svg)](https://dash.yunohost.org/appci/app/lionwiki-t2t) ![Working status](https://ci-apps.yunohost.org/ci/badges/lionwiki-t2t.status.svg) ![Maintenance status](https://ci-apps.yunohost.org/ci/badges/lionwiki-t2t.maintain.svg) +[![Install Lionwiki with YunoHost](https://install-app.yunohost.org/install-with-yunohost.svg)](https://install-app.yunohost.org/?app=lionwiki-t2t) *[Lire ce readme en français.](./README_fr.md)* -> *This package allow you to install Lionwiki-t2t 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.* +> *This package allows you to install Lionwiki 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 LionWiki-t2t is a minimalist Wiki engine programmed in PHP. It is extensible, templatable, file based (it doesn't need database like MySQL) and requires just one file to function (30 kb). It is suitable for small websites, personal notebooks or journals. This version is using the lightweight markup language TXT2TAGS. -**Shipped version:** 3.2.12e -## Screenshot +**Shipped version:** 3.2.12~ynh2 -![](screenshot_lionwikit2t.png) + +## Screenshots + +![Screenshot of Lionwiki](./doc/screenshots/screenshot_lionwikit2t.png) + +## Disclaimers / important information ## Configuration @@ -28,13 +37,6 @@ In the root folder of this app, there are two files: `config.php` and `config.t2 The `pheditor.php` tool at the root of the site allows you to edit all the necessary configuration files. You can remove or rename it from its interface. The password is the same as the one defined during installation. -## Documentation - - * Official documentation: https://lionwiki-t2t.sourceforge.io/ - * More about txt2tags: https://github.com/farvardin/whatistxt2tags - -## YunoHost specific features - #### Multi-users support This is only a single password for editing the wiki (it's not multi-user), and one other password for administration. Both are set to the same one defined in the lionwiki-t2t during the installation by YunoHost. @@ -43,15 +45,6 @@ You can set the wiki to private (only readable when you are connected to YunoHos You can install multiple instance of this app. -#### Supported architectures - -* x86-64b - [![Build Status](https://ci-apps.yunohost.org/ci/logs/lionwikit2t%20%28Apps%29.svg)](https://ci-apps.yunohost.org/ci/apps/lionwikit2t/) -* ARMv8-A - [![Build Status](https://ci-apps-arm.yunohost.org/ci/logs/lionwikit2t%20%28Apps%29.svg)](https://ci-apps-arm.yunohost.org/ci/apps/lionwikit2t/) - -## Limitations - -* No different user accounts. - ## Additional information You must define a base color during the installation (in hexadecimal format). You can choose it using this online tool for example: https://www.w3schools.com/colors/colors_picker.asp @@ -85,21 +78,26 @@ If something goes wrong, you can go back to the original default file: cp templates/minimaxing/minimaxing_org.css templates/minimaxing/minimaxing.css ``` -## Links - * Report a bug: https://github.com/YunoHost-Apps/lionwiki-t2t_ynh/issues - * App website: https://lionwiki-t2t.sourceforge.io/ - * YunoHost website: https://yunohost.org/ +## Documentation and resources ---- +* Official app website: +* Official user documentation: +* Official admin documentation: +* Upstream app code repository: +* YunoHost documentation for this app: +* Report a bug: ## Developer info Please send your pull request to the [testing branch](https://github.com/YunoHost-Apps/lionwiki-t2t_ynh/tree/testing). To try the testing branch, please proceed like that. -``` + +``` bash sudo yunohost app install https://github.com/YunoHost-Apps/lionwiki-t2t_ynh/tree/testing --debug or sudo yunohost app upgrade lionwiki-t2t -u https://github.com/YunoHost-Apps/lionwiki-t2t_ynh/tree/testing --debug ``` + +**More info regarding app packaging:** diff --git a/README_fr.md b/README_fr.md index 03edee8..9d00b24 100755 --- a/README_fr.md +++ b/README_fr.md @@ -1,22 +1,31 @@ -# Lionwiki-t2t pour YunoHost + -[![Niveau d'intégration](https://dash.yunohost.org/integration/lionwiki-t2t.svg)](https://dash.yunohost.org/appci/app/lionwiki-t2t) ![](https://ci-apps.yunohost.org/ci/badges/lionwiki-t2t.status.svg) ![](https://ci-apps.yunohost.org/ci/badges/lionwiki-t2t.maintain.svg) -[![Installer Lionwiki-t2t avec YunoHost](https://install-app.yunohost.org/install-with-yunohost.svg)](https://install-app.yunohost.org/?app=lionwiki-t2t) +# Lionwiki pour YunoHost -*[Read this readme in english.](./README.md)* +[![Niveau d'intégration](https://dash.yunohost.org/integration/lionwiki-t2t.svg)](https://dash.yunohost.org/appci/app/lionwiki-t2t) ![Statut du fonctionnement](https://ci-apps.yunohost.org/ci/badges/lionwiki-t2t.status.svg) ![Statut de maintenance](https://ci-apps.yunohost.org/ci/badges/lionwiki-t2t.maintain.svg) +[![Installer Lionwiki avec YunoHost](https://install-app.yunohost.org/install-with-yunohost.svg)](https://install-app.yunohost.org/?app=lionwiki-t2t) -> *Ce package vous permet d'installer Lionwiki-t2t rapidement et simplement sur un serveur Yunohost. +*[Read this readme in english.](./README.md)* + +> *Ce package vous permet d'installer Lionwiki 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.* ## Vue d'ensemble Lionwiki-t2t est un système de type wiki minimaliste, programmé en PHP. Il est extensible et n'utilise que des fichiers plats pour sa base de données. Il est adapté pour la création de petits sites web, de notes personnelles ou de journaux. Cette version utilise le langage de balisage léger TXT2TAGS. -**Version incluse :** 3.2.11b -## Capture d'écran +**Version incluse :** 3.2.12~ynh2 -![](screenshot_lionwikit2t.png) + +## Captures d'écran + +![Capture d'écran de Lionwiki](./doc/screenshots/screenshot_lionwikit2t.png) + +## Avertissements / informations importantes ## Configuration @@ -28,28 +37,12 @@ Dans le dossier racine de l'application il y a 2 fichiers, `config.php` et `conf - L'outil `pheditor.php` à la racine du site permet d'éditer tous les fichiers de configuration nécessaires. Vous pouvez le retirer ou le renommer depuis son interface. Le mot de passe est le même que celui définit lors de l'installation. -## Documentation - - * Documentation officielle : https://lionwiki-t2t.sourceforge.io/ - * À propos de txt2tags : https://github.com/farvardin/whatistxt2tags - -## Caractéristiques spécifiques YunoHost - #### Support multi-utilisateurs Il y a un seul mot de passe pour éditer ce wiki (dans le fichier config.php), et un autre pour l'administration. C'est le même qui a a été créé lors de l'installation par YunoHost. Vous pouvez passer le wiki en mode privé ou public, selon vos usages. -#### Architectures supportées - -* x86-64 - [![Build Status](https://ci-apps.yunohost.org/ci/logs/lionwikit2t%20%28Apps%29.svg)](https://ci-apps.yunohost.org/ci/apps/lionwikit2t/) -* ARMv8-A - [![Build Status](https://ci-apps-arm.yunohost.org/ci/logs/lionwikit2t%20%28Apps%29.svg)](https://ci-apps-arm.yunohost.org/ci/apps/lionwikit2t/) - -## Limitations - -* Un seul compte utilisateur. - ## Informations additionnelles Vous devez définir une couleur de base durant l'installation, au format hexadécimal. Vous pouvez la choisir en utilisant cet outil en ligne : https://www.w3schools.com/colors/colors_picker.asp @@ -83,21 +76,26 @@ Si quelque chose se passe mal, vous pouvez revenir au fichier original : cp templates/minimaxing/minimaxing_org.css templates/minimaxing/minimaxing.css ``` -## Liens - * Signaler un bug: https://github.com/YunoHost-Apps/lionwiki-t2t_ynh/issues - * Site de l'application: https://lionwiki-t2t.sourceforge.io/ - * Site web YunoHost: https://yunohost.org/ +## Documentations et ressources ---- +* Site officiel de l'app : +* Documentation officielle utilisateur : +* Documentation officielle de l'admin : +* Dépôt de code officiel de l'app : +* Documentation YunoHost pour cette app : +* Signaler un bug : ## Informations pour les développeurs Merci de faire vos pull request sur la [branche testing](https://github.com/YunoHost-Apps/lionwiki-t2t_ynh/tree/testing). Pour essayer la branche testing, procédez comme suit. -``` + +``` bash sudo yunohost app install https://github.com/YunoHost-Apps/lionwiki-t2t_ynh/tree/testing --debug ou sudo yunohost app upgrade lionwiki-t2t -u https://github.com/YunoHost-Apps/lionwiki-t2t_ynh/tree/testing --debug ``` + +**Plus d'infos sur le packaging d'applications :** diff --git a/check_process b/check_process index 525d22a..53cffea 100755 --- a/check_process +++ b/check_process @@ -3,9 +3,9 @@ ; Manifest domain="domain.tld" path="/path" - admin="john" - language="en" is_public=1 + language="en" + admin="john" password="azerty1234" wiki="My Wiki" color="328cc1" @@ -17,14 +17,12 @@ setup_private=1 setup_public=1 upgrade=1 - upgrade=1 from_commit=69db9a386081d9241f5548e09052fd58dee45463 + # 3.2.12~ynh1 + upgrade=1 from_commit=a59e01aec10bd3a749ce062d2931906151d8f8be backup_restore=1 multi_instance=1 + port_already_use=0 change_url=1 ;;; Options Email= Notification=none -;;; Upgrade options - ; commit=69db9a386081d9241f5548e09052fd58dee45463 - name=Merge pull request #4 from YunoHost-Apps/testing - manifest_arg=domain=DOMAIN&path=PATH&admin=USER&is_public=Yes&language=en& diff --git a/conf/nginx.conf b/conf/nginx.conf index ec10d44..b7c8793 100755 --- a/conf/nginx.conf +++ b/conf/nginx.conf @@ -2,7 +2,7 @@ location __PATH__/ { # Path to source - alias __FINALPATH__/ ; + alias __FINALPATH__/; index index.php; diff --git a/doc/.gitkeep b/doc/.gitkeep new file mode 100644 index 0000000..e69de29 diff --git a/doc/DESCRIPTION.md b/doc/DESCRIPTION.md new file mode 100644 index 0000000..6dffdd8 --- /dev/null +++ b/doc/DESCRIPTION.md @@ -0,0 +1 @@ +LionWiki-t2t is a minimalist Wiki engine programmed in PHP. It is extensible, templatable, file based (it doesn't need database like MySQL) and requires just one file to function (30 kb). It is suitable for small websites, personal notebooks or journals. This version is using the lightweight markup language TXT2TAGS. diff --git a/doc/DESCRIPTION_fr.md b/doc/DESCRIPTION_fr.md new file mode 100644 index 0000000..95fe616 --- /dev/null +++ b/doc/DESCRIPTION_fr.md @@ -0,0 +1 @@ +Lionwiki-t2t est un système de type wiki minimaliste, programmé en PHP. Il est extensible et n'utilise que des fichiers plats pour sa base de données. Il est adapté pour la création de petits sites web, de notes personnelles ou de journaux. Cette version utilise le langage de balisage léger TXT2TAGS. diff --git a/doc/DISCLAIMER.md b/doc/DISCLAIMER.md new file mode 100644 index 0000000..7fb11e6 --- /dev/null +++ b/doc/DISCLAIMER.md @@ -0,0 +1,51 @@ +## Configuration + +In the root folder of this app, there are two files: `config.php` and `config.t2t` + +- `config.php` is for changing password, the template used, default page. You can also define an administrator password which has some more rights (it's possible to lock some pages and modify them only with the administrator password, add some IP address to a blacklist) + +- `config.t2t` is for tweaking your wiki syntax. You can define more tags (using the txt2tags rules) for specific behaviors. + +The `pheditor.php` tool at the root of the site allows you to edit all the necessary configuration files. You can remove or rename it from its interface. The password is the same as the one defined during installation. + +#### Multi-users support + +This is only a single password for editing the wiki (it's not multi-user), and one other password for administration. Both are set to the same one defined in the lionwiki-t2t during the installation by YunoHost. + +You can set the wiki to private (only readable when you are connected to YunoHost SSO) or public (readable by the whole internet). + +You can install multiple instance of this app. + +## Additional information + +You must define a base color during the installation (in hexadecimal format). You can choose it using this online tool for example: https://www.w3schools.com/colors/colors_picker.asp + +It will modify the `templates/minimaxing/minimaxing.less` file and compile it using the lessc command (from the node-less package). + +After the installation, you can edit the base color found in `/var/www/lionwikit2t/templates/minimaxing/minimaxing.less` file. + +Search for: + +``` +/* For YunoHost config */ +@MainColor: #D17732; +``` + +Go inside your installation folder (adapt it to your case, if it's the second instance you've installed, it will be named /var/www/lionwikit2t__2/): + +``` +cd /var/www/lionwikit2t +``` + +Then compile it with: + +``` +lessc templates/minimaxing/minimaxing.less > templates/minimaxing/minimaxing.css +``` + +If something goes wrong, you can go back to the original default file: + +``` +cp templates/minimaxing/minimaxing_org.css templates/minimaxing/minimaxing.css +``` + diff --git a/doc/DISCLAIMER_fr.md b/doc/DISCLAIMER_fr.md new file mode 100644 index 0000000..8478130 --- /dev/null +++ b/doc/DISCLAIMER_fr.md @@ -0,0 +1,49 @@ +## Configuration + +Dans le dossier racine de l'application il y a 2 fichiers, `config.php` et `config.t2t` + +- config.php permet de modifier le mot de passe, le choix du template utilisé et la page par défaut. Vous pouvez également définir ici un mot de passe administrateur (pour bloquer certaines pages en édition) + +- `config.t2t` est pour customiser votre syntaxe wiki. Vous pouvez définir là de nouvelles balises (utilisant les règles txt2tags) pour des comportements spécifiques. + +- L'outil `pheditor.php` à la racine du site permet d'éditer tous les fichiers de configuration nécessaires. Vous pouvez le retirer ou le renommer depuis son interface. Le mot de passe est le même que celui définit lors de l'installation. + +#### Support multi-utilisateurs + +Il y a un seul mot de passe pour éditer ce wiki (dans le fichier config.php), et un autre pour l'administration. C'est le même qui a a été créé lors de l'installation par YunoHost. + +Vous pouvez passer le wiki en mode privé ou public, selon vos usages. + +## Informations additionnelles + +Vous devez définir une couleur de base durant l'installation, au format hexadécimal. Vous pouvez la choisir en utilisant cet outil en ligne : https://www.w3schools.com/colors/colors_picker.asp + +La couleur choisie va modifier le fichier `templates/minimaxing/minimaxing.less` et le compiler en utilisant la commande lessc (du paquet node-less). + +Après l'installation, vous pouvez éditer la couleur de base dans le fichier `/var/www/lionwikit2t/templates/minimaxing/minimaxing.less` + +Recherchez pour : + +``` +/* For YunoHost config */ +@MainColor: #D17732; +``` + +Allez dans le dossier d'installation (à adapter à votre cas, si c'est la seconde instance installée, cela sera nommé `/var/www/lionwikit2t__2/`) : + +``` +cd /var/www/lionwikit2t +``` + +Ensuite compilez le fichier avec : + +``` +lessc templates/minimaxing/minimaxing.less > templates/minimaxing/minimaxing.css +``` + +Si quelque chose se passe mal, vous pouvez revenir au fichier original : + +``` +cp templates/minimaxing/minimaxing_org.css templates/minimaxing/minimaxing.css +``` + diff --git a/doc/screenshots/.gitkeep b/doc/screenshots/.gitkeep new file mode 100644 index 0000000..e69de29 diff --git a/screenshot_lionwikit2t.png b/doc/screenshots/screenshot_lionwikit2t.png old mode 100755 new mode 100644 similarity index 100% rename from screenshot_lionwikit2t.png rename to doc/screenshots/screenshot_lionwikit2t.png diff --git a/manifest.json b/manifest.json index b465d15..641e14d 100755 --- a/manifest.json +++ b/manifest.json @@ -6,8 +6,15 @@ "en": "Lightweight wiki-style CMS using the txt2tags syntax", "fr": "CMS léger, géré sous forme de wiki utilisant la syntaxe txt2tags" }, - "version": "3.2.12~ynh1", + "version": "3.2.12~ynh2", "url": "https://lionwiki-t2t.sourceforge.io/", + "upstream": { + "license": "MIT", + "website": "https://lionwiki-t2t.sourceforge.io/", + "admindoc": "https://lionwiki-t2t.sourceforge.io/", + "userdoc": "https://github.com/farvardin/whatistxt2tags", + "code": "https://sourceforge.net/projects/lionwiki-t2t" + }, "license": "MIT", "maintainer": { "name": "Eric Forgeot" @@ -21,7 +28,7 @@ "php7.3-fpm" ], "arguments": { - "install" : [ + "install": [ { "name": "domain", "type": "domain" @@ -32,10 +39,6 @@ "example": "/lionwiki", "default": "/lionwiki" }, - { - "name": "admin", - "type": "user" - }, { "name": "is_public", "type": "boolean", @@ -55,6 +58,10 @@ "choices": ["fr", "en"], "default": "en" }, + { + "name": "admin", + "type": "user" + }, { "name": "password", "type": "password", diff --git a/scripts/backup b/scripts/backup index 2d90ed5..75ce3e0 100755 --- a/scripts/backup +++ b/scripts/backup @@ -6,7 +6,7 @@ # IMPORT GENERIC HELPERS #================================================= -#Keep this path for calling _common.sh inside the execution's context of backup and restore scripts +# 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 @@ -14,6 +14,7 @@ source /usr/share/yunohost/helpers # MANAGE SCRIPT FAILURE #================================================= +# Exit if an error occurs during the execution of the script ynh_abort_if_errors #================================================= diff --git a/scripts/change_url b/scripts/change_url index ea89a34..ba919a3 100755 --- a/scripts/change_url +++ b/scripts/change_url @@ -30,7 +30,7 @@ ynh_script_progression --message="Loading installation settings..." --weight=1 final_path=$(ynh_app_setting_get --app=$app --key=final_path) #================================================= -# BACKUP BEFORE UPGRADE THEN ACTIVE TRAP +# BACKUP BEFORE CHANGE URL THEN ACTIVE TRAP #================================================= ynh_script_progression --message="Backing up the app before changing its URL (may take a while)..." --weight=4 @@ -40,7 +40,7 @@ ynh_clean_setup () { # 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" - # restore it if the upgrade fails + # Restore it if the upgrade fails ynh_restore_upgradebackup } # Exit if an error occurs during the execution of the script @@ -62,6 +62,8 @@ then change_path=1 fi +#================================================= +# STANDARD MODIFICATIONS #================================================= # MODIFY URL IN NGINX CONF #================================================= @@ -91,6 +93,8 @@ then ynh_store_file_checksum --file="/etc/nginx/conf.d/$new_domain.d/$app.conf" fi +#================================================= +# GENERIC FINALISATION #================================================= # RELOAD NGINX #================================================= diff --git a/scripts/install b/scripts/install index db02e8b..efb404d 100755 --- a/scripts/install +++ b/scripts/install @@ -14,7 +14,6 @@ source /usr/share/yunohost/helpers #================================================= ynh_clean_setup () { - ### Remove this function if there's nothing to clean before calling the remove script. true } # Exit if an error occurs during the execution of the script @@ -26,9 +25,9 @@ ynh_abort_if_errors domain=$YNH_APP_ARG_DOMAIN path_url=$YNH_APP_ARG_PATH -admin=$YNH_APP_ARG_ADMIN is_public=$YNH_APP_ARG_IS_PUBLIC language=$YNH_APP_ARG_LANGUAGE +admin=$YNH_APP_ARG_ADMIN password=$YNH_APP_ARG_PASSWORD wiki=$YNH_APP_ARG_WIKI color=$YNH_APP_ARG_COLOR @@ -53,20 +52,11 @@ ynh_script_progression --message="Storing installation settings..." --weight=1 ynh_app_setting_set --app=$app --key=domain --value=$domain ynh_app_setting_set --app=$app --key=path --value=$path_url -ynh_app_setting_set --app=$app --key=admin --value=$admin ynh_app_setting_set --app=$app --key=language --value=$language +ynh_app_setting_set --app=$app --key=admin --value=$admin #================================================= # STANDARD MODIFICATIONS -#================================================= -# FIND AND OPEN A PORT -#================================================= -ynh_script_progression --message="Finding an available port..." --weight=1 - -# Find an available port -port=$(ynh_find_port --port=8095) -ynh_app_setting_set --app=$app --key=port --value=$port - #================================================= # INSTALL DEPENDENCIES #================================================= @@ -74,6 +64,14 @@ ynh_script_progression --message="Installing dependencies..." --weight=3 ynh_install_app_dependencies $pkg_dependencies +#================================================= +# CREATE DEDICATED USER +#================================================= +ynh_script_progression --message="Configuring system user..." --weight=1 + +# Create a system user +ynh_system_user_create --username=$app --home_dir="$final_path" + #================================================= # DOWNLOAD, CHECK AND UNPACK SOURCE #================================================= @@ -83,22 +81,6 @@ 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" -#================================================= -# NGINX CONFIGURATION -#================================================= -ynh_script_progression --message="Configuring NGINX web server..." --weight=2 - -# Create a dedicated NGINX config -ynh_add_nginx_config - -#================================================= -# CREATE DEDICATED USER -#================================================= -ynh_script_progression --message="Configuring system user..." --weight=1 - -# Create a system user -ynh_system_user_create --username=$app - #================================================= # PHP-FPM CONFIGURATION #================================================= @@ -108,10 +90,20 @@ ynh_script_progression --message="Configuring PHP-FPM..." --weight=1 ynh_add_fpm_config phpversion=$(ynh_app_setting_get --app=$app --key=phpversion) +#================================================= +# NGINX CONFIGURATION +#================================================= +ynh_script_progression --message="Configuring NGINX web server..." --weight=2 + +# Create a dedicated NGINX config +ynh_add_nginx_config + #================================================= # SPECIFIC SETUP #================================================= -# customise Lionwiki-t2t +# ADD A CONFIGURATION +#================================================= +ynh_script_progression --message="Adding a configuration file..." ### Copy Yunohost specific configuration # This File cannot be modified directly by wiki, only by hand or by Yunohost @@ -167,46 +159,32 @@ lessc $final_path/templates/ggp/ggp.less > $final_path/templates/ggp/ggp.css #ynh_replace_string --match_string="__YNH_COLOR__" --replace_string="$color" --target_file="$final_path/templates/minimaxing/minimaxing.css" -#================================================= -# STORE THE CONFIG FILE CHECKSUM -#================================================= - ynh_store_file_checksum --file="$final_path/config.php" ynh_store_file_checksum --file="$final_path/config.t2t" ynh_store_file_checksum --file="$final_path/menu.php" -#================================================= -# GENERIC FINALIZATION #================================================= # SECURE FILES AND DIRECTORIES #================================================= # Set permissions to app files -chown -R root: $final_path - -# Wiki needs to write inside these folders. Make "Wiki" owner -chown -R $app:root $final_path/var -chown -R $app:root $final_path/templates - -# write everything, even config files, for pheditor: -chown -R $app:root $final_path/ - -# Allow access to public assets like style sheets -find $final_path/templates -type f -print0 | xargs -0 chmod 0644 -find $final_path/templates -type d -print0 | xargs -0 chmod 0755 -find $final_path/templates/minimaxing/minimaxing.css -type f -print0 | xargs -0 chmod 0755 -# Using "find" instead of "chmod -R 755" so files does not become executable too -# chmod : -rwxr-xr-x 1 root root 241 May 3 08:36 index.html => BAD -# find : -rw-r--r-- 1 1001 1002 241 May 3 08:36 index.html => GOOD +chown -R $app:www-data $final_path +chmod -R o-rwx $final_path +find $final_path -type d -exec chmod g=rx {} + +find $final_path -type f -exec chmod g=r {} + +#================================================= +# GENERIC FINALIZATION #================================================= # SETUP SSOWAT #================================================= ynh_script_progression --message="Configuring permissions..." --weight=1 -# Make app public if necessary or protect it +# Make app public if necessary if [ $is_public -eq 1 ] then + # Everyone can access the app. + # The "main" permission is automatically created before the install script. ynh_permission_update --permission="main" --add="visitors" fi diff --git a/scripts/remove b/scripts/remove index 0fb22ef..cca754d 100755 --- a/scripts/remove +++ b/scripts/remove @@ -17,7 +17,6 @@ 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) final_path=$(ynh_app_setting_get --app=$app --key=final_path) #================================================= @@ -30,14 +29,6 @@ ynh_script_progression --message="Removing app main directory..." --weight=2 # Remove the app directory securely ynh_secure_remove --file="$final_path" -#================================================= -# REMOVE DEPENDENCIES -#================================================= -ynh_script_progression --message="Removing dependencies..." --weight=2 - -# Remove metapackage and its dependencies -ynh_remove_app_dependencies - #================================================= # REMOVE NGINX CONFIGURATION #================================================= @@ -54,6 +45,14 @@ ynh_script_progression --message="Removing PHP-FPM configuration..." --weight=1 # Remove the dedicated PHP-FPM config ynh_remove_fpm_config +#================================================= +# REMOVE DEPENDENCIES +#================================================= +ynh_script_progression --message="Removing dependencies..." --weight=2 + +# Remove metapackage and its dependencies +ynh_remove_app_dependencies + #================================================= # GENERIC FINALIZATION #================================================= diff --git a/scripts/restore b/scripts/restore index a05d5b0..a1d649c 100755 --- a/scripts/restore +++ b/scripts/restore @@ -6,7 +6,7 @@ # IMPORT GENERIC HELPERS #================================================= -#Keep this path for calling _common.sh inside the execution's context of backup and restore scripts +# 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 @@ -15,7 +15,6 @@ source /usr/share/yunohost/helpers #================================================= ynh_clean_setup () { - #### Remove this function if there's nothing to clean before calling the remove script. true } # Exit if an error occurs during the execution of the script @@ -24,7 +23,7 @@ ynh_abort_if_errors #================================================= # LOAD SETTINGS #================================================= -ynh_script_progression --message="Loading settings..." --weight=1 +ynh_script_progression --message="Loading installation settings..." --weight=1 app=$YNH_APP_INSTANCE_NAME @@ -38,23 +37,11 @@ phpversion=$(ynh_app_setting_get --app=$app --key=phpversion) #================================================= ynh_script_progression --message="Validating restoration parameters..." --weight=1 -test ! -d $final_path || ynh_die --message="There is already a directory: $final_path " +test ! -d $final_path \ + || ynh_die --message="There is already a directory: $final_path " #================================================= # STANDARD RESTORATION STEPS -#================================================= -# RESTORE THE NGINX CONFIGURATION -#================================================= - -ynh_restore_file --origin_path="/etc/nginx/conf.d/$domain.d/$app.conf" - -#================================================= -# RESTORE THE APP MAIN DIR -#================================================= -ynh_script_progression --message="Restoring the app main directory..." --weight=2 - -ynh_restore_file --origin_path="$final_path" - #================================================= # RECREATE THE DEDICATED USER #================================================= @@ -64,18 +51,17 @@ ynh_script_progression --message="Recreating the dedicated system user..." --wei ynh_system_user_create --username=$app #================================================= -# RESTORE USER RIGHTS +# RESTORE THE APP MAIN DIR #================================================= +ynh_script_progression --message="Restoring the app main directory..." --weight=2 + +ynh_restore_file --origin_path="$final_path" # Restore permissions on app files -chown -R root: $final_path - -#================================================= -# RESTORE THE PHP-FPM CONFIGURATION -#================================================= -ynh_script_progression --message="Reconfiguring PHP-FPM..." --weight=3 - -ynh_restore_file --origin_path="/etc/php/$phpversion/fpm/pool.d/$app.conf" +chown -R $app:www-data $final_path +chmod -R o-rwx $final_path +find $final_path -type d -exec chmod g=rx {} + +find $final_path -type f -exec chmod g=r {} + #================================================= # SPECIFIC RESTORATION @@ -87,6 +73,20 @@ ynh_script_progression --message="Reinstalling dependencies..." --weight=4 # 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=3 + +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..." + +ynh_restore_file --origin_path="/etc/nginx/conf.d/$domain.d/$app.conf" + #================================================= # GENERIC FINALIZATION #================================================= diff --git a/scripts/upgrade b/scripts/upgrade index ff04018..6e77b71 100755 --- a/scripts/upgrade +++ b/scripts/upgrade @@ -18,17 +18,32 @@ app=$YNH_APP_INSTANCE_NAME domain=$(ynh_app_setting_get --app=$app --key=domain) path_url=$(ynh_app_setting_get --app=$app --key=path) +language=$(ynh_app_setting_get --app=$app --key=language) admin=$(ynh_app_setting_get --app=$app --key=admin) final_path=$(ynh_app_setting_get --app=$app --key=final_path) -language=$(ynh_app_setting_get --app=$app --key=language) phpversion=$(ynh_app_setting_get --app=$app --key=phpversion) #================================================= # CHECK VERSION #================================================= +ynh_script_progression --message="Checking version..." 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)..." --weight=4 + +# Backup the current version of the app +ynh_backup_before_upgrade +ynh_clean_setup () { + # Restore it if the upgrade fails + ynh_restore_upgradebackup +} +# Exit if an error occurs during the execution of the script +ynh_abort_if_errors + #================================================= # ENSURE DOWNWARD COMPATIBILITY #================================================= @@ -48,18 +63,12 @@ if ynh_legacy_permissions_exists; then fi #================================================= -# BACKUP BEFORE UPGRADE THEN ACTIVE TRAP +# CREATE DEDICATED USER #================================================= -ynh_script_progression --message="Backing up the app before upgrading (may take a while)..." --weight=4 +ynh_script_progression --message="Making sure dedicated system user exists..." --weight=1 -# Backup the current version of the app -ynh_backup_before_upgrade -ynh_clean_setup () { - # restore it if the upgrade fails - ynh_restore_upgradebackup -} -# Exit if an error occurs during the execution of the script -ynh_abort_if_errors +# Create a dedicated user (if not existing) +ynh_system_user_create --username=$app --home_dir="$final_path" #================================================= # DOWNLOAD, CHECK AND UNPACK SOURCE @@ -73,14 +82,6 @@ then ynh_setup_source --dest_dir="$final_path" fi -#================================================= -# NGINX CONFIGURATION -#================================================= -ynh_script_progression --message="Upgrading nginx web server configuration..." --weight=2 - -# Create a dedicated nginx config -ynh_add_nginx_config - #================================================= # UPGRADE DEPENDENCIES #================================================= @@ -88,14 +89,6 @@ ynh_script_progression --message="Upgrading dependencies..." --weight=3 ynh_install_app_dependencies $pkg_dependencies -#================================================= -# CREATE DEDICATED USER -#================================================= -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 - #================================================= # PHP-FPM CONFIGURATION #================================================= @@ -104,6 +97,14 @@ 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=2 + +# Create a dedicated NGINX config +ynh_add_nginx_config + #================================================= # STORE THE CONFIG FILE CHECKSUM #================================================= @@ -126,8 +127,13 @@ ynh_store_file_checksum --file="$final_path/menu.php" #================================================= # Set permissions on app files -chown -R root: $final_path +chown -R $app:www-data $final_path +chmod -R o-rwx $final_path +find $final_path -type d -exec chmod g=rx {} + +find $final_path -type f -exec chmod g=r {} + +#================================================= +# GENERIC FINALIZATION #================================================= # RELOAD NGINX #=================================================