From 5599e56a5ec45f1ffc6981f53d8571df5dc1783a Mon Sep 17 00:00:00 2001 From: Yalh Date: Mon, 14 Jan 2019 23:35:20 +0100 Subject: [PATCH 01/55] Full update of the package from example_ynh And upgrade to version 8.4.4 --- README.md | 76 +++++++++- check_process | 36 ++--- conf/app.src | 8 +- conf/nginx.conf | 63 ++++----- conf/php-fpm.conf | 27 ++-- conf/systemd.service | 13 ++ manifest.json | 76 +++++----- scripts/.fonctions | 330 ------------------------------------------- scripts/_common.sh | 13 ++ scripts/backup | 102 ++++++++----- scripts/change_url | 102 +++++++++++++ scripts/install | 310 ++++++++++++++++++++++++++++++---------- scripts/remove | 134 ++++++++++++++---- scripts/restore | 155 ++++++++++++++------ scripts/upgrade | 199 ++++++++++++++++++-------- 15 files changed, 969 insertions(+), 675 deletions(-) create mode 100644 conf/systemd.service delete mode 100644 scripts/.fonctions create mode 100644 scripts/_common.sh create mode 100644 scripts/change_url diff --git a/README.md b/README.md index cc20a06..41daa5f 100644 --- a/README.md +++ b/README.md @@ -1,6 +1,11 @@ -[![Install concrete5 with YunoHost](https://github.com/ABLD/install-app/blob/master/install-with-yunohost-community.png)](https://install-app.yunohost.org/?app=concrete5) - # concrete5_ynh +[![Integration level](https://dash.yunohost.org/integration/concrete5.svg)](https://ci-apps.yunohost.org/jenkins/job/concrete5%20%28Community%29/lastBuild/consoleFull) +[![Install concrete5 with YunoHost](https://install-app.yunohost.org/install-with-yunohost.png)](https://install-app.yunohost.org/?app=concrete5) + +> *This package allow you to install concrete5 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.* + +## Overview Concrete5 is a modern CMS. Features : * SEO Tools @@ -12,7 +17,70 @@ Features : * **and more**... ## Etat : NOT WORKING -## Screenshot - Site officiel : https://www.concrete5.org/ + +**Shipped version:** 8.4.4 + +## Screenshots + +![](Link to an screenshot for this app) + +## Demo + +* [Official demo](Link to a demo site for this app) + +## Configuration + +How to configure this app: by an admin panel, a plain file with SSH, or any other way. + +## Documentation + + * Official documentation: Link to the official documentation of this app + * YunoHost documentation: If specific documentation is needed, feel free to contribute. + +## YunoHost specific features + +#### Multi-users support + +Are LDAP and HTTP auth supported? +Can the app be used by multiple users? + +#### Supported architectures + +* x86-64b - [![Build Status](https://ci-apps.yunohost.org/jenkins/job/concrete5%20(Community)/badge/icon)](https://ci-apps.yunohost.org/jenkins/job/concrete5%20(Community)/) +* ARMv8-A - [![Build Status](https://ci-apps-arm.yunohost.org/jenkins/job/concrete5%20(Community)%20(%7EARM%7E)/badge/icon)](https://ci-apps-arm.yunohost.org/jenkins/job/concrete5%20(Community)%20(%7EARM%7E)/) +* Jessie x86-64b - [![Build Status](https://ci-stretch.nohost.me/jenkins/job/concrete5%20(Community)/badge/icon)](https://ci-stretch.nohost.me/jenkins/job/concrete5%20(Community)/) + +## Limitations + +* Any known limitations. + +## Additional information + +* Other information you would add about this application + +**More information on the documentation page:** +https://yunohost.org/packaging_apps + +## Links + + * Report a bug: https://github.com/YunoHost-Apps/concrete5_ynh/issues + * App website: https://www.concrete5.org/ + * YunoHost website: https://yunohost.org/ + +--- + +Developers info +---------------- + +**Only if you want to use a testing branch for coding, instead of merging directly into master.** +Please do your pull request to the [testing branch](https://github.com/YunoHost-Apps/concrete5_ynh/tree/testing). + +To try the testing branch, please proceed like that. +``` +sudo yunohost app install https://github.com/YunoHost-Apps/concrete5_ynh/tree/testing --debug +or +sudo yunohost app upgrade concrete5 -u https://github.com/YunoHost-Apps/concrete5_ynh/tree/testing --debug +``` + diff --git a/check_process b/check_process index 66cc848..83a4573 100644 --- a/check_process +++ b/check_process @@ -1,14 +1,17 @@ -;; Nom du test - auto_remove=1 +# See here for more information +# https://github.com/YunoHost/package_check#syntax-check_process-file + +# Move this file from check_process.default to check_process when you have filled it. + +;; Test complet ; Manifest domain="domain.tld" (DOMAIN) path="/path" (PATH) - is_public="Yes" (PUBLIC|public=Yes|private=No) - admin_name="john" (USER) - admin_pass="123456789AaBbCc" (PASSWORD) - admin_email="abc@example.com" + admin="john" (USER) + language="fr_FR" + is_public=1 (PUBLIC|public=1|private=0) + password="pass" website_title="site" - language="Fr" ; Checks pkg_linter=1 @@ -18,25 +21,24 @@ setup_private=1 setup_public=1 upgrade=1 - backup_restore=0 + backup_restore=1 multi_instance=1 - wrong_user=1 - wrong_path=1 incorrect_path=1 - corrupt_source=1 - fail_download_source=1 port_already_use=0 - final_path_already_use=1 + change_url=0 ;;; Levels Level 1=auto Level 2=auto Level 3=auto - Level 4=na -# level 4: for instance there is no ldap integration. There is already a MySQL integration. - Level 5=1 -# level 5: le test ne semble pas tout à fait savoir ce qu'est vraiment un "exit". +# 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=0 + Level 5=auto Level 6=auto Level 7=auto Level 8=0 Level 9=0 Level 10=0 +;;; Options +Email= +Notification=none diff --git a/conf/app.src b/conf/app.src index 1b9f078..b253f9f 100644 --- a/conf/app.src +++ b/conf/app.src @@ -1,2 +1,6 @@ -SOURCE_URL=https://github.com/concrete5/concrete5/archive/8.2.1.tar.gz -SOURCE_SUM=3cd496c25f3bc02451219ce39e471cdc +SOURCE_URL=https://codeload.github.com/concrete5/concrete5/tar.gz/8.4.4 +SOURCE_SUM=sha256 7c862e4d3b2aed854fd86ee1a5d94222dd72f555d56828111db603005c1d1b6f +SOURCE_SUM_PRG=sha256sum +SOURCE_FORMAT=tar.gz +SOURCE_IN_SUBDIR=true +SOURCE_FILENAME= diff --git a/conf/nginx.conf b/conf/nginx.conf index 031ac7f..c7536cb 100644 --- a/conf/nginx.conf +++ b/conf/nginx.conf @@ -1,42 +1,33 @@ -location {LOCATION} { - alias {DESTDIR}; +#sub_path_only rewrite ^__PATH__$ __PATH__/ permanent; +location __PATH__/ { - # Default indexes and catch-all - index index.html index.php; - try_files $uri $uri/ {PATH}/index.php?$args; - - # Force HTTPS - if ($scheme = http) { - rewrite ^ https://$server_name$request_uri? permanent; - } + # Path to source + alias __FINALPATH__/ ; - # Prevent useless logs - location = {PATH}/favicon.ico { - log_not_found off; - access_log off; - } - location = {PATH}/robots.txt { - allow all; - log_not_found off; - access_log off; - } + # Force usage of https + if ($scheme = http) { + rewrite ^ https://$server_name$request_uri? permanent; + } - # Deny access to hidden files and directories - location ~ ^{PATH}/(.+/|)\.(?!well-known\/) { - deny all; - } +### Example PHP configuration (remove it if not used) + index index.php; - # Execute and serve PHP files - location ~ [^/]\.php(/|$) { - fastcgi_split_path_info ^(.+?\.php)(/.*)$; - fastcgi_pass unix:/var/run/php5-fpm-{POOLNAME}.sock; - fastcgi_index index.php; - include fastcgi_params; - fastcgi_param REMOTE_USER $remote_user; - fastcgi_param PATH_INFO $fastcgi_path_info; - fastcgi_param SCRIPT_FILENAME $request_filename; - } + # Common parameter to increase upload size limit in conjunction with dedicated php-fpm file + #client_max_body_size 50M; - # Include SSOWAT user panel. - include conf.d/yunohost_panel.conf.inc; + try_files $uri $uri/ index.php; + location ~ [^/]\.php(/|$) { + fastcgi_split_path_info ^(.+?\.php)(/.*)$; + fastcgi_pass unix:/var/run/php5-fpm-__NAME__.sock; + + fastcgi_index index.php; + include fastcgi_params; + fastcgi_param REMOTE_USER $remote_user; + fastcgi_param PATH_INFO $fastcgi_path_info; + fastcgi_param SCRIPT_FILENAME $request_filename; + } +### End of PHP configuration part + + # Include SSOWAT user panel. + include conf.d/yunohost_panel.conf.inc; } diff --git a/conf/php-fpm.conf b/conf/php-fpm.conf index b516d66..58ab5e2 100644 --- a/conf/php-fpm.conf +++ b/conf/php-fpm.conf @@ -19,8 +19,8 @@ ; Unix user/group of processes ; Note: The user is mandatory. If the group is not set, the default user's group ; will be used. -user = www-data -group = www-data +user = __USER__ +group = __USER__ ; The address on which to accept FastCGI requests. ; Valid syntaxes are: @@ -32,7 +32,7 @@ group = www-data ; Note: This value is mandatory. listen = /var/run/php5-fpm-__NAMETOCHANGE__.sock -; Set listen(2) backlog. +; Set listen(2) backlog. A value of '-1' means unlimited. ; Default Value: 128 (-1 on FreeBSD and OpenBSD) ;listen.backlog = 128 @@ -220,9 +220,9 @@ pm.max_requests = 500 ; Note: The value must start with a leading slash (/). The value can be ; anything, but it may not be a good idea to use the .php extension or it ; may conflict with a real PHP file. -; Default Value: not set +; Default Value: not set ;pm.status_path = /status - + ; The ping URI to call the monitoring page of FPM. If this value is not set, no ; URI will be recognized as a ping page. This could be used to test from outside ; that FPM is alive and responding, or to @@ -335,13 +335,13 @@ request_terminate_timeout = 1d ; possible. However, all PHP paths will be relative to the chroot ; (error_log, sessions.save_path, ...). ; Default Value: not set -;chroot = - +;chroot = + ; Chdir to this directory at the start. ; Note: relative path can be used. ; Default Value: current directory or / when chroot chdir = __FINALPATH__ - + ; Redirect worker stdout and stderr into main error log. If not set, stdout and ; stderr will be redirected to /dev/null according to FastCGI specs. ; Note: on highloaded environement, this can cause some delay in the page @@ -390,3 +390,14 @@ catch_workers_output = yes ;php_admin_value[error_log] = /var/log/fpm-php.www.log ;php_admin_flag[log_errors] = on ;php_admin_value[memory_limit] = 32M + +; Common values to change to increase file upload limit +; php_admin_value[upload_max_filesize] = 50M +; php_admin_value[post_max_size] = 50M +; php_admin_flag[mail.add_x_header] = Off + +; Other common parameters +; php_admin_value[max_execution_time] = 600 +; php_admin_value[max_input_time] = 300 +; php_admin_value[memory_limit] = 256M +; php_admin_flag[short_open_tag] = On diff --git a/conf/systemd.service b/conf/systemd.service new file mode 100644 index 0000000..76cdf64 --- /dev/null +++ b/conf/systemd.service @@ -0,0 +1,13 @@ +[Unit] +Description=Small description of the service +After=network.target + +[Service] +Type=simple +User=__APP__ +Group=__APP__ +WorkingDirectory=__FINALPATH__/ +ExecStart=__FINALPATH__/script >> /var/log/__APP__/__APP__.log 2>&1 + +[Install] +WantedBy=multi-user.target diff --git a/manifest.json b/manifest.json index 6f201c6..f938d2f 100644 --- a/manifest.json +++ b/manifest.json @@ -11,14 +11,19 @@ }, "license": "MIT", "url": "www.concrete5.org", + "license": "free", "maintainer": { "name": "frju365", "email": "win10@tutanota.com" }, + "requirements": { + "yunohost": ">= 2.7.14" + }, "multi_instance": true, "services": [ "nginx", - "php5-fpm" + "php5-fpm", + "mysql" ], "arguments": { "install" : [ @@ -29,7 +34,7 @@ "en": "Choose a domain for Concrete5", "fr": "Choisissez un domaine pour Concrete5" }, - "example": "domain.org" + "example": "example.com" }, { "name": "path", @@ -42,40 +47,44 @@ "default": "/concrete" }, { - "name": "is_public", - "ask": { - "en": "Is it a public Concrete5 site ?", - "fr": "Est-ce un site public ?" - }, - "choices": ["Yes", "No"], - "default": "Yes" - }, - { - "name": "admin_name", + "name": "admin", "type": "user", "ask": { - "en": "Choose the Concrete5 administrator (must be an existing YunoHost user)", - "fr": "Choisissez l'administrateur de Concrete5 (doit être un utilisateur YunoHost existant)" + "en": "Choose an admin user", + "fr": "Choisissez l’administrateur" }, - "example": "homer" + "example": "johndoe" }, { - "name": "admin_pass", + "name": "is_public", + "type": "boolean", + "ask": { + "en": "Is it a public application?", + "fr": "Est-ce une application publique ?" + }, + "default": true + }, + { + "name": "language", + "ask": { + "en": "Choose the application language", + "fr": "Choisissez la langue de l'application" + }, + "choices": ["en_GB", "fr_FR", "de_DE", "pt_PT"], + "default": "en_GB" + }, + { + "name": "password", "type": "password", "ask": { - "en": "Set the password for the Admin user ≥ 5 character", - "fr": "Définissez le mot de passe pour l'Administrateur. ≥ cinq charactères" + "en": "Set the administrator password", + "fr": "Définissez le mot de passe administrateur" }, - "example": "myreallystrengthpassword" - }, - { - "name": "admin_email", - "type": "email", - "ask": { - "en": "Your mail address.", - "fr": "Votre adresse mail." - }, - "exemple": "abc@efg.hi" + "help": { + "en": "Use the help field to add an information for the admin about this question.", + "fr": "Utilisez le champ aide pour ajouter une information à l'intention de l'administrateur à propos de cette question." + }, + "example": "Choose a password" }, { "name": "website_title", @@ -85,17 +94,6 @@ "fr": "Le titre de votre site." }, "exemple": "MY BIG WEBSITE" - }, - { - "name": "language", - "ask": { - "en": "Default language to be used in your website admin", - "fr": "Langue par défaut à utiliser dans votre interface d'administration" - }, - "choices": [ - "En", "Fr", "De", "Pt" - ], - "default": "English" } ] } diff --git a/scripts/.fonctions b/scripts/.fonctions deleted file mode 100644 index df9cc60..0000000 --- a/scripts/.fonctions +++ /dev/null @@ -1,330 +0,0 @@ -#!/bin/bash - -#================================================= -# CHECKING -#================================================= - -CHECK_USER () { # Vérifie la validité de l'user admin -# $1 = Variable de l'user admin. - ynh_user_exists "$1" || ynh_die "Wrong user" -} - -CHECK_DOMAINPATH () { # Vérifie la disponibilité du path et du domaine. - sudo yunohost app checkurl $domain$path_url -a $app -} - -CHECK_FINALPATH () { # Vérifie que le dossier de destination n'est pas déjà utilisé. - final_path=/var/www/$app - test ! -e "$final_path" || ynh_die "This path already contains a folder" -} - -#================================================= -# DISPLAYING -#================================================= - -NO_PRINT () { # Supprime l'affichage dans stdout pour la commande en argument. - set +x - eval "$@" - set -x -} - -WARNING () { # Écrit sur le canal d'erreur pour passer en warning. - eval "$@" >&2 -} - -SUPPRESS_WARNING () { # Force l'écriture sur la sortie standard - eval "$@" 2>&1 -} - -QUIET () { # Redirige la sortie standard dans /dev/null - eval "$@" > /dev/null -} - -ALL_QUIET () { # Redirige la sortie standard et d'erreur dans /dev/null - eval "$@" > /dev/null 2>&1 -} - -#================================================= -# SETUP -#================================================= - -SETUP_SOURCE () { # Télécharge la source, décompresse et copie dans $final_path - src_url=$(cat ../conf/app.src | grep SOURCE_URL | cut -d= -f2) - src_checksum=$(cat ../conf/app.src | grep SOURCE_SUM | cut -d= -f2) - # Download sources from the upstream - wget -nv -O source.tar.gz $src_url - # Vérifie la somme de contrôle de la source téléchargée. - echo "$src_checksum source.tar.gz" | md5sum -c --status || ynh_die "Corrupt source" - # Extract source into the app dir - sudo mkdir -p $final_path - sudo tar -x -f source.tar.gz -C $final_path --strip-components 1 -} - -POOL_FPM () { # Créer le fichier de configuration du pool php-fpm et le configure. - sed -i "s@__NAMETOCHANGE__@$app@g" ../conf/php-fpm.conf - sed -i "s@__FINALPATH__@$final_path@g" ../conf/php-fpm.conf - sed -i "s@__USER__@$app@g" ../conf/php-fpm.conf - finalphpconf=/etc/php5/fpm/pool.d/$app.conf - sudo cp ../conf/php-fpm.conf $finalphpconf - sudo chown root: $finalphpconf - finalphpini=/etc/php5/fpm/conf.d/20-$app.ini - sudo cp ../conf/php-fpm.ini $finalphpini - sudo chown root: $finalphpini - sudo service php5-fpm reload -} - -#================================================= -# REMOVE -#================================================= - -REMOVE_NGINX_CONF () { # Suppression de la configuration nginx - if [ -e "/etc/nginx/conf.d/$domain.d/$app.conf" ]; then # Delete nginx config - echo "Delete nginx config" - sudo rm "/etc/nginx/conf.d/$domain.d/$app.conf" - sudo service nginx reload - fi -} - -REMOVE_FPM_CONF () { # Suppression de la configuration du pool php-fpm - if [ -e "/etc/php5/fpm/pool.d/$app.conf" ]; then # Delete fpm config - echo "Delete fpm config" - sudo rm "/etc/php5/fpm/pool.d/$app.conf" - fi - if [ -e "/etc/php5/fpm/conf.d/20-$app.ini" ]; then # Delete php config - echo "Delete php config" - sudo rm "/etc/php5/fpm/conf.d/20-$app.ini" - fi - sudo service php5-fpm reload -} - -SECURE_REMOVE () { # Suppression de dossier avec vérification des variables - chaine="$1" # L'argument doit être donné entre quotes simple '', pour éviter d'interpréter les variables. - no_var=0 - while (echo "$chaine" | grep -q '\$') # Boucle tant qu'il y a des $ dans la chaine - do - no_var=1 - global_var=$(echo "$chaine" | cut -d '$' -f 2) # Isole la première variable trouvée. - only_var=\$$(expr "$global_var" : '\([A-Za-z0-9_]*\)') # Isole complètement la variable en ajoutant le $ au début et en gardant uniquement le nom de la variable. Se débarrasse surtout du / et d'un éventuel chemin derrière. - real_var=$(eval "echo ${only_var}") # `eval "echo ${var}` permet d'interpréter une variable contenue dans une variable. - if test -z "$real_var" || [ "$real_var" = "/" ]; then - WARNING echo "Variable $only_var is empty, suppression of $chaine cancelled." - return 1 - fi - chaine=$(echo "$chaine" | sed "s@$only_var@$real_var@") # remplace la variable par sa valeur dans la chaine. - done - if [ "$no_var" -eq 1 ] - then - if [ -e "$chaine" ]; then - echo "Delete directory $chaine" - sudo rm -r "$chaine" - fi - return 0 - else - WARNING echo "No detected variable." - return 1 - fi -} - -REMOVE_SYS_USER () { # Supprime l'utilisateur système dédié à l'app - if ynh_system_user_exists "$app" # Test l'existence de l'utilisateur - then - sudo userdel $app - fi -} - -#================================================= -# BACKUP -#================================================= - -BACKUP_FAIL_UPGRADE () { - WARNING echo "Upgrade failed." - if ALL_QUIET sudo yunohost backup list | grep -q $app-before-upgrade$backup_number; then # Vérifie l'existence de l'archive avant de supprimer l'application et de restaurer - sudo yunohost app remove $app # Supprime l'application avant de la restaurer. - sudo yunohost backup restore --ignore-hooks $app-before-upgrade$backup_number --apps $app --force # Restore the backup if upgrade failed - ynh_die "The app was restored to the way it was before the failed upgrade." - fi -} - -BACKUP_BEFORE_UPGRADE () { # Backup the current version of the app, restore it if the upgrade fails - backup_number=1 - old_backup_number=2 - if ALL_QUIET sudo yunohost backup list | grep -q $app-before-upgrade1; then # Vérifie l'existence d'une archive déjà numéroté à 1. - backup_number=2 # Et passe le numéro de l'archive à 2 - old_backup_number=1 - fi - - sudo yunohost backup create --ignore-hooks --apps $app --name $app-before-upgrade$backup_number # Créer un backup différent de celui existant. - if [ "$?" -eq 0 ]; then # Si le backup est un succès, supprime l'archive précédente. - if ALL_QUIET sudo yunohost backup list | grep -q $app-before-upgrade$old_backup_number; then # Vérifie l'existence de l'ancienne archive avant de la supprimer, pour éviter une erreur. - QUIET sudo yunohost backup delete $app-before-upgrade$old_backup_number - fi - else # Si le backup a échoué - ynh_die "Backup failed, the upgrade process was aborted." - fi -} - -#================================================= -# CONFIGURATION -#================================================= - -STORE_MD5_CONFIG () { # Enregistre la somme de contrôle du fichier de config -# $1 = Nom du fichier de conf pour le stockage dans settings.yml -# $2 = Nom complet et chemin du fichier de conf. - ynh_app_setting_set $app $1_file_md5 $(sudo md5sum "$2" | cut -d' ' -f1) -} - -CHECK_MD5_CONFIG () { # Créé un backup du fichier de config si il a été modifié. -# $1 = Nom du fichier de conf pour le stockage dans settings.yml -# $2 = Nom complet et chemin du fichier de conf. - if [ "$(ynh_app_setting_get $app $1_file_md5)" != $(sudo md5sum "$2" | cut -d' ' -f1) ]; then - sudo cp -a "$2" "$2.backup.$(date '+%d.%m.%y_%Hh%M,%Ss')" # Si le fichier de config a été modifié, créer un backup. - fi -} - - -# Normalize the url path syntax -# Handle the slash at the beginning of path and its absence at ending -# Return a normalized url path -# -# example: url_path=$(ynh_normalize_url_path $url_path) -# ynh_normalize_url_path example -> /example -# ynh_normalize_url_path /example -> /example -# ynh_normalize_url_path /example/ -> /example -# -# usage: ynh_normalize_url_path path_to_normalize -# | arg: url_path_to_normalize - URL path to normalize before using it -ynh_normalize_url_path () { - path_url=$1 - test -n "$path_url" || ynh_die "ynh_normalize_url_path expect a URL path as first argument and received nothing." - if [ "${path_url:0:1}" != "/" ]; then # If the first character is not a / - path_url="/$path_url" # Add / at begin of path variable - fi - if [ "${path_url:${#path_url}-1}" == "/" ] && [ ${#path_url} -gt 1 ]; then # If the last character is a / and that not the only character. - path_url="${path_url:0:${#path_url}-1}" # Delete the last character - fi - echo $path_url -} - -# Create a database, an user and its password. Then store the password in the app's config -# -# User of database will be store in db_user's variable. -# Name of database will be store in db_name's variable. -# And password in db_pwd's variable. -# -# usage: ynh_mysql_generate_db user name -# | arg: user - Owner of the database -# | arg: name - Name of the database -ynh_mysql_generate_db () { - db_pwd=$(ynh_string_random) # Generate a random password - ynh_mysql_create_db "$2" "$1" "$db_pwd" # Create the database - ynh_app_setting_set $app mysqlpwd $db_pwd # Store the password in the app's config -} - -# Remove a database if it exist and the associated user -# -# usage: ynh_mysql_remove_db user name -# | arg: user - Proprietary of the database -# | arg: name - Name of the database -ynh_mysql_remove_db () { - if mysqlshow -u root -p$(sudo cat $MYSQL_ROOT_PWD_FILE) | grep -q "^| $2"; then # Check if the database exist - echo "Remove database $2" >&2 - ynh_mysql_drop_db $2 # Remove the database - ynh_mysql_drop_user $1 # Remove the associated user to database - else - echo "Database $2 not found" >&2 - fi -} - -# Correct the name given in argument for mariadb -# -# Avoid invalid name for your database -# -# Exemple: dbname=$(ynh_make_valid_dbid $app) -# -# usage: ynh_make_valid_dbid name -# | arg: name - name to correct -# | ret: the corrected name -ynh_make_valid_dbid () { - dbid=${1//[-.]/_} # Mariadb doesn't support - and . in the name of databases. It will be replace by _ - echo $dbid -} - -# Install dependencies with a equivs control file -# -# usage: ynh_app_dependencies dep [dep [...]] -# | arg: dep - the package name to install in dependence -ynh_app_dependencies () { - dependencies=$@ - manifest_path="../manifest.json" - if [ ! -e "$manifest_path" ]; then - manifest_path="../settings/manifest.json" # Into the restore script, the manifest is not at the same place - fi - version=$(sudo python3 -c "import sys, json;print(json.load(open(\"$manifest_path\"))['version'])") # Retrieve the version number in the manifest file. - dep_app=${app//_/-} # Replace all '_' by '-' - cat > ./${dep_app}-ynh-deps.control << EOF # Make a control file for equivs-build -Section: misc -Priority: optional -Package: ${dep_app}-ynh-deps -Version: ${version} -Depends: ${dependencies} -Architecture: all -Description: Fake package for ${app} (YunoHost app) dependencies - This meta-package is only responsible of installing its dependencies. -EOF - ynh_package_install_from_equivs ./${dep_app}-ynh-deps.control \ - || ynh_die "Unable to install dependencies" # Install the fake package and its dependencies -} - -# Remove fake package and its dependencies -# -# Dependencies will removed only if no other package need them. -# -# usage: ynh_remove_app_dependencies -ynh_remove_app_dependencies () { - dep_app=${app/_/-} # Replace all '_' by '-' - ynh_package_autoremove ${dep_app}-ynh-deps # Remove the fake package and its dependencies if they not still used. -} - -# Manage a fail of the script -# -# Print a warning to inform that the script was failed -# Execute the ynh_clean_setup function if used in the app script -# -# usage of ynh_clean_setup function -# This function provide a way to clean some residual of installation that not managed by remove script. -# To use it, simply add in your script: -# ynh_clean_setup () { -# instructions... -# } -# This function is optionnal. -# -# Usage: ynh_exit_properly is used only by the helper ynh_check_error. -# You must not use it directly. -ynh_exit_properly () { - exit_code=$? - if [ "$exit_code" -eq 0 ]; then - exit 0 # Exit without error if the script ended correctly - fi - - trap '' EXIT # Ignore new exit signals - set +eu # Do not exit anymore if a command fail or if a variable is empty - - echo -e "!!\n $app's script has encountered an error. Its execution was cancelled.\n!!" >&2 - - if type -t ynh_clean_setup > /dev/null; then # Check if the function exist in the app script. - ynh_clean_setup # Call the function to do specific cleaning for the app. - fi - - ynh_die # Exit with error status -} - -# Exit if an error occurs during the execution of the script. -# -# Stop immediatly the execution if an error occured or if a empty variable is used. -# The execution of the script is derivate to ynh_exit_properly function before exit. -# -# Usage: ynh_check_error -ynh_check_error () { - set -eu # Exit if a command fail, and if a variable is used unset. - trap ynh_exit_properly EXIT # Capturing exit signals on shell script -} diff --git a/scripts/_common.sh b/scripts/_common.sh new file mode 100644 index 0000000..bb04a03 --- /dev/null +++ b/scripts/_common.sh @@ -0,0 +1,13 @@ +#!/bin/bash + +# ============= FUTURE YUNOHOST HELPER ============= +# Delete a file checksum from the app settings +# +# $app should be defined when calling this helper +# +# usage: ynh_remove_file_checksum file +# | arg: file - The file for which the checksum will be deleted +ynh_delete_file_checksum () { + local checksum_setting_name=checksum_${1//[\/ ]/_} # Replace all '/' and ' ' by '_' + ynh_app_setting_delete $app $checksum_setting_name +} \ No newline at end of file diff --git a/scripts/backup b/scripts/backup index 033e9d8..bfdda6c 100644 --- a/scripts/backup +++ b/scripts/backup @@ -1,49 +1,77 @@ #!/bin/bash -set -eu +#================================================= +# GENERIC START +#================================================= +# IMPORT GENERIC HELPERS +#================================================= -# This is 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 you are interested the 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 - -# Source YunoHost helpers +source ../settings/scripts/_common.sh source /usr/share/yunohost/helpers -# Retrieve arguments +#================================================= +# MANAGE SCRIPT FAILURE +#================================================= + +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 +ynh_abort_if_errors + +#================================================= +# LOAD SETTINGS +#================================================= + +app=$YNH_APP_INSTANCE_NAME + +final_path=$(ynh_app_setting_get $app final_path) domain=$(ynh_app_setting_get $app domain) +db_name=$(ynh_app_setting_get $app db_name) -### MySQL (remove if not used) ### -# If a MySQL database is used: -# # Dump the database -db_name=$app -db_user=$app -db_pass=$(ynh_app_setting_get "$app" mysqlpwd) -mysqldump -u "$db_user" -p"$db_pass" --no-create-db "$db_name" > ./dump.sql -### MySQL end ### +#================================================= +# STANDARD BACKUP STEPS +#================================================= +# BACKUP THE APP MAIN DIR +#================================================= +ynh_backup "$final_path" -# Backup directory location for the app from where the script is executed and -# which will be compressed afterward -backup_dir=$YNH_APP_BACKUP_DIR +#================================================= +# BACKUP THE NGINX CONFIGURATION +#================================================= -# Backup sources & data -ynh_backup "/var/www/$app" "sources" +ynh_backup "/etc/nginx/conf.d/$domain.d/$app.conf" -# Copy Nginx conf -sudo mkdir -p ./conf -ynh_backup "/etc/nginx/conf.d/$domain.d/$app.conf" "conf/nginx.conf" +#================================================= +# BACKUP THE PHP-FPM CONFIGURATION +#================================================= -### PHP (remove if not used) ### -# If a dedicated php-fpm process is used: -# # Copy PHP-FPM pool configuration -ynh_backup "/etc/php5/fpm/pool.d/${app}.conf" "php-fpm.conf" -ynh_backup "/etc/php5/fpm/conf.d/20-$app.ini" "php-fpm.ini" -### PHP end ### +ynh_backup "/etc/php5/fpm/pool.d/$app.conf" + +#================================================= +# BACKUP THE MYSQL DATABASE +#================================================= + +ynh_mysql_dump_db "$db_name" > db.sql + +#================================================= +# SPECIFIC BACKUP +#================================================= +# BACKUP LOGROTATE +#================================================= + +ynh_backup "/etc/logrotate.d/$app" + +#================================================= +# BACKUP SYSTEMD +#================================================= + +#ynh_backup "/etc/systemd/system/$app.service" + +#================================================= +# BACKUP A CRON FILE +#================================================= + +ynh_backup "/etc/cron.d/$app" diff --git a/scripts/change_url b/scripts/change_url new file mode 100644 index 0000000..f71fc77 --- /dev/null +++ b/scripts/change_url @@ -0,0 +1,102 @@ +#!/bin/bash + +#================================================= +# GENERIC STARTING +#================================================= +# IMPORT GENERIC HELPERS +#================================================= + +source _common.sh +source /usr/share/yunohost/helpers + +#================================================= +# RETRIEVE ARGUMENTS +#================================================= + +old_domain=$YNH_APP_OLD_DOMAIN +old_path=$YNH_APP_OLD_PATH + +new_domain=$YNH_APP_NEW_DOMAIN +new_path=$YNH_APP_NEW_PATH + +app=$YNH_APP_INSTANCE_NAME + +#================================================= +# LOAD SETTINGS +#================================================= + +# Needed for helper "ynh_add_nginx_config" +final_path=$(ynh_app_setting_get $app final_path) + +# Add settings here as needed by your application +#db_name=$(ynh_app_setting_get "$app" db_name) +#db_pwd=$(ynh_app_setting_get $app db_pwd) + +#================================================= +# CHECK THE SYNTAX OF THE PATHS +#================================================= + +test -n "$old_path" || old_path="/" +test -n "$new_path" || new_path="/" +new_path=$(ynh_normalize_url_path $new_path) +old_path=$(ynh_normalize_url_path $old_path) + +#================================================= +# CHECK WHICH PARTS SHOULD BE CHANGED +#================================================= + +change_domain=0 +if [ "$old_domain" != "$new_domain" ] +then + change_domain=1 +fi + +change_path=0 +if [ "$old_path" != "$new_path" ] +then + change_path=1 +fi + +#================================================= +# STANDARD MODIFICATIONS +#================================================= +# MODIFY URL IN NGINX CONF +#================================================= + +nginx_conf_path=/etc/nginx/conf.d/$old_domain.d/$app.conf + +# Change the path in the nginx config file +if [ $change_path -eq 1 ] +then + # Make a backup of the original nginx config file if modified + ynh_backup_if_checksum_is_different "$nginx_conf_path" + # Set global variables for nginx helper + domain="$old_domain" + path_url="$new_path" + # Create a dedicated nginx config + ynh_add_nginx_config +fi + +# Change the domain for nginx +if [ $change_domain -eq 1 ] +then + # Delete file checksum for the old conf file location + ynh_delete_file_checksum "$nginx_conf_path" + mv $nginx_conf_path /etc/nginx/conf.d/$new_domain.d/$app.conf + # Store file checksum for the new config file location + ynh_store_file_checksum "/etc/nginx/conf.d/$new_domain.d/$app.conf" +fi + +#================================================= +# SPECIFIC MODIFICATIONS +#================================================= +# ... +#================================================= + +#================================================= +# GENERIC FINALISATION +#================================================= +# RELOAD NGINX +#================================================= + +systemctl reload nginx diff --git a/scripts/install b/scripts/install index 7bb9bfc..7bc3704 100644 --- a/scripts/install +++ b/scripts/install @@ -1,19 +1,24 @@ -#!/bin/bash + o#!/bin/bash #================================================= -# GENERIC STARTING +# GENERIC START #================================================= # IMPORT GENERIC HELPERS #================================================= -source .fonctions +source _common.sh source /usr/share/yunohost/helpers #================================================= -# MANAGE FAILURE OF THE SCRIPT +# MANAGE SCRIPT FAILURE #================================================= -ynh_check_error # Active trap pour arrêter le script si une erreur est détectée. +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 +ynh_abort_if_errors #================================================= # RETRIEVE ARGUMENTS FROM THE MANIFEST @@ -21,92 +26,152 @@ ynh_check_error # Active trap pour arrêter le script si une erreur est détect domain=$YNH_APP_ARG_DOMAIN path_url=$YNH_APP_ARG_PATH +admin=$YNH_APP_ARG_ADMIN is_public=$YNH_APP_ARG_IS_PUBLIC -admin_name=$YNH_APP_ARG_ADMIN_NAME -admin_pass=$YNH_APP_ARG_ADMIN_PASS -admin_email=$YNH_APP_ARG_ADMIN_EMAIL -website_title=$YNH_APP_ARG_WEBSITE_TITLE language=$YNH_APP_ARG_LANGUAGE +password=$YNH_APP_ARG_PASSWORD +admin_email=$(ynh_user_get_info $admin 'mail') +website_title=$YNH_APP_ARG_WEBSITE_TITLE +### 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 THIS ARGS +# CHECK IF THE APP CAN BE INSTALLED WITH THESE ARGS #================================================= -CHECK_USER "$admin_name" # Vérifie la validité de l'user admin -path_url=$(ynh_normalize_url_path $path_url) # Vérifie et corrige la syntaxe du path. -CHECK_DOMAINPATH # Vérifie la disponibilité du path et du domaine. -CHECK_FINALPATH # Vérifie que le dossier de destination n'est pas déjà utilisé. +### 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 "This path already contains a folder" + +# Normalize the url path syntax +path_url=$(ynh_normalize_url_path $path_url) + +# Register (book) web path +ynh_webpath_register $app $domain $path_url #================================================= # STORE SETTINGS FROM MANIFEST #================================================= -user="$app" -ynh_app_setting_set "$app" is_public "$is_public" -ynh_app_setting_set "$app" admin_pass "$admin_pass" -ynh_app_setting_set "$app" admin_name "$admin_name" -ynh_app_setting_set "$app" admin_email "$admin_email" -ynh_app_setting_set "$app" language "$language" -ynh_app_setting_set "$app" website_title "$website_title" - -#================================================= -# Check password strength -#================================================= - -[[ ${#admin_pass} -gt 5 ]] || ynh_die \ -"The password is too weak, it must be longer than 5 characters" +ynh_app_setting_set $app domain $domain +ynh_app_setting_set $app path $path_url +ynh_app_setting_set $app admin $admin +ynh_app_setting_set $app is_public $is_public +ynh_app_setting_set $app language $language +ynh_app_setting_set $app password $password +ynh_app_setting_set $app admin_email $admin_email +ynh_app_setting_set $app website_title $website_title #================================================= # STANDARD MODIFICATIONS #================================================= -# CREATE A SQL BDD +# FIND AND OPEN A PORT #================================================= -db_name=$app -db_user=$app -db_pass=$(ynh_string_random) -ynh_mysql_create_db "$db_name" "$db_user" "$db_pass" -ynh_app_setting_set "$app" db_name "$db_name" -ynh_app_setting_set "$app" db_pass "$db_pass" -ynh_app_setting_set "$app" db_user "$db_user" -ynh_app_setting_set "$app" mysqlpwd "$db_pass" +### Use these lines if you have to open a port for the application +### `ynh_find_port` will find the first available port starting from the given port. +### If you're not using these lines: +### - Remove the section "CLOSE A PORT" in the remove script + +# Find a free port +#port=$(ynh_find_port 8095) +# Open this port +#yunohost firewall allow --no-upnp TCP $port 2>&1 +#ynh_app_setting_set $app port $port + +#================================================= +# INSTALL 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 +### - As well as the section "REINSTALL DEPENDENCIES" in the restore script +### - And the section "UPGRADE DEPENDENCIES" in the upgrade script + +#ynh_install_app_dependencies deb1 deb2 + +#================================================= +# CREATE A MYSQL 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 + +db_name=$(ynh_sanitize_dbid $app) +ynh_app_setting_set $app db_name $db_name +ynh_mysql_setup_db $db_name $db_name + #================================================= # DOWNLOAD, CHECK AND UNPACK SOURCE #================================================= -final_path=/var/www/$app +### `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 final_path $final_path -SETUP_SOURCE # Télécharge la source, décompresse et copie dans $final_path +# Download, check integrity, uncompress and patch the source from app.src +ynh_setup_source "$final_path" + +#================================================= +# NGINX CONFIGURATION +#================================================= + +### `ynh_add_nginx_config` will use the file conf/nginx.conf + +# Create a dedicated nginx config +ynh_add_nginx_config + +#================================================= +# CREATE DEDICATED USER +#================================================= + +# Create a system user +ynh_system_user_create $app #================================================= # PHP-FPM CONFIGURATION #================================================= -POOL_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 and conf/php-fpm.ini +### 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 #================================================= # SPECIFIC SETUP #================================================= -# LANGUAGE +# ... #================================================= -if [ $language = "En" ] -then - language=en_GB -elif [ $language = "Fr" ] -then - language=fr_FR -elif [ $language = "De" ] -then - language=de_DE -elif [ $language = "Pt" ] -then - language=pt_PT -else - ynh_die "Language is no available" -fi #================================================ @@ -125,43 +190,136 @@ sudo ./concrete/bin/concrete5 c5:install --db-server=localhost \ --db-database=$db_name \ --site="'$website_title'" \ --admin-email="'$admin_email'" \ - --admin-password=$admin_pass \ + --admin-password=$password \ --language=$language popd -#================================================= -# Set permissions -#================================================= - -sudo chown www-data:www-data $final_path -R -sudo chmod 777 $final_path -R #================================================= -# NGINX CONFIGURATION +# SETUP SYSTEMD #================================================= -nginxconf="../conf/nginx.conf" -# Copy and set nginx configuration -sed -i "s@{PATH}@${path_url}@g" $nginxconf -sed -i "s@{LOCATION}@${path_url:-/}@g" $nginxconf -sed -i "s@{DESTDIR}@${final_path}@g" $nginxconf -sed -i "s@{POOLNAME}@${app}@g" $nginxconf -sudo cp ../conf/nginx.conf /etc/nginx/conf.d/${domain}.d/${app}.conf +### `ynh_systemd_config` is used to configure a systemd script for an app. +### It can be used for apps that use sysvinit (with adaptation) or systemd. +### Have a look at the app to be sure this app needs a systemd script. +### `ynh_systemd_config` will use the file conf/systemd.service +### If you're not using these lines: +### - You can remove those files in conf/. +### - Remove the section "BACKUP SYSTEMD" in the backup script +### - Remove also the section "STOP AND REMOVE SYSTEMD SERVICE" in the remove script +### - As well as the section "RESTORE SYSTEMD" in the restore script +### - And the section "SETUP SYSTEMD" in the upgrade script + +# Create a dedicated systemd config +#ynh_add_systemd_config + +#================================================= +# SETUP APPLICATION WITH CURL +#================================================= + +### Use these lines only if the app installation needs to be finalized through +### web forms. We generally don't want to ask the final user, +### so we're going to use curl to automatically fill the fields and submit the +### forms. + +# Set right permissions for curl install +#chown -R $app: $final_path + +# Set the app as temporarily public for curl call +#ynh_app_setting_set $app skipped_uris "/" +# Reload SSOwat config +#yunohost app ssowatconf + +# Reload Nginx +#systemctl reload nginx + +# Installation with curl +#ynh_local_curl "/INSTALL_PATH" "key1=value1" "key2=value2" "key3=value3" + +# Remove the public access +#if [ $is_public -eq 0 ] +#then +# ynh_app_setting_delete $app skipped_uris +#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) + +ynh_replace_string "match_string" "replace_string" "$final_path/CONFIG_FILE" + +#================================================= +# 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 "$final_path/CONFIG_FILE" + +#================================================= +# GENERIC FINALIZATION +#================================================= +# SECURE FILES AND DIRECTORIES +#================================================= + +### For security reason, any app should set the permissions to root: before anything else. +### Then, if write authorization is needed, any access should be given only to directories +### that really need such authorization. + +# Set permissions to app files +chown -R root: $final_path + +#================================================= +# SETUP LOGROTATE +#================================================= + +### `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 + +#================================================= +# ADVERTISE SERVICE IN ADMIN PANEL +#================================================= + +### `yunohost service add` is a CLI yunohost command to add a service in the admin panel. +### You'll find the service in the 'services' section of YunoHost admin panel. +### This CLI command would be useless if the app does not have any services (systemd or sysvinit) +### If you're not using these lines: +### - You can remove these files in conf/. +### - Remove the section "REMOVE SERVICE FROM ADMIN PANEL" in the remove script +### - As well as the section ADVERTISE SERVICE IN ADMIN PANEL" in the restore script + +yunohost service add $app --log "/var/log/$app/APP.log" +# if using yunohost version 3.2 or more in the 'manifest.json', a description can be added +#yunohost service add $app --description "$app daemon for XXX" --log "/var/log/$app/APP.log" #================================================= # SETUP SSOWAT #================================================= -# Make app private if necessary -ynh_app_setting_set "$app" is_public "$is_public" -if [ "$is_public" = "Yes" ]; +# Make app public if necessary +if [ $is_public -eq 1 ] then - ynh_app_setting_set "$app" unprotected_uris "/" + # unprotected_uris allows SSO credentials to be passed anyway. + ynh_app_setting_set $app unprotected_uris "/" fi #================================================= # RELOAD NGINX #================================================= -sudo service nginx reload +systemctl reload nginx diff --git a/scripts/remove b/scripts/remove index 505b89d..912f362 100644 --- a/scripts/remove +++ b/scripts/remove @@ -1,36 +1,118 @@ #!/bin/bash -set -u -# Source app helpers +#================================================= +# GENERIC START +#================================================= +# IMPORT GENERIC HELPERS +#================================================= + +source _common.sh source /usr/share/yunohost/helpers -REMOVE_NGINX_CONF () { # Suppression de la configuration nginx - if [ -e "/etc/nginx/conf.d/$domain.d/$app.conf" ]; then # Delete nginx config - echo "Delete nginx config" - sudo rm "/etc/nginx/conf.d/$domain.d/$app.conf" - fi -} +#================================================= +# LOAD SETTINGS +#================================================= -REMOVE_FPM_CONF () { # Suppression de la configuration du pool php-fpm - if [ -e "/etc/php5/fpm/pool.d/$app.conf" ]; then # Delete fpm config - echo "Delete fpm config" - sudo rm "/etc/php5/fpm/pool.d/$app.conf" - fi -} - -# retrieve arguments app=$YNH_APP_INSTANCE_NAME -dbname=$app -dbuser=$app + domain=$(ynh_app_setting_get $app domain) +port=$(ynh_app_setting_get $app port) +db_name=$(ynh_app_setting_get $app db_name) +db_user=$db_name +final_path=$(ynh_app_setting_get $app final_path) -# Drop MySQL database and user -ynh_mysql_drop_db "$dbname" -ynh_mysql_drop_user "$dbuser" +#================================================= +# STANDARD REMOVE +#================================================= +# STOP AND REMOVE SYSTEMD SERVICE +#================================================= -sudo rm -rf /var/www/$app -REMOVE_NGINX_CONF -REMOVE_FPM_CONF +# Remove the dedicated systemd config +ynh_remove_systemd_config -sudo service nginx reload -sudo service php5-fpm reload +#================================================= +# REMOVE SERVICE FROM ADMIN PANEL +#================================================= + +# Remove a service from the admin panel, added by `yunohost service add` +#if yunohost service status | grep -q $app +#then +# echo "Remove $app service" +# yunohost service remove $app +#fi + +#================================================= +# REMOVE DEPENDENCIES +#================================================= + +# Remove metapackage and its dependencies +#ynh_remove_app_dependencies + +#================================================= +# REMOVE THE MYSQL DATABASE +#================================================= + +# Remove a database if it exists, along with the associated user +ynh_mysql_remove_db $db_user $db_name + +#================================================= +# REMOVE APP MAIN DIR +#================================================= + +# Remove the app directory securely +ynh_secure_remove "$final_path" + +#================================================= +# REMOVE NGINX CONFIGURATION +#================================================= + +# Remove the dedicated nginx config +ynh_remove_nginx_config + +#================================================= +# REMOVE PHP-FPM CONFIGURATION +#================================================= + +# Remove the dedicated php-fpm config +ynh_remove_fpm_config + +#================================================= +# REMOVE LOGROTATE CONFIGURATION +#================================================= + +# Remove the app-specific logrotate config +ynh_remove_logrotate + +#================================================= +# CLOSE A PORT +#================================================= + +#if yunohost firewall list | grep -q "\- $port$" +#then +# echo "Close port $port" >&2 +# yunohost firewall disallow TCP $port 2>&1 +#fi + +#================================================= +# SPECIFIC REMOVE +#================================================= +# REMOVE THE CRON FILE +#================================================= + +# Remove a cron file +ynh_secure_remove "/etc/cron.d/$app" + +# Remove a directory securely +ynh_secure_remove "/etc/$app/" + +# Remove the log files +ynh_secure_remove "/var/log/$app/" + +#================================================= +# GENERIC FINALIZATION +#================================================= +# REMOVE DEDICATED USER +#================================================= + +# Delete a system user +ynh_system_user_delete $app diff --git a/scripts/restore b/scripts/restore index 8e8b334..ec9be76 100644 --- a/scripts/restore +++ b/scripts/restore @@ -1,53 +1,126 @@ #!/bin/bash -# Note: each files and directories you've saved using the ynh_backup helper -# will be located in the current directory, regarding the last argument. +#================================================= +# GENERIC START +#================================================= +# IMPORT GENERIC HELPERS +#================================================= -# Exit on command errors and treat unset variables as an error -set -eu - -# See comments in install script -app=$YNH_APP_INSTANCE_NAME - -# Source YunoHost helpers +source ../settings/scripts/_common.sh source /usr/share/yunohost/helpers -# Retrieve old app settings -domain=$(ynh_app_setting_get "$app" domain) -path=$(ynh_app_setting_get "$app" path) +#================================================= +# MANAGE SCRIPT FAILURE +#================================================= -# Check domain/path availability -sudo yunohost app checkurl "${domain}${path}" -a "$app" \ - || ynh_die "Path not available: ${domain}${path}" +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 +ynh_abort_if_errors -# Restore sources & data -src_path="/var/www/${app}" -sudo cp -a ./sources "$src_path" +#================================================= +# LOAD SETTINGS +#================================================= -# Restore permissions to app files -# you may need to make some file and/or directory writeable by www-data (nginx user) -sudo chown -R root: "$src_path" +app=$YNH_APP_INSTANCE_NAME -### MySQL (remove if not used) ### -# If a MySQL database is used: -# # Create and restore the database -dbname=$app -dbuser=$app -dbpass=$(ynh_app_setting_get "$app" mysqlpwd) -ynh_mysql_create_db "$dbname" "$dbuser" "$dbpass" -ynh_mysql_connect_as "$dbuser" "$dbpass" "$dbname" < ./dump.sql -### MySQL end ### +domain=$(ynh_app_setting_get $app domain) +path_url=$(ynh_app_setting_get $app path) +final_path=$(ynh_app_setting_get $app final_path) +db_name=$(ynh_app_setting_get $app db_name) -# Restore NGINX configuration -sudo cp -a ./nginx.conf "/etc/nginx/conf.d/${domain}.d/${app}.conf" +#================================================= +# CHECK IF THE APP CAN BE RESTORED +#================================================= -### PHP (remove if not used) ### -# If a dedicated php-fpm process is used: -# # Copy PHP-FPM pool configuration and reload the service -sudo cp -a ./php-fpm.conf "/etc/php5/fpm/pool.d/${app}.conf" -sudo cp -a ./php-fpm.ini "/etc/php5/fpm/conf.d/20-$app.ini" -sudo service php5-fpm reload -### PHP end ### +ynh_webpath_available $domain $path_url \ + || ynh_die "Path not available: ${domain}${path_url}" +test ! -d $final_path \ + || ynh_die "There is already a directory: $final_path " -# Restart webserver -sudo service nginx reload +#================================================= +# STANDARD RESTORATION STEPS +#================================================= +# RESTORE THE NGINX CONFIGURATION +#================================================= + +ynh_restore_file "/etc/nginx/conf.d/$domain.d/$app.conf" + +#================================================= +# RESTORE THE APP MAIN DIR +#================================================= + +ynh_restore_file "$final_path" + +#================================================= +# RESTORE THE MYSQL DATABASE +#================================================= + +db_pwd=$(ynh_app_setting_get $app mysqlpwd) +ynh_mysql_setup_db $db_name $db_name $db_pwd +ynh_mysql_connect_as $db_name $db_pwd $db_name < ./db.sql + +#================================================= +# RECREATE THE DEDICATED USER +#================================================= + +# Create the dedicated user (if not existing) +ynh_system_user_create $app + +#================================================= +# RESTORE USER RIGHTS +#================================================= + +# Restore permissions on app files +chown -R root: $final_path + +#================================================= +# RESTORE THE PHP-FPM CONFIGURATION +#================================================= + +ynh_restore_file "/etc/php5/fpm/pool.d/$app.conf" + +#================================================= +# SPECIFIC RESTORATION +#================================================= +# REINSTALL DEPENDENCIES +#================================================= + +# Define and install dependencies +#ynh_install_app_dependencies deb1 deb2 + +#================================================= +# ADVERTISE SERVICE IN ADMIN PANEL +#================================================= + +yunohost service add $app --log "/var/log/$app/APP.log" + +#================================================= +# RESTORE SYSTEMD +#================================================= + +#ynh_restore_file "/etc/systemd/system/$app.service" +#systemctl enable $app.service + +#================================================= +# RESTORE THE CRON FILE +#================================================= + +ynh_restore_file "/etc/cron.d/$app" + +#================================================= +# RESTORE THE LOGROTATE CONFIGURATION +#================================================= + +ynh_restore_file "/etc/logrotate.d/$app" + +#================================================= +# GENERIC FINALIZATION +#================================================= +# RELOAD NGINX AND PHP-FPM +#================================================= + +systemctl reload php5-fpm +systemctl reload nginx diff --git a/scripts/upgrade b/scripts/upgrade index aa7ea08..7d21008 100644 --- a/scripts/upgrade +++ b/scripts/upgrade @@ -1,76 +1,157 @@ #!/bin/bash -# Exit on command errors and treat unset variables as an error -set -eu +#================================================= +# GENERIC START +#================================================= +# IMPORT GENERIC HELPERS +#================================================= -# See comments in install script -app=$YNH_APP_INSTANCE_NAME - -# Source YunoHost helpers +source _common.sh source /usr/share/yunohost/helpers -# Retrieve app settings -domain=$(ynh_app_setting_get "$app" domain) -path_url=$(ynh_app_setting_get "$app" path_url) -admin=$(ynh_app_setting_get "$app" admin) -is_public=$(ynh_app_setting_get "$app" is_public) -language=$(ynh_app_setting_get "$app" language) +#================================================= +# LOAD SETTINGS +#================================================= -# Remove trailing "/" for next commands -path_url=${path_url%/} +app=$YNH_APP_INSTANCE_NAME +domain=$(ynh_app_setting_get $app domain) +path_url=$(ynh_app_setting_get $app path) +admin=$(ynh_app_setting_get $app admin) +is_public=$(ynh_app_setting_get $app is_public) +final_path=$(ynh_app_setting_get $app final_path) +language=$(ynh_app_setting_get $app language) +db_name=$(ynh_app_setting_get $app db_name) + +#================================================= +# ENSURE DOWNWARD COMPATIBILITY +#================================================= + +# Fix is_public as a boolean value +if [ "$is_public" = "Yes" ]; then + ynh_app_setting_set $app is_public 1 + is_public=1 +elif [ "$is_public" = "No" ]; then + ynh_app_setting_set $app is_public 0 + is_public=0 +fi + +# If db_name doesn't exist, create it +if [ -z $db_name ]; then + db_name=$(ynh_sanitize_dbid $app) + ynh_app_setting_set $app db_name $db_name +fi + +# If final_path doesn't exist, create it +if [ -z $final_path ]; then + final_path=/var/www/$app + ynh_app_setting_set $app final_path $final_path +fi + +#================================================= +# BACKUP BEFORE UPGRADE THEN ACTIVE TRAP +#================================================= + +# 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 + +#================================================= +# CHECK THE PATH +#================================================= + +# Normalize the URL path syntax +path_url=$(ynh_normalize_url_path $path_url) + +#================================================= +# STANDARD UPGRADE STEPS #================================================= # DOWNLOAD, CHECK AND UNPACK SOURCE #================================================= -final_path=/var/www/$app -ynh_app_setting_set $app final_path $final_path -sudo git pull origin master; +# Download, check integrity, uncompress and patch the source from app.src +ynh_setup_source "$final_path" -pushd $final_path -sudo php -r "copy('https://getcomposer.org/installer', 'composer-setup.php');" -sudo php -r "if (hash_file('SHA384', 'composer-setup.php') === '55d6ead61b29c7bdee5cccfb50076874187bd9f21f65d8991d46ec5cc90518f447387fb9f76ebae1fbbacf329e583e30') { echo 'Installer verified'; } else { echo 'Installer corrupt'; unlink('composer-setup.php'); } echo PHP_EOL;" -sudo php composer-setup.php -sudo php -r "unlink('composer-setup.php');" -sudo ./composer update -n --no-dev; -sudo ./bin/roadiz generate:nsentities; -sudo ./bin/roadiz orm:schema-tool:update --dump-sql; -sudo ./bin/roadiz orm:schema-tool:update --force; -sudo ./bin/roadiz cache:clear -e prod -popd +#================================================= +# NGINX CONFIGURATION +#================================================= -# Modify Nginx configuration file and copy it to Nginx conf directory -nginx_conf=../conf/nginx.conf -sed -i "s@YNH_WWW_PATH@$path_url@g" $nginx_conf -sed -i "s@YNH_WWW_ALIAS@$src_path/@g" $nginx_conf -# If a dedicated php-fpm process is used: -# -# sed -i "s@YNH_WWW_APP@$app@g" $nginx_conf -sudo cp $nginx_conf /etc/nginx/conf.d/$domain.d/$app.conf +# Create a dedicated nginx config +ynh_add_nginx_config -### PHP (remove if not used) ### -# If a dedicated php-fpm process is used: -# # Modify PHP-FPM pool configuration and copy it to the pool directory -final_path=/var/www/$app -sed -i "s@__NAMETOCHANGE__@$app@g" ../conf/php-fpm.conf -sed -i "s@__FINALPATH__@$final_path@g" ../conf/php-fpm.conf -sed -i "s@__USER__@$app@g" ../conf/php-fpm.conf -finalphpconf=/etc/php5/fpm/pool.d/$app.conf -sudo cp ../conf/php-fpm.conf $finalphpconf -sudo chown root: $finalphpconf -sudo chmod 644 $finalphpconf -finalphpini=/etc/php5/fpm/conf.d/20-$app.ini -sudo cp ../conf/php-fpm.ini $finalphpini -sudo chown root: $finalphpini -sudo chmod 644 $finalphpini -sudo service php5-fpm restart -### PHP end ### +#================================================= +# UPGRADE DEPENDENCIES +#================================================= -# If app is public, add url to SSOWat conf as skipped_uris -if [[ $is_public -eq 1 ]]; then - # See install script - ynh_app_setting_set "$app" unprotected_uris "/" +#ynh_install_app_dependencies deb1 deb2 + +#================================================= +# CREATE DEDICATED USER +#================================================= + +# Create a dedicated user (if not existing) +ynh_system_user_create $app + +#================================================= +# PHP-FPM CONFIGURATION +#================================================= + +# Create a dedicated php-fpm config +ynh_add_fpm_config + +#================================================= +# SPECIFIC UPGRADE +#================================================= +# ... +#================================================= + +### Verify the checksum of a file, stored by `ynh_store_file_checksum` in the install script. +### And create a backup of this file if the checksum is different. So the file will be backed up if the admin had modified it. +ynh_backup_if_checksum_is_different "$final_path/CONFIG_FILE" +# Recalculate and store the checksum of the file for the next upgrade. +ynh_store_file_checksum "$final_path/CONFIG_FILE" + +#================================================= +# SETUP LOGROTATE +#================================================= + +# Use logrotate to manage app-specific logfile(s) +ynh_use_logrotate --non-append + +#================================================= +# SETUP SYSTEMD +#================================================= + +# Create a dedicated systemd config +#ynh_add_systemd_config + +#================================================= +# GENERIC FINALIZATION +#================================================= +# SECURE FILES AND DIRECTORIES +#================================================= + +# Set permissions on app files +chown -R root: $final_path + +#================================================= +# SETUP SSOWAT +#================================================= + +# Make app public if necessary +if [ $is_public -eq 1 ] +then + # unprotected_uris allows SSO credentials to be passed anyway + ynh_app_setting_set $app unprotected_uris "/" fi -# Reload nginx service -sudo service nginx reload +#================================================= +# RELOAD NGINX +#================================================= + +systemctl reload nginx From 5d92f1de06f60e65d9d3f9add35b073b90cdfcbd Mon Sep 17 00:00:00 2001 From: Yalh Date: Mon, 14 Jan 2019 23:45:57 +0100 Subject: [PATCH 02/55] Correcting errors from package_linter --- README.md | 5 +++++ manifest.json | 1 + 2 files changed, 6 insertions(+) diff --git a/README.md b/README.md index 41daa5f..1f212a5 100644 --- a/README.md +++ b/README.md @@ -22,6 +22,11 @@ Site officiel : https://www.concrete5.org/ **Shipped version:** 8.4.4 + +## Licence + +LICENSE MIT + ## Screenshots ![](Link to an screenshot for this app) diff --git a/manifest.json b/manifest.json index f938d2f..1a0f2c5 100644 --- a/manifest.json +++ b/manifest.json @@ -9,6 +9,7 @@ "en": "Create a modern Website", "fr": "Créer un site web moderne avec un CMS moderne" }, + "version": "8.4.4", "license": "MIT", "url": "www.concrete5.org", "license": "free", From 0dc3bc0c4913fc061207b3a5adba082883b9bf0e Mon Sep 17 00:00:00 2001 From: Yalh Date: Mon, 14 Jan 2019 23:48:47 +0100 Subject: [PATCH 03/55] Update SHA SUM --- conf/app.src | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/conf/app.src b/conf/app.src index b253f9f..c9b7390 100644 --- a/conf/app.src +++ b/conf/app.src @@ -1,5 +1,5 @@ SOURCE_URL=https://codeload.github.com/concrete5/concrete5/tar.gz/8.4.4 -SOURCE_SUM=sha256 7c862e4d3b2aed854fd86ee1a5d94222dd72f555d56828111db603005c1d1b6f +SOURCE_SUM=7c862e4d3b2aed854fd86ee1a5d94222dd72f555d56828111db603005c1d1b6f SOURCE_SUM_PRG=sha256sum SOURCE_FORMAT=tar.gz SOURCE_IN_SUBDIR=true From d494293470910fa57f375665055bc8fb47160036 Mon Sep 17 00:00:00 2001 From: Yalh Date: Mon, 14 Jan 2019 23:52:03 +0100 Subject: [PATCH 04/55] Update Composer version to v1.8.0 --- scripts/install | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/scripts/install b/scripts/install index 7bc3704..affea48 100644 --- a/scripts/install +++ b/scripts/install @@ -180,7 +180,7 @@ ynh_add_fpm_config echo "The installation can take long. So be patient ! :)" pushd $final_path sudo php -r "copy('https://getcomposer.org/installer', 'composer-setup.php');" -sudo php -r "if (hash_file('SHA384', 'composer-setup.php') === '669656bab3166a7aff8a7506b8cb2d1c292f042046c5a994c43155c0be6190fa0355160742ab2e1c88d40d5be660b410') { echo 'Installer verified'; } else { echo 'Installer corrupt'; unlink('composer-setup.php'); } echo PHP_EOL;" +sudo php -r "if (hash_file('sha384', 'composer-setup.php') === '93b54496392c062774670ac18b134c3b3a95e5a5e5c8f1a9f115f203b75bf9a129d5daa8ba6a13e2cc8a1da0806388a8') { echo 'Installer verified'; } else { echo 'Installer corrupt'; unlink('composer-setup.php'); } echo PHP_EOL;" sudo php composer-setup.php sudo php -r "unlink('composer-setup.php');" sudo ./composer.phar install From 1f040a59b5e5d7235ecce262e195788cdb55415c Mon Sep 17 00:00:00 2001 From: Yalh Date: Tue, 15 Jan 2019 00:01:02 +0100 Subject: [PATCH 05/55] Fix Installation issue --- scripts/install | 10 +++++----- 1 file changed, 5 insertions(+), 5 deletions(-) diff --git a/scripts/install b/scripts/install index affea48..152b07d 100644 --- a/scripts/install +++ b/scripts/install @@ -1,4 +1,4 @@ - o#!/bin/bash +#!/bin/bash #================================================= # GENERIC START @@ -185,8 +185,8 @@ sudo php composer-setup.php sudo php -r "unlink('composer-setup.php');" sudo ./composer.phar install sudo ./concrete/bin/concrete5 c5:install --db-server=localhost \ - --db-username=$db_user \ - --db-password=$db_pass \ + --db-username=$db_name \ + --db-password=$db_pwd \ --db-database=$db_name \ --site="'$website_title'" \ --admin-email="'$admin_email'" \ @@ -250,7 +250,7 @@ popd ### `ynh_replace_string` is used to replace a string in a file. ### (It's compatible with sed regular expressions syntax) -ynh_replace_string "match_string" "replace_string" "$final_path/CONFIG_FILE" +#ynh_replace_string "match_string" "replace_string" "$final_path/CONFIG_FILE" #================================================= # STORE THE CONFIG FILE CHECKSUM @@ -261,7 +261,7 @@ ynh_replace_string "match_string" "replace_string" "$final_path/CONFIG_FILE" ### 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 "$final_path/CONFIG_FILE" +#ynh_store_file_checksum "$final_path/CONFIG_FILE" #================================================= # GENERIC FINALIZATION From e5d31930862a56231c13bde05ee0bf82ff6b40de Mon Sep 17 00:00:00 2001 From: Yalh Date: Tue, 15 Jan 2019 00:37:40 +0100 Subject: [PATCH 06/55] Fix install issue --- manifest.json | 4 ++-- scripts/install | 12 ++++++++++-- 2 files changed, 12 insertions(+), 4 deletions(-) diff --git a/manifest.json b/manifest.json index 1a0f2c5..e408b0b 100644 --- a/manifest.json +++ b/manifest.json @@ -71,8 +71,8 @@ "en": "Choose the application language", "fr": "Choisissez la langue de l'application" }, - "choices": ["en_GB", "fr_FR", "de_DE", "pt_PT"], - "default": "en_GB" + "choices": ["en_US", "fr_FR", "de_DE", "pt_PT"], + "default": "en_US" }, { "name": "password", diff --git a/scripts/install b/scripts/install index 152b07d..a4ebd3a 100644 --- a/scripts/install +++ b/scripts/install @@ -185,15 +185,23 @@ sudo php composer-setup.php sudo php -r "unlink('composer-setup.php');" sudo ./composer.phar install sudo ./concrete/bin/concrete5 c5:install --db-server=localhost \ + --db-database=$db_name \ --db-username=$db_name \ --db-password=$db_pwd \ - --db-database=$db_name \ --site="'$website_title'" \ --admin-email="'$admin_email'" \ --admin-password=$password \ - --language=$language + --language=$language \ + --site-locale=$language \ + -vvv popd +#time zone +#CanonicalURL +#alternative canoncial url +#elemental_blank 0 +#Additional username + #================================================= From e47ef043182a54d5f6078c744c06ee5e090c83ea Mon Sep 17 00:00:00 2001 From: Yalh Date: Tue, 15 Jan 2019 00:44:50 +0100 Subject: [PATCH 07/55] Fix installation issue --- scripts/install | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-) diff --git a/scripts/install b/scripts/install index a4ebd3a..99277d5 100644 --- a/scripts/install +++ b/scripts/install @@ -193,7 +193,8 @@ sudo ./concrete/bin/concrete5 c5:install --db-server=localhost \ --admin-password=$password \ --language=$language \ --site-locale=$language \ - -vvv + --verbose \ + --no-interaction popd #time zone From df67e2af149bbd7be6a6cb91fd8e91d24fc75bff Mon Sep 17 00:00:00 2001 From: Yalh Date: Tue, 15 Jan 2019 00:48:09 +0100 Subject: [PATCH 08/55] Fix installation issue --- scripts/install | 12 ++++++------ 1 file changed, 6 insertions(+), 6 deletions(-) diff --git a/scripts/install b/scripts/install index 99277d5..1f1cb93 100644 --- a/scripts/install +++ b/scripts/install @@ -179,12 +179,12 @@ ynh_add_fpm_config #================================================= echo "The installation can take long. So be patient ! :)" pushd $final_path -sudo php -r "copy('https://getcomposer.org/installer', 'composer-setup.php');" -sudo php -r "if (hash_file('sha384', 'composer-setup.php') === '93b54496392c062774670ac18b134c3b3a95e5a5e5c8f1a9f115f203b75bf9a129d5daa8ba6a13e2cc8a1da0806388a8') { echo 'Installer verified'; } else { echo 'Installer corrupt'; unlink('composer-setup.php'); } echo PHP_EOL;" -sudo php composer-setup.php -sudo php -r "unlink('composer-setup.php');" -sudo ./composer.phar install -sudo ./concrete/bin/concrete5 c5:install --db-server=localhost \ +sudo $app php -r "copy('https://getcomposer.org/installer', 'composer-setup.php');" +sudo $app php -r "if (hash_file('sha384', 'composer-setup.php') === '93b54496392c062774670ac18b134c3b3a95e5a5e5c8f1a9f115f203b75bf9a129d5daa8ba6a13e2cc8a1da0806388a8') { echo 'Installer verified'; } else { echo 'Installer corrupt'; unlink('composer-setup.php'); } echo PHP_EOL;" +sudo $app php composer-setup.php +sudo $app php -r "unlink('composer-setup.php');" +sudo $app ./composer.phar install +sudo $app ./concrete/bin/concrete5 c5:install --db-server=localhost \ --db-database=$db_name \ --db-username=$db_name \ --db-password=$db_pwd \ From c60de4c08551a7d661f8aa5f152864db281f0138 Mon Sep 17 00:00:00 2001 From: Yalh Date: Tue, 15 Jan 2019 00:51:39 +0100 Subject: [PATCH 09/55] Correct sudo $app command --- scripts/install | 12 ++++++------ 1 file changed, 6 insertions(+), 6 deletions(-) diff --git a/scripts/install b/scripts/install index 1f1cb93..9482953 100644 --- a/scripts/install +++ b/scripts/install @@ -179,12 +179,12 @@ ynh_add_fpm_config #================================================= echo "The installation can take long. So be patient ! :)" pushd $final_path -sudo $app php -r "copy('https://getcomposer.org/installer', 'composer-setup.php');" -sudo $app php -r "if (hash_file('sha384', 'composer-setup.php') === '93b54496392c062774670ac18b134c3b3a95e5a5e5c8f1a9f115f203b75bf9a129d5daa8ba6a13e2cc8a1da0806388a8') { echo 'Installer verified'; } else { echo 'Installer corrupt'; unlink('composer-setup.php'); } echo PHP_EOL;" -sudo $app php composer-setup.php -sudo $app php -r "unlink('composer-setup.php');" -sudo $app ./composer.phar install -sudo $app ./concrete/bin/concrete5 c5:install --db-server=localhost \ +sudo -u $app php -r "copy('https://getcomposer.org/installer', 'composer-setup.php');" +sudo -u $app php -r "if (hash_file('sha384', 'composer-setup.php') === '93b54496392c062774670ac18b134c3b3a95e5a5e5c8f1a9f115f203b75bf9a129d5daa8ba6a13e2cc8a1da0806388a8') { echo 'Installer verified'; } else { echo 'Installer corrupt'; unlink('composer-setup.php'); } echo PHP_EOL;" +sudo -u $app php composer-setup.php +sudo -u $app php -r "unlink('composer-setup.php');" +sudo -u $app ./composer.phar install +sudo -u $app ./concrete/bin/concrete5 c5:install --db-server=localhost \ --db-database=$db_name \ --db-username=$db_name \ --db-password=$db_pwd \ From 945aabed71309cf6a1282700213117b6e67311ce Mon Sep 17 00:00:00 2001 From: Yalh Date: Tue, 15 Jan 2019 00:54:20 +0100 Subject: [PATCH 10/55] manifest modification --- manifest.json | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-) diff --git a/manifest.json b/manifest.json index e408b0b..30a40ea 100644 --- a/manifest.json +++ b/manifest.json @@ -94,7 +94,8 @@ "en": "Your website's title.", "fr": "Le titre de votre site." }, - "exemple": "MY BIG WEBSITE" + "exemple": "MY BIG WEBSITE", + "default": "Concrete" } ] } From 6000fc17ae8cd0bee8572f8da45e174b54e771b6 Mon Sep 17 00:00:00 2001 From: Yalh Date: Tue, 15 Jan 2019 00:56:17 +0100 Subject: [PATCH 11/55] SUDO modification --- scripts/install | 8 ++++---- 1 file changed, 4 insertions(+), 4 deletions(-) diff --git a/scripts/install b/scripts/install index 9482953..55ab601 100644 --- a/scripts/install +++ b/scripts/install @@ -179,10 +179,10 @@ ynh_add_fpm_config #================================================= echo "The installation can take long. So be patient ! :)" pushd $final_path -sudo -u $app php -r "copy('https://getcomposer.org/installer', 'composer-setup.php');" -sudo -u $app php -r "if (hash_file('sha384', 'composer-setup.php') === '93b54496392c062774670ac18b134c3b3a95e5a5e5c8f1a9f115f203b75bf9a129d5daa8ba6a13e2cc8a1da0806388a8') { echo 'Installer verified'; } else { echo 'Installer corrupt'; unlink('composer-setup.php'); } echo PHP_EOL;" -sudo -u $app php composer-setup.php -sudo -u $app php -r "unlink('composer-setup.php');" +sudo php -r "copy('https://getcomposer.org/installer', 'composer-setup.php');" +sudo php -r "if (hash_file('sha384', 'composer-setup.php') === '93b54496392c062774670ac18b134c3b3a95e5a5e5c8f1a9f115f203b75bf9a129d5daa8ba6a13e2cc8a1da0806388a8') { echo 'Installer verified'; } else { echo 'Installer corrupt'; unlink('composer-setup.php'); } echo PHP_EOL;" +sudo php composer-setup.php +sudo php -r "unlink('composer-setup.php');" sudo -u $app ./composer.phar install sudo -u $app ./concrete/bin/concrete5 c5:install --db-server=localhost \ --db-database=$db_name \ From 265331ed07a0f933535d9c0f881cf08bfc9e4604 Mon Sep 17 00:00:00 2001 From: Yalh Date: Tue, 15 Jan 2019 00:57:49 +0100 Subject: [PATCH 12/55] sudo update --- scripts/install | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/scripts/install b/scripts/install index 55ab601..986f76d 100644 --- a/scripts/install +++ b/scripts/install @@ -183,7 +183,7 @@ sudo php -r "copy('https://getcomposer.org/installer', 'composer-setup.php');" sudo php -r "if (hash_file('sha384', 'composer-setup.php') === '93b54496392c062774670ac18b134c3b3a95e5a5e5c8f1a9f115f203b75bf9a129d5daa8ba6a13e2cc8a1da0806388a8') { echo 'Installer verified'; } else { echo 'Installer corrupt'; unlink('composer-setup.php'); } echo PHP_EOL;" sudo php composer-setup.php sudo php -r "unlink('composer-setup.php');" -sudo -u $app ./composer.phar install +sudo ./composer.phar install sudo -u $app ./concrete/bin/concrete5 c5:install --db-server=localhost \ --db-database=$db_name \ --db-username=$db_name \ From 0df0a922f25673e15d20879f3417fb874bc5108e Mon Sep 17 00:00:00 2001 From: Yalh Date: Tue, 15 Jan 2019 00:59:37 +0100 Subject: [PATCH 13/55] update sudo --- scripts/install | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/scripts/install b/scripts/install index 986f76d..99277d5 100644 --- a/scripts/install +++ b/scripts/install @@ -184,7 +184,7 @@ sudo php -r "if (hash_file('sha384', 'composer-setup.php') === '93b54496392c0627 sudo php composer-setup.php sudo php -r "unlink('composer-setup.php');" sudo ./composer.phar install -sudo -u $app ./concrete/bin/concrete5 c5:install --db-server=localhost \ +sudo ./concrete/bin/concrete5 c5:install --db-server=localhost \ --db-database=$db_name \ --db-username=$db_name \ --db-password=$db_pwd \ From 996778c588d98298ad018dd1cc52a5c9f7e04be7 Mon Sep 17 00:00:00 2001 From: Yalh Date: Tue, 15 Jan 2019 01:01:19 +0100 Subject: [PATCH 14/55] allow root installation --- scripts/install | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-) diff --git a/scripts/install b/scripts/install index 99277d5..abb4967 100644 --- a/scripts/install +++ b/scripts/install @@ -194,7 +194,8 @@ sudo ./concrete/bin/concrete5 c5:install --db-server=localhost \ --language=$language \ --site-locale=$language \ --verbose \ - --no-interaction + --no-interaction \ + --allow-as-root popd #time zone From 48e47f91d9baddc93009f8bb4dfa422fe5fa02e9 Mon Sep 17 00:00:00 2001 From: Yalh Date: Tue, 15 Jan 2019 01:19:08 +0100 Subject: [PATCH 15/55] remove logrotate + service file --- conf/systemd.service | 13 ------------- scripts/backup | 2 +- scripts/install | 2 +- scripts/remove | 2 +- scripts/restore | 2 +- scripts/upgrade | 2 +- 6 files changed, 5 insertions(+), 18 deletions(-) delete mode 100644 conf/systemd.service diff --git a/conf/systemd.service b/conf/systemd.service deleted file mode 100644 index 76cdf64..0000000 --- a/conf/systemd.service +++ /dev/null @@ -1,13 +0,0 @@ -[Unit] -Description=Small description of the service -After=network.target - -[Service] -Type=simple -User=__APP__ -Group=__APP__ -WorkingDirectory=__FINALPATH__/ -ExecStart=__FINALPATH__/script >> /var/log/__APP__/__APP__.log 2>&1 - -[Install] -WantedBy=multi-user.target diff --git a/scripts/backup b/scripts/backup index bfdda6c..c97d44f 100644 --- a/scripts/backup +++ b/scripts/backup @@ -62,7 +62,7 @@ ynh_mysql_dump_db "$db_name" > db.sql # BACKUP LOGROTATE #================================================= -ynh_backup "/etc/logrotate.d/$app" +#ynh_backup "/etc/logrotate.d/$app" #================================================= # BACKUP SYSTEMD diff --git a/scripts/install b/scripts/install index abb4967..7c8ae15 100644 --- a/scripts/install +++ b/scripts/install @@ -299,7 +299,7 @@ chown -R root: $final_path ### - And the section "SETUP LOGROTATE" in the upgrade script # Use logrotate to manage application logfile(s) -ynh_use_logrotate +#ynh_use_logrotate #================================================= # ADVERTISE SERVICE IN ADMIN PANEL diff --git a/scripts/remove b/scripts/remove index 912f362..04f6bd5 100644 --- a/scripts/remove +++ b/scripts/remove @@ -81,7 +81,7 @@ ynh_remove_fpm_config #================================================= # Remove the app-specific logrotate config -ynh_remove_logrotate +#ynh_remove_logrotate #================================================= # CLOSE A PORT diff --git a/scripts/restore b/scripts/restore index ec9be76..6009143 100644 --- a/scripts/restore +++ b/scripts/restore @@ -114,7 +114,7 @@ ynh_restore_file "/etc/cron.d/$app" # RESTORE THE LOGROTATE CONFIGURATION #================================================= -ynh_restore_file "/etc/logrotate.d/$app" +#ynh_restore_file "/etc/logrotate.d/$app" #================================================= # GENERIC FINALIZATION diff --git a/scripts/upgrade b/scripts/upgrade index 7d21008..f08cc39 100644 --- a/scripts/upgrade +++ b/scripts/upgrade @@ -121,7 +121,7 @@ ynh_store_file_checksum "$final_path/CONFIG_FILE" #================================================= # Use logrotate to manage app-specific logfile(s) -ynh_use_logrotate --non-append +#ynh_use_logrotate --non-append #================================================= # SETUP SYSTEMD From 76e55ffa81df11539cc81f23b21f97309aaae290 Mon Sep 17 00:00:00 2001 From: Yalh Date: Tue, 15 Jan 2019 01:49:42 +0100 Subject: [PATCH 16/55] update chown --- scripts/install | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-) diff --git a/scripts/install b/scripts/install index 7c8ae15..9d4f799 100644 --- a/scripts/install +++ b/scripts/install @@ -284,7 +284,8 @@ popd ### that really need such authorization. # Set permissions to app files -chown -R root: $final_path +sudo chown -R www-data:www-data: $final_path +sudo chmod 777 $final_path -R #================================================= # SETUP LOGROTATE From b8cd80c5f101ff8c9307e47cb4d08457ffcf6457 Mon Sep 17 00:00:00 2001 From: Yalh Date: Tue, 15 Jan 2019 02:01:22 +0100 Subject: [PATCH 17/55] Fix Script installation --- scripts/install | 3 +-- 1 file changed, 1 insertion(+), 2 deletions(-) diff --git a/scripts/install b/scripts/install index 9d4f799..a6dac8c 100644 --- a/scripts/install +++ b/scripts/install @@ -70,7 +70,6 @@ ynh_app_setting_set $app path $path_url ynh_app_setting_set $app admin $admin ynh_app_setting_set $app is_public $is_public ynh_app_setting_set $app language $language -ynh_app_setting_set $app password $password ynh_app_setting_set $app admin_email $admin_email ynh_app_setting_set $app website_title $website_title @@ -284,7 +283,7 @@ popd ### that really need such authorization. # Set permissions to app files -sudo chown -R www-data:www-data: $final_path +sudo chown -R www-data: $final_path sudo chmod 777 $final_path -R #================================================= From 3039e7a196834f774b1d692578e4ff292a45db4d Mon Sep 17 00:00:00 2001 From: Yalh Date: Tue, 15 Jan 2019 02:24:59 +0100 Subject: [PATCH 18/55] Add mail send --- scripts/install | 15 +++++++++++++-- 1 file changed, 13 insertions(+), 2 deletions(-) diff --git a/scripts/install b/scripts/install index a6dac8c..c9a6170 100644 --- a/scripts/install +++ b/scripts/install @@ -187,8 +187,8 @@ sudo ./concrete/bin/concrete5 c5:install --db-server=localhost \ --db-database=$db_name \ --db-username=$db_name \ --db-password=$db_pwd \ - --site="'$website_title'" \ - --admin-email="'$admin_email'" \ + --site="$website_title" \ + --admin-email="$admin_email" \ --admin-password=$password \ --language=$language \ --site-locale=$language \ @@ -333,3 +333,14 @@ fi #================================================= systemctl reload nginx + +#================================================= +# SEND A README FOR THE ADMIN +#================================================= + +# WARNING : theses command are used in INSTALL, RESTORE +# For any update do it in all files + +message="To connect to your Concrete Website go to $domain/$path_url with Username: admin" + +ynh_send_readme_to_admin "$message" From 813382e603e08762eee7dc2eef575168a7cdb9a1 Mon Sep 17 00:00:00 2001 From: Yalh Date: Tue, 15 Jan 2019 03:07:29 +0100 Subject: [PATCH 19/55] disable ynh_send_readme_to_admin --- scripts/install | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/scripts/install b/scripts/install index c9a6170..138c331 100644 --- a/scripts/install +++ b/scripts/install @@ -343,4 +343,4 @@ systemctl reload nginx message="To connect to your Concrete Website go to $domain/$path_url with Username: admin" -ynh_send_readme_to_admin "$message" +#ynh_send_readme_to_admin "$message" From c8456e3eda0618257493d6dc6d5f40977ba42e85 Mon Sep 17 00:00:00 2001 From: Yalh Date: Tue, 15 Jan 2019 03:13:05 +0100 Subject: [PATCH 20/55] adding ynh_send_readme_to_admin --- scripts/_common.sh | 57 ++++++++++++++++++++++++++++++++++++++++++++++ scripts/install | 2 +- 2 files changed, 58 insertions(+), 1 deletion(-) diff --git a/scripts/_common.sh b/scripts/_common.sh index bb04a03..7293a4c 100644 --- a/scripts/_common.sh +++ b/scripts/_common.sh @@ -10,4 +10,61 @@ ynh_delete_file_checksum () { local checksum_setting_name=checksum_${1//[\/ ]/_} # Replace all '/' and ' ' by '_' ynh_app_setting_delete $app $checksum_setting_name +} + +# Send an email to inform the administrator +# +# usage: ynh_send_readme_to_admin app_message [recipients] +# | arg: app_message - The message to send to the administrator. +# | arg: recipients - The recipients of this email. Use spaces to separate multiples recipients. - default: root +# example: "root admin@domain" +# If you give the name of a YunoHost user, ynh_send_readme_to_admin will find its email adress for you +# example: "root admin@domain user1 user2" +ynh_send_readme_to_admin() { + local app_message="${1:-...No specific information...}" + local recipients="${2:-root}" + + # Retrieve the email of users + find_mails () { + local list_mails="$1" + local mail + local recipients=" " + # Read each mail in argument + for mail in $list_mails + do + # Keep root or a real email address as it is + if [ "$mail" = "root" ] || echo "$mail" | grep --quiet "@" + then + recipients="$recipients $mail" + else + # But replace an user name without a domain after by its email + if mail=$(ynh_user_get_info "$mail" "mail" 2> /dev/null) + then + recipients="$recipients $mail" + fi + fi + done + echo "$recipients" + } + recipients=$(find_mails "$recipients") + + local mail_subject="☁️🆈🅽🅷☁️: \`$app\` was just installed!" + + local mail_message="This is an automated message from your beloved YunoHost server. +Specific information for the application $app. +$app_message +--- +Automatic diagnosis data from YunoHost +$(yunohost tools diagnosis | grep -B 100 "services:" | sed '/services:/d')" + + # Define binary to use for mail command + if [ -e /usr/bin/bsd-mailx ] + then + local mail_bin=/usr/bin/bsd-mailx + else + local mail_bin=/usr/bin/mail.mailutils + fi + + # Send the email to the recipients + echo "$mail_message" | $mail_bin -a "Content-Type: text/plain; charset=UTF-8" -s "$mail_subject" "$recipients" } \ No newline at end of file diff --git a/scripts/install b/scripts/install index 138c331..c9a6170 100644 --- a/scripts/install +++ b/scripts/install @@ -343,4 +343,4 @@ systemctl reload nginx message="To connect to your Concrete Website go to $domain/$path_url with Username: admin" -#ynh_send_readme_to_admin "$message" +ynh_send_readme_to_admin "$message" From 34755317056a6e7254b5cb6cf8dfe33a51cc96d8 Mon Sep 17 00:00:00 2001 From: Yalh Date: Tue, 15 Jan 2019 03:29:57 +0100 Subject: [PATCH 21/55] update systemd remove --- scripts/remove | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/scripts/remove b/scripts/remove index 04f6bd5..fbdbff4 100644 --- a/scripts/remove +++ b/scripts/remove @@ -28,7 +28,7 @@ final_path=$(ynh_app_setting_get $app final_path) #================================================= # Remove the dedicated systemd config -ynh_remove_systemd_config +#ynh_remove_systemd_config #================================================= # REMOVE SERVICE FROM ADMIN PANEL From dca49f5dfb0d9b1a88bf09ccad911d3afd4bddb5 Mon Sep 17 00:00:00 2001 From: Yalh Date: Tue, 15 Jan 2019 04:02:17 +0100 Subject: [PATCH 22/55] repair mail link --- scripts/install | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/scripts/install b/scripts/install index c9a6170..366e362 100644 --- a/scripts/install +++ b/scripts/install @@ -341,6 +341,6 @@ systemctl reload nginx # WARNING : theses command are used in INSTALL, RESTORE # For any update do it in all files -message="To connect to your Concrete Website go to $domain/$path_url with Username: admin" +message="To connect to your Concrete Website go to https://$domain$path_url with Username: admin" ynh_send_readme_to_admin "$message" From f4dc633af96bd97c9fbf7f8c7ce8d45fae4de471 Mon Sep 17 00:00:00 2001 From: Yalh Date: Tue, 15 Jan 2019 04:21:35 +0100 Subject: [PATCH 23/55] update mail link --- scripts/install | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/scripts/install b/scripts/install index 366e362..c94d60a 100644 --- a/scripts/install +++ b/scripts/install @@ -341,6 +341,6 @@ systemctl reload nginx # WARNING : theses command are used in INSTALL, RESTORE # For any update do it in all files -message="To connect to your Concrete Website go to https://$domain$path_url with Username: admin" +message="To connect to your Concrete Website go to https://$domain$path_url/ with Username: admin" ynh_send_readme_to_admin "$message" From 78e319cb97620415da77d02736f887f85dad958f Mon Sep 17 00:00:00 2001 From: Yalh Date: Tue, 15 Jan 2019 05:06:57 +0100 Subject: [PATCH 24/55] desactivate Cron --- scripts/backup | 2 +- scripts/install | 2 +- scripts/remove | 2 +- scripts/restore | 2 +- scripts/upgrade | 2 +- 5 files changed, 5 insertions(+), 5 deletions(-) diff --git a/scripts/backup b/scripts/backup index c97d44f..228dbf4 100644 --- a/scripts/backup +++ b/scripts/backup @@ -74,4 +74,4 @@ ynh_mysql_dump_db "$db_name" > db.sql # BACKUP A CRON FILE #================================================= -ynh_backup "/etc/cron.d/$app" +#ynh_backup "/etc/cron.d/$app" diff --git a/scripts/install b/scripts/install index c94d60a..a018e30 100644 --- a/scripts/install +++ b/scripts/install @@ -66,7 +66,7 @@ ynh_webpath_register $app $domain $path_url #================================================= ynh_app_setting_set $app domain $domain -ynh_app_setting_set $app path $path_url +ynh_app_setting_set $app path_url $path_url ynh_app_setting_set $app admin $admin ynh_app_setting_set $app is_public $is_public ynh_app_setting_set $app language $language diff --git a/scripts/remove b/scripts/remove index fbdbff4..3f248c5 100644 --- a/scripts/remove +++ b/scripts/remove @@ -100,7 +100,7 @@ ynh_remove_fpm_config #================================================= # Remove a cron file -ynh_secure_remove "/etc/cron.d/$app" +#ynh_secure_remove "/etc/cron.d/$app" # Remove a directory securely ynh_secure_remove "/etc/$app/" diff --git a/scripts/restore b/scripts/restore index 6009143..1135a47 100644 --- a/scripts/restore +++ b/scripts/restore @@ -108,7 +108,7 @@ yunohost service add $app --log "/var/log/$app/APP.log" # RESTORE THE CRON FILE #================================================= -ynh_restore_file "/etc/cron.d/$app" +#ynh_restore_file "/etc/cron.d/$app" #================================================= # RESTORE THE LOGROTATE CONFIGURATION diff --git a/scripts/upgrade b/scripts/upgrade index f08cc39..de94200 100644 --- a/scripts/upgrade +++ b/scripts/upgrade @@ -16,7 +16,7 @@ source /usr/share/yunohost/helpers app=$YNH_APP_INSTANCE_NAME domain=$(ynh_app_setting_get $app domain) -path_url=$(ynh_app_setting_get $app path) +path_url=$(ynh_app_setting_get $app path_url) admin=$(ynh_app_setting_get $app admin) is_public=$(ynh_app_setting_get $app is_public) final_path=$(ynh_app_setting_get $app final_path) From 459b873154d7b708ec960d2e35231bfc92cae48b Mon Sep 17 00:00:00 2001 From: Yalh Date: Tue, 15 Jan 2019 05:46:49 +0100 Subject: [PATCH 25/55] Fix upgrade steps --- scripts/upgrade | 16 +++++++++++++--- 1 file changed, 13 insertions(+), 3 deletions(-) diff --git a/scripts/upgrade b/scripts/upgrade index de94200..67585eb 100644 --- a/scripts/upgrade +++ b/scripts/upgrade @@ -75,7 +75,7 @@ path_url=$(ynh_normalize_url_path $path_url) #================================================= # Download, check integrity, uncompress and patch the source from app.src -ynh_setup_source "$final_path" +#ynh_setup_source "$final_path" #================================================= # NGINX CONFIGURATION @@ -112,9 +112,19 @@ ynh_add_fpm_config ### Verify the checksum of a file, stored by `ynh_store_file_checksum` in the install script. ### And create a backup of this file if the checksum is different. So the file will be backed up if the admin had modified it. -ynh_backup_if_checksum_is_different "$final_path/CONFIG_FILE" +#ynh_backup_if_checksum_is_different "$final_path/CONFIG_FILE" # Recalculate and store the checksum of the file for the next upgrade. -ynh_store_file_checksum "$final_path/CONFIG_FILE" +#ynh_store_file_checksum "$final_path/CONFIG_FILE" + +pushd $final_path +sudo ./concrete/bin/concrete5 c5:config -g set concrete.maintenance_mode true +popd +ynh_setup_source "$final_path" +pushd $final_path +sudo ./concrete/bin/concrete5 c5:update +sudo ./concrete/bin/concrete5 c5:config -g set concrete.maintenance_mode false +popd + #================================================= # SETUP LOGROTATE From c4ac724e89bc6230f4ec62b37b5332cd175e471d Mon Sep 17 00:00:00 2001 From: Yalh Date: Tue, 15 Jan 2019 06:00:42 +0100 Subject: [PATCH 26/55] upgrade to php 7.0 --- conf/nginx.conf | 2 +- conf/php-fpm.conf | 2 +- manifest.json | 2 +- scripts/backup | 2 +- scripts/restore | 4 ++-- 5 files changed, 6 insertions(+), 6 deletions(-) diff --git a/conf/nginx.conf b/conf/nginx.conf index c7536cb..0a4895c 100644 --- a/conf/nginx.conf +++ b/conf/nginx.conf @@ -18,7 +18,7 @@ location __PATH__/ { try_files $uri $uri/ index.php; location ~ [^/]\.php(/|$) { fastcgi_split_path_info ^(.+?\.php)(/.*)$; - fastcgi_pass unix:/var/run/php5-fpm-__NAME__.sock; + fastcgi_pass unix:/var/run/php7.0-fpm-__NAME__.sock; fastcgi_index index.php; include fastcgi_params; diff --git a/conf/php-fpm.conf b/conf/php-fpm.conf index 58ab5e2..f8c4152 100644 --- a/conf/php-fpm.conf +++ b/conf/php-fpm.conf @@ -30,7 +30,7 @@ group = __USER__ ; specific port; ; '/path/to/unix/socket' - to listen on a unix socket. ; Note: This value is mandatory. -listen = /var/run/php5-fpm-__NAMETOCHANGE__.sock +listen = /var/run/php7.0-fpm-__NAMETOCHANGE__.sock ; Set listen(2) backlog. A value of '-1' means unlimited. ; Default Value: 128 (-1 on FreeBSD and OpenBSD) diff --git a/manifest.json b/manifest.json index 30a40ea..5cdee92 100644 --- a/manifest.json +++ b/manifest.json @@ -23,7 +23,7 @@ "multi_instance": true, "services": [ "nginx", - "php5-fpm", + "php7-fpm", "mysql" ], "arguments": { diff --git a/scripts/backup b/scripts/backup index 228dbf4..a565df9 100644 --- a/scripts/backup +++ b/scripts/backup @@ -48,7 +48,7 @@ ynh_backup "/etc/nginx/conf.d/$domain.d/$app.conf" # BACKUP THE PHP-FPM CONFIGURATION #================================================= -ynh_backup "/etc/php5/fpm/pool.d/$app.conf" +ynh_backup "/etc/php/7.0/fpm/pool.d/$app.conf" #================================================= # BACKUP THE MYSQL DATABASE diff --git a/scripts/restore b/scripts/restore index 1135a47..0338cd6 100644 --- a/scripts/restore +++ b/scripts/restore @@ -80,7 +80,7 @@ chown -R root: $final_path # RESTORE THE PHP-FPM CONFIGURATION #================================================= -ynh_restore_file "/etc/php5/fpm/pool.d/$app.conf" +ynh_restore_file "/etc/php/7.0/fpm/pool.d/$app.conf" #================================================= # SPECIFIC RESTORATION @@ -122,5 +122,5 @@ yunohost service add $app --log "/var/log/$app/APP.log" # RELOAD NGINX AND PHP-FPM #================================================= -systemctl reload php5-fpm +systemctl reload php7.0-fpm systemctl reload nginx From 572a54969c664d4bc249203cf3c5f007a940ea21 Mon Sep 17 00:00:00 2001 From: Yalh Date: Tue, 15 Jan 2019 06:04:40 +0100 Subject: [PATCH 27/55] upgrade verbose --- scripts/upgrade | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/scripts/upgrade b/scripts/upgrade index 67585eb..2072fc6 100644 --- a/scripts/upgrade +++ b/scripts/upgrade @@ -121,7 +121,7 @@ sudo ./concrete/bin/concrete5 c5:config -g set concrete.maintenance_mode true popd ynh_setup_source "$final_path" pushd $final_path -sudo ./concrete/bin/concrete5 c5:update +sudo ./concrete/bin/concrete5 c5:update --verbose sudo ./concrete/bin/concrete5 c5:config -g set concrete.maintenance_mode false popd From 33400f8519ba32011f8522c25f294d7a4b0b4771 Mon Sep 17 00:00:00 2001 From: Yalh Date: Tue, 15 Jan 2019 06:11:29 +0100 Subject: [PATCH 28/55] remove php-fpm.ini --- conf/php-fpm.ini | 2 -- 1 file changed, 2 deletions(-) delete mode 100644 conf/php-fpm.ini diff --git a/conf/php-fpm.ini b/conf/php-fpm.ini deleted file mode 100644 index 52f9447..0000000 --- a/conf/php-fpm.ini +++ /dev/null @@ -1,2 +0,0 @@ -upload_max_filesize=16M -post_max_size=16M From 4580ab891c7e8bcd9f3d624d91d663e7bdca5163 Mon Sep 17 00:00:00 2001 From: Yalh Date: Tue, 15 Jan 2019 06:16:33 +0100 Subject: [PATCH 29/55] --allow-as-root --- scripts/upgrade | 6 +++--- 1 file changed, 3 insertions(+), 3 deletions(-) diff --git a/scripts/upgrade b/scripts/upgrade index 2072fc6..0d9ec0d 100644 --- a/scripts/upgrade +++ b/scripts/upgrade @@ -117,12 +117,12 @@ ynh_add_fpm_config #ynh_store_file_checksum "$final_path/CONFIG_FILE" pushd $final_path -sudo ./concrete/bin/concrete5 c5:config -g set concrete.maintenance_mode true +sudo ./concrete/bin/concrete5 c5:config -g set concrete.maintenance_mode true --allow-as-root popd ynh_setup_source "$final_path" pushd $final_path -sudo ./concrete/bin/concrete5 c5:update --verbose -sudo ./concrete/bin/concrete5 c5:config -g set concrete.maintenance_mode false +sudo ./concrete/bin/concrete5 c5:update --verbose --allow-as-root +sudo ./concrete/bin/concrete5 c5:config -g set concrete.maintenance_mode false --allow-as-root popd From 57f80413a092e0850516b76ac0d3350cd551afb7 Mon Sep 17 00:00:00 2001 From: Yalh Date: Tue, 15 Jan 2019 06:20:47 +0100 Subject: [PATCH 30/55] --no-interaction --- scripts/upgrade | 6 +++--- 1 file changed, 3 insertions(+), 3 deletions(-) diff --git a/scripts/upgrade b/scripts/upgrade index 0d9ec0d..8585521 100644 --- a/scripts/upgrade +++ b/scripts/upgrade @@ -117,12 +117,12 @@ ynh_add_fpm_config #ynh_store_file_checksum "$final_path/CONFIG_FILE" pushd $final_path -sudo ./concrete/bin/concrete5 c5:config -g set concrete.maintenance_mode true --allow-as-root +sudo ./concrete/bin/concrete5 c5:config -g set concrete.maintenance_mode true --allow-as-root --no-interaction popd ynh_setup_source "$final_path" pushd $final_path -sudo ./concrete/bin/concrete5 c5:update --verbose --allow-as-root -sudo ./concrete/bin/concrete5 c5:config -g set concrete.maintenance_mode false --allow-as-root +sudo ./concrete/bin/concrete5 c5:update --verbose --no-interaction --allow-as-root +sudo ./concrete/bin/concrete5 c5:config -g set concrete.maintenance_mode false --allow-as-root --no-interaction popd From 333a9f71348b0cbf290b6ae0ac0d3fc931ee4c67 Mon Sep 17 00:00:00 2001 From: Yalh Date: Tue, 15 Jan 2019 06:57:37 +0100 Subject: [PATCH 31/55] add rerun --- conf/nginx.conf | 2 +- conf/php-fpm.conf | 2 +- scripts/upgrade | 2 +- 3 files changed, 3 insertions(+), 3 deletions(-) diff --git a/conf/nginx.conf b/conf/nginx.conf index 0a4895c..f2277ea 100644 --- a/conf/nginx.conf +++ b/conf/nginx.conf @@ -18,7 +18,7 @@ location __PATH__/ { try_files $uri $uri/ index.php; location ~ [^/]\.php(/|$) { fastcgi_split_path_info ^(.+?\.php)(/.*)$; - fastcgi_pass unix:/var/run/php7.0-fpm-__NAME__.sock; + fastcgi_pass unix:/var/run/php/php7.0-fpm-__NAME__.sock; fastcgi_index index.php; include fastcgi_params; diff --git a/conf/php-fpm.conf b/conf/php-fpm.conf index f8c4152..e7b169b 100644 --- a/conf/php-fpm.conf +++ b/conf/php-fpm.conf @@ -30,7 +30,7 @@ group = __USER__ ; specific port; ; '/path/to/unix/socket' - to listen on a unix socket. ; Note: This value is mandatory. -listen = /var/run/php7.0-fpm-__NAMETOCHANGE__.sock +listen = /var/run/php/php7.0-fpm-__NAMETOCHANGE__.sock ; Set listen(2) backlog. A value of '-1' means unlimited. ; Default Value: 128 (-1 on FreeBSD and OpenBSD) diff --git a/scripts/upgrade b/scripts/upgrade index 8585521..2e1618c 100644 --- a/scripts/upgrade +++ b/scripts/upgrade @@ -121,7 +121,7 @@ sudo ./concrete/bin/concrete5 c5:config -g set concrete.maintenance_mode true -- popd ynh_setup_source "$final_path" pushd $final_path -sudo ./concrete/bin/concrete5 c5:update --verbose --no-interaction --allow-as-root +sudo ./concrete/bin/concrete5 c5:update --rerun --verbose --no-interaction --allow-as-root sudo ./concrete/bin/concrete5 c5:config -g set concrete.maintenance_mode false --allow-as-root --no-interaction popd From 81b2a79a5738f8eaa89efcdf4c97d787ffbe0ac6 Mon Sep 17 00:00:00 2001 From: Yalh Date: Tue, 15 Jan 2019 07:14:28 +0100 Subject: [PATCH 32/55] removing no-interraction --- scripts/upgrade | 6 +++--- 1 file changed, 3 insertions(+), 3 deletions(-) diff --git a/scripts/upgrade b/scripts/upgrade index 2e1618c..5b3a4a9 100644 --- a/scripts/upgrade +++ b/scripts/upgrade @@ -117,12 +117,12 @@ ynh_add_fpm_config #ynh_store_file_checksum "$final_path/CONFIG_FILE" pushd $final_path -sudo ./concrete/bin/concrete5 c5:config -g set concrete.maintenance_mode true --allow-as-root --no-interaction +sudo ./concrete/bin/concrete5 c5:config -g set concrete.maintenance_mode true --allow-as-root popd ynh_setup_source "$final_path" pushd $final_path -sudo ./concrete/bin/concrete5 c5:update --rerun --verbose --no-interaction --allow-as-root -sudo ./concrete/bin/concrete5 c5:config -g set concrete.maintenance_mode false --allow-as-root --no-interaction +sudo ./concrete/bin/concrete5 c5:update --rerun --verbose --allow-as-root +sudo ./concrete/bin/concrete5 c5:config -g set concrete.maintenance_mode false --allow-as-root popd From 3c71d46265334810075924c22e51a1556b60f5af Mon Sep 17 00:00:00 2001 From: Yalh Date: Tue, 15 Jan 2019 07:21:10 +0100 Subject: [PATCH 33/55] fix upgrade --- scripts/upgrade | 6 ++++-- 1 file changed, 4 insertions(+), 2 deletions(-) diff --git a/scripts/upgrade b/scripts/upgrade index 5b3a4a9..5527e73 100644 --- a/scripts/upgrade +++ b/scripts/upgrade @@ -117,12 +117,14 @@ ynh_add_fpm_config #ynh_store_file_checksum "$final_path/CONFIG_FILE" pushd $final_path -sudo ./concrete/bin/concrete5 c5:config -g set concrete.maintenance_mode true --allow-as-root +#sudo ./concrete/bin/concrete5 c5:config -g set concrete.maintenance_mode true --allow-as-root popd + ynh_setup_source "$final_path" + pushd $final_path sudo ./concrete/bin/concrete5 c5:update --rerun --verbose --allow-as-root -sudo ./concrete/bin/concrete5 c5:config -g set concrete.maintenance_mode false --allow-as-root +#sudo ./concrete/bin/concrete5 c5:config -g set concrete.maintenance_mode false --allow-as-root popd From 1f228c7a93644b41ce34c81c4a06d01eda0adaf6 Mon Sep 17 00:00:00 2001 From: Yalh Date: Tue, 15 Jan 2019 07:28:43 +0100 Subject: [PATCH 34/55] removing maintenance --- scripts/upgrade | 5 ----- 1 file changed, 5 deletions(-) diff --git a/scripts/upgrade b/scripts/upgrade index 5527e73..c9d4bb0 100644 --- a/scripts/upgrade +++ b/scripts/upgrade @@ -116,15 +116,10 @@ ynh_add_fpm_config # Recalculate and store the checksum of the file for the next upgrade. #ynh_store_file_checksum "$final_path/CONFIG_FILE" -pushd $final_path -#sudo ./concrete/bin/concrete5 c5:config -g set concrete.maintenance_mode true --allow-as-root -popd - ynh_setup_source "$final_path" pushd $final_path sudo ./concrete/bin/concrete5 c5:update --rerun --verbose --allow-as-root -#sudo ./concrete/bin/concrete5 c5:config -g set concrete.maintenance_mode false --allow-as-root popd From a7ca3e9471af8bac27c18739c69f3e66926b3313 Mon Sep 17 00:00:00 2001 From: Yalh Date: Tue, 15 Jan 2019 12:55:25 +0100 Subject: [PATCH 35/55] update restore --- scripts/restore | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/scripts/restore b/scripts/restore index 0338cd6..7d3d5a2 100644 --- a/scripts/restore +++ b/scripts/restore @@ -74,7 +74,7 @@ ynh_system_user_create $app #================================================= # Restore permissions on app files -chown -R root: $final_path +chown -R $app: $final_path #================================================= # RESTORE THE PHP-FPM CONFIGURATION From 14692cec9e8398c7d040b02eee774e35d5240d2e Mon Sep 17 00:00:00 2001 From: yalh76 Date: Tue, 5 Mar 2019 22:18:42 +0100 Subject: [PATCH 36/55] Apply last example_ynh --- manifest.json | 13 +++----- scripts/_common.sh | 15 +++++++-- scripts/backup | 14 ++++++++ scripts/install | 81 +++++++++++++++++++++++++--------------------- scripts/remove | 57 ++++++++++++++++++++------------ scripts/restore | 45 +++++++++++++++++--------- scripts/upgrade | 17 ++++++++++ 7 files changed, 160 insertions(+), 82 deletions(-) diff --git a/manifest.json b/manifest.json index 5cdee92..bd0bbe2 100644 --- a/manifest.json +++ b/manifest.json @@ -2,28 +2,24 @@ "name": "Concrete5", "id": "concrete5", "packaging_format": 1, - "requirements": { - "yunohost": ">=2.6" - }, "description": { "en": "Create a modern Website", "fr": "Créer un site web moderne avec un CMS moderne" }, - "version": "8.4.4", - "license": "MIT", + "version": "8.4.4~ynh1", "url": "www.concrete5.org", - "license": "free", + "license": "MIT", "maintainer": { "name": "frju365", "email": "win10@tutanota.com" }, "requirements": { - "yunohost": ">= 2.7.14" + "yunohost": ">= 3.4" }, "multi_instance": true, "services": [ "nginx", - "php7-fpm", + "php7.0-fpm", "mysql" ], "arguments": { @@ -67,6 +63,7 @@ }, { "name": "language", + "type": "string", "ask": { "en": "Choose the application language", "fr": "Choisissez la langue de l'application" diff --git a/scripts/_common.sh b/scripts/_common.sh index 7293a4c..2e03908 100644 --- a/scripts/_common.sh +++ b/scripts/_common.sh @@ -1,6 +1,9 @@ #!/bin/bash -# ============= FUTURE YUNOHOST HELPER ============= +#================================================= +# PERSONAL HELPERS +#================================================= + # Delete a file checksum from the app settings # # $app should be defined when calling this helper @@ -67,4 +70,12 @@ $(yunohost tools diagnosis | grep -B 100 "services:" | sed '/services:/d')" # Send the email to the recipients echo "$mail_message" | $mail_bin -a "Content-Type: text/plain; charset=UTF-8" -s "$mail_subject" "$recipients" -} \ No newline at end of file +} + +#================================================= +# EXPERIMENTAL HELPERS +#================================================= + +#================================================= +# FUTURE OFFICIAL HELPERS +#================================================= diff --git a/scripts/backup b/scripts/backup index a565df9..9e175ac 100644 --- a/scripts/backup +++ b/scripts/backup @@ -6,6 +6,7 @@ # 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 @@ -23,6 +24,7 @@ ynh_abort_if_errors #================================================= # LOAD SETTINGS #================================================= +ynh_print_info "Loading installation settings..." app=$YNH_APP_INSTANCE_NAME @@ -35,24 +37,28 @@ db_name=$(ynh_app_setting_get $app db_name) #================================================= # BACKUP THE APP MAIN DIR #================================================= +ynh_print_info "Backing up the main app directory..." ynh_backup "$final_path" #================================================= # BACKUP THE NGINX CONFIGURATION #================================================= +ynh_print_info "Backing up nginx web server configuration..." ynh_backup "/etc/nginx/conf.d/$domain.d/$app.conf" #================================================= # BACKUP THE PHP-FPM CONFIGURATION #================================================= +ynh_print_info "Backing up php-fpm configuration..." ynh_backup "/etc/php/7.0/fpm/pool.d/$app.conf" #================================================= # BACKUP THE MYSQL DATABASE #================================================= +ynh_print_info "Backing up the MySQL database..." ynh_mysql_dump_db "$db_name" > db.sql @@ -61,12 +67,14 @@ ynh_mysql_dump_db "$db_name" > db.sql #================================================= # BACKUP LOGROTATE #================================================= +ynh_print_info "Backing up logrotate configuration..." #ynh_backup "/etc/logrotate.d/$app" #================================================= # BACKUP SYSTEMD #================================================= +ynh_print_info "Backing up systemd configuration..." #ynh_backup "/etc/systemd/system/$app.service" @@ -75,3 +83,9 @@ ynh_mysql_dump_db "$db_name" > db.sql #================================================= #ynh_backup "/etc/cron.d/$app" + +#================================================= +# END OF SCRIPT +#================================================= + +ynh_print_info "Backup script completed for $app. (YunoHost will then actually copy those files to the archive)." diff --git a/scripts/install b/scripts/install index a018e30..9631ca6 100644 --- a/scripts/install +++ b/scripts/install @@ -30,8 +30,8 @@ admin=$YNH_APP_ARG_ADMIN is_public=$YNH_APP_ARG_IS_PUBLIC language=$YNH_APP_ARG_LANGUAGE password=$YNH_APP_ARG_PASSWORD -admin_email=$(ynh_user_get_info $admin 'mail') website_title=$YNH_APP_ARG_WEBSITE_TITLE +admin_email=$(ynh_user_get_info $admin 'mail') ### If it's a multi-instance app, meaning it can be installed several times independently @@ -49,6 +49,7 @@ app=$YNH_APP_INSTANCE_NAME #================================================= # CHECK IF THE APP CAN BE INSTALLED WITH THESE ARGS #================================================= +ynh_print_info "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" @@ -64,6 +65,7 @@ ynh_webpath_register $app $domain $path_url #================================================= # STORE SETTINGS FROM MANIFEST #================================================= +ynh_print_info "Storing installation settings..." ynh_app_setting_set $app domain $domain ynh_app_setting_set $app path_url $path_url @@ -78,6 +80,7 @@ ynh_app_setting_set $app website_title $website_title #================================================= # FIND AND OPEN A PORT #================================================= +ynh_print_info "Configuring firewall..." ### Use these lines if you have to open a port for the application ### `ynh_find_port` will find the first available port starting from the given port. @@ -87,12 +90,13 @@ ynh_app_setting_set $app website_title $website_title # Find a free port #port=$(ynh_find_port 8095) # Open this port -#yunohost firewall allow --no-upnp TCP $port 2>&1 +#ynh_exec_warn_less yunohost firewall allow --no-upnp TCP $port #ynh_app_setting_set $app port $port #================================================= # INSTALL DEPENDENCIES #================================================= +ynh_print_info "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. @@ -106,6 +110,7 @@ ynh_app_setting_set $app website_title $website_title #================================================= # CREATE A MYSQL DATABASE #================================================= +ynh_print_info "Creating a MySQL 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. @@ -123,6 +128,7 @@ ynh_mysql_setup_db $db_name $db_name #================================================= # DOWNLOAD, CHECK AND UNPACK SOURCE #================================================= +ynh_print_info "Setting up 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. @@ -135,6 +141,7 @@ ynh_setup_source "$final_path" #================================================= # NGINX CONFIGURATION #================================================= +ynh_print_info "Configuring nginx web server..." ### `ynh_add_nginx_config` will use the file conf/nginx.conf @@ -144,6 +151,7 @@ ynh_add_nginx_config #================================================= # CREATE DEDICATED USER #================================================= +ynh_print_info "Configuring system user..." # Create a system user ynh_system_user_create $app @@ -151,6 +159,7 @@ ynh_system_user_create $app #================================================= # PHP-FPM CONFIGURATION #================================================= +ynh_print_info "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. @@ -168,46 +177,35 @@ ynh_add_fpm_config #================================================= # SPECIFIC SETUP -#================================================= -# ... -#================================================= - - #================================================ -# Installation : Get Composer: +# CONCRETE5 INSTALLATION #================================================= -echo "The installation can take long. So be patient ! :)" +ynh_print_info "Concrete5 Installation, the installation can take long. So be patient ! :)" + pushd $final_path -sudo php -r "copy('https://getcomposer.org/installer', 'composer-setup.php');" -sudo php -r "if (hash_file('sha384', 'composer-setup.php') === '93b54496392c062774670ac18b134c3b3a95e5a5e5c8f1a9f115f203b75bf9a129d5daa8ba6a13e2cc8a1da0806388a8') { echo 'Installer verified'; } else { echo 'Installer corrupt'; unlink('composer-setup.php'); } echo PHP_EOL;" -sudo php composer-setup.php -sudo php -r "unlink('composer-setup.php');" -sudo ./composer.phar install -sudo ./concrete/bin/concrete5 c5:install --db-server=localhost \ - --db-database=$db_name \ - --db-username=$db_name \ - --db-password=$db_pwd \ - --site="$website_title" \ - --admin-email="$admin_email" \ - --admin-password=$password \ - --language=$language \ - --site-locale=$language \ - --verbose \ - --no-interaction \ - --allow-as-root + sudo php -r "copy('https://getcomposer.org/installer', 'composer-setup.php');" + sudo php -r "if (hash_file('sha384', 'composer-setup.php') === '93b54496392c062774670ac18b134c3b3a95e5a5e5c8f1a9f115f203b75bf9a129d5daa8ba6a13e2cc8a1da0806388a8') { echo 'Installer verified'; } else { echo 'Installer corrupt'; unlink('composer-setup.php'); } echo PHP_EOL;" + sudo php composer-setup.php + sudo php -r "unlink('composer-setup.php');" + sudo ./composer.phar install + sudo ./concrete/bin/concrete5 c5:install --db-server=localhost \ + --db-database=$db_name \ + --db-username=$db_name \ + --db-password=$db_pwd \ + --site="$website_title" \ + --admin-email="$admin_email" \ + --admin-password=$password \ + --language=$language \ + --site-locale=$language \ + --verbose \ + --no-interaction \ + --allow-as-root popd -#time zone -#CanonicalURL -#alternative canoncial url -#elemental_blank 0 -#Additional username - - - #================================================= # SETUP SYSTEMD #================================================= +ynh_print_info "Configuring a systemd service..." ### `ynh_systemd_config` is used to configure a systemd script for an app. ### It can be used for apps that use sysvinit (with adaptation) or systemd. @@ -216,7 +214,7 @@ popd ### If you're not using these lines: ### - You can remove those files in conf/. ### - Remove the section "BACKUP SYSTEMD" in the backup script -### - Remove also the section "STOP AND REMOVE SYSTEMD SERVICE" in the remove script +### - Remove also the section "STOP AND REMOVE SERVICE" in the remove script ### - As well as the section "RESTORE SYSTEMD" in the restore script ### - And the section "SETUP SYSTEMD" in the upgrade script @@ -236,6 +234,7 @@ popd #chown -R $app: $final_path # Set the app as temporarily public for curl call +#ynh_print_info "Configuring SSOwat..." #ynh_app_setting_set $app skipped_uris "/" # Reload SSOwat config #yunohost app ssowatconf @@ -244,6 +243,7 @@ popd #systemctl reload nginx # Installation with curl +#ynh_print_info "Finalizing installation..." #ynh_local_curl "/INSTALL_PATH" "key1=value1" "key2=value2" "key3=value3" # Remove the public access @@ -289,6 +289,7 @@ sudo chmod 777 $final_path -R #================================================= # SETUP LOGROTATE #================================================= +ynh_print_info "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. @@ -311,7 +312,7 @@ sudo chmod 777 $final_path -R ### If you're not using these lines: ### - You can remove these files in conf/. ### - Remove the section "REMOVE SERVICE FROM ADMIN PANEL" in the remove script -### - As well as the section ADVERTISE SERVICE IN ADMIN PANEL" in the restore script +### - As well as the section "ADVERTISE SERVICE IN ADMIN PANEL" in the restore script yunohost service add $app --log "/var/log/$app/APP.log" # if using yunohost version 3.2 or more in the 'manifest.json', a description can be added @@ -320,6 +321,7 @@ yunohost service add $app --log "/var/log/$app/APP.log" #================================================= # SETUP SSOWAT #================================================= +ynh_print_info "Configuring SSOwat..." # Make app public if necessary if [ $is_public -eq 1 ] @@ -331,6 +333,7 @@ fi #================================================= # RELOAD NGINX #================================================= +ynh_print_info "Reloading nginx web server..." systemctl reload nginx @@ -344,3 +347,9 @@ systemctl reload nginx message="To connect to your Concrete Website go to https://$domain$path_url/ with Username: admin" ynh_send_readme_to_admin "$message" + +#================================================= +# END OF SCRIPT +#================================================= + +ynh_print_info "Installation of $app completed" diff --git a/scripts/remove b/scripts/remove index 3f248c5..e2cf5ea 100644 --- a/scripts/remove +++ b/scripts/remove @@ -12,6 +12,7 @@ source /usr/share/yunohost/helpers #================================================= # LOAD SETTINGS #================================================= +ynh_print_info "Loading installation settings..." app=$YNH_APP_INSTANCE_NAME @@ -24,40 +25,44 @@ final_path=$(ynh_app_setting_get $app final_path) #================================================= # STANDARD REMOVE #================================================= -# STOP AND REMOVE SYSTEMD SERVICE +# REMOVE SERVICE FROM ADMIN PANEL #================================================= +# Remove a service from the admin panel, added by `yunohost service add` +#if yunohost service status $app >/dev/null 2>&1 +#then +# ynh_print_info "Removing $app service" +# yunohost service remove $app +#fi + +#================================================= +# STOP AND REMOVE SERVICE +#================================================= +ynh_print_info "Stopping and removing the systemd service" + # Remove the dedicated systemd config #ynh_remove_systemd_config -#================================================= -# REMOVE SERVICE FROM ADMIN PANEL -#================================================= - -# Remove a service from the admin panel, added by `yunohost service add` -#if yunohost service status | grep -q $app -#then -# echo "Remove $app service" -# yunohost service remove $app -#fi - -#================================================= -# REMOVE DEPENDENCIES -#================================================= - -# Remove metapackage and its dependencies -#ynh_remove_app_dependencies - #================================================= # REMOVE THE MYSQL DATABASE #================================================= +ynh_print_info "Removing the MySQL database" # Remove a database if it exists, along with the associated user ynh_mysql_remove_db $db_user $db_name +#================================================= +# REMOVE DEPENDENCIES +#================================================= +ynh_print_info "Removing dependencies" + +# Remove metapackage and its dependencies +#ynh_remove_app_dependencies + #================================================= # REMOVE APP MAIN DIR #================================================= +ynh_print_info "Removing app main directory" # Remove the app directory securely ynh_secure_remove "$final_path" @@ -65,6 +70,7 @@ ynh_secure_remove "$final_path" #================================================= # REMOVE NGINX CONFIGURATION #================================================= +ynh_print_info "Removing nginx web server configuration" # Remove the dedicated nginx config ynh_remove_nginx_config @@ -72,6 +78,7 @@ ynh_remove_nginx_config #================================================= # REMOVE PHP-FPM CONFIGURATION #================================================= +ynh_print_info "Removing php-fpm configuration" # Remove the dedicated php-fpm config ynh_remove_fpm_config @@ -79,6 +86,7 @@ ynh_remove_fpm_config #================================================= # REMOVE LOGROTATE CONFIGURATION #================================================= +ynh_print_info "Removing logrotate configuration" # Remove the app-specific logrotate config #ynh_remove_logrotate @@ -89,8 +97,8 @@ ynh_remove_fpm_config #if yunohost firewall list | grep -q "\- $port$" #then -# echo "Close port $port" >&2 -# yunohost firewall disallow TCP $port 2>&1 +# ynh_print_info "Closing port $port" +# ynh_exec_warn_less yunohost firewall disallow TCP $port #fi #================================================= @@ -113,6 +121,13 @@ ynh_secure_remove "/var/log/$app/" #================================================= # REMOVE DEDICATED USER #================================================= +ynh_print_info "Removing the dedicated system user" # Delete a system user ynh_system_user_delete $app + +#================================================= +# END OF SCRIPT +#================================================= + +ynh_print_info "Removal of $app completed" diff --git a/scripts/restore b/scripts/restore index 7d3d5a2..d46fbae 100644 --- a/scripts/restore +++ b/scripts/restore @@ -6,6 +6,7 @@ # 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 @@ -23,6 +24,7 @@ ynh_abort_if_errors #================================================= # LOAD SETTINGS #================================================= +ynh_print_info "Loading settings..." app=$YNH_APP_INSTANCE_NAME @@ -34,6 +36,7 @@ db_name=$(ynh_app_setting_get $app db_name) #================================================= # CHECK IF THE APP CAN BE RESTORED #================================================= +ynh_print_info "Validating restoration parameters..." ynh_webpath_available $domain $path_url \ || ynh_die "Path not available: ${domain}${path_url}" @@ -51,20 +54,14 @@ ynh_restore_file "/etc/nginx/conf.d/$domain.d/$app.conf" #================================================= # RESTORE THE APP MAIN DIR #================================================= +ynh_print_info "Restoring the app main directory..." ynh_restore_file "$final_path" -#================================================= -# RESTORE THE MYSQL DATABASE -#================================================= - -db_pwd=$(ynh_app_setting_get $app mysqlpwd) -ynh_mysql_setup_db $db_name $db_name $db_pwd -ynh_mysql_connect_as $db_name $db_pwd $db_name < ./db.sql - #================================================= # RECREATE THE DEDICATED USER #================================================= +ynh_print_info "Recreating the dedicated system user..." # Create the dedicated user (if not existing) ynh_system_user_create $app @@ -87,23 +84,34 @@ ynh_restore_file "/etc/php/7.0/fpm/pool.d/$app.conf" #================================================= # REINSTALL DEPENDENCIES #================================================= +ynh_print_info "Reinstalling dependencies..." # Define and install dependencies #ynh_install_app_dependencies deb1 deb2 +#================================================= +# RESTORE THE MYSQL DATABASE +#================================================= +ynh_print_info "Restoring the MySQL database..." + +db_pwd=$(ynh_app_setting_get $app mysqlpwd) +ynh_mysql_setup_db $db_name $db_name $db_pwd +ynh_mysql_connect_as $db_name $db_pwd $db_name < ./db.sql + +#================================================= +# RESTORE SYSTEMD +#================================================= +ynh_print_info "Restoring the systemd configuration..." + +#ynh_restore_file "/etc/systemd/system/$app.service" +#systemctl enable $app.service + #================================================= # ADVERTISE SERVICE IN ADMIN PANEL #================================================= yunohost service add $app --log "/var/log/$app/APP.log" -#================================================= -# RESTORE SYSTEMD -#================================================= - -#ynh_restore_file "/etc/systemd/system/$app.service" -#systemctl enable $app.service - #================================================= # RESTORE THE CRON FILE #================================================= @@ -121,6 +129,13 @@ yunohost service add $app --log "/var/log/$app/APP.log" #================================================= # RELOAD NGINX AND PHP-FPM #================================================= +ynh_print_info "Reloading nginx web server and php-fpm..." systemctl reload php7.0-fpm systemctl reload nginx + +#================================================= +# END OF SCRIPT +#================================================= + +ynh_print_info "Restoration completed for $app" diff --git a/scripts/upgrade b/scripts/upgrade index c9d4bb0..74f70e5 100644 --- a/scripts/upgrade +++ b/scripts/upgrade @@ -12,6 +12,7 @@ source /usr/share/yunohost/helpers #================================================= # LOAD SETTINGS #================================================= +ynh_print_info "Loading installation settings..." app=$YNH_APP_INSTANCE_NAME @@ -26,6 +27,7 @@ db_name=$(ynh_app_setting_get $app db_name) #================================================= # ENSURE DOWNWARD COMPATIBILITY #================================================= +ynh_print_info "Ensuring downward compatibility..." # Fix is_public as a boolean value if [ "$is_public" = "Yes" ]; then @@ -51,6 +53,7 @@ fi #================================================= # BACKUP BEFORE UPGRADE THEN ACTIVE TRAP #================================================= +ynh_print_info "Backing up the app before upgrading (may take a while)..." # Backup the current version of the app ynh_backup_before_upgrade @@ -73,6 +76,7 @@ path_url=$(ynh_normalize_url_path $path_url) #================================================= # DOWNLOAD, CHECK AND UNPACK SOURCE #================================================= +ynh_print_info "Upgrading source files..." # Download, check integrity, uncompress and patch the source from app.src #ynh_setup_source "$final_path" @@ -80,6 +84,7 @@ path_url=$(ynh_normalize_url_path $path_url) #================================================= # NGINX CONFIGURATION #================================================= +ynh_print_info "Upgrading nginx web server configuration..." # Create a dedicated nginx config ynh_add_nginx_config @@ -93,6 +98,7 @@ ynh_add_nginx_config #================================================= # CREATE DEDICATED USER #================================================= +ynh_print_info "Making sure dedicated system user exists..." # Create a dedicated user (if not existing) ynh_system_user_create $app @@ -100,6 +106,7 @@ ynh_system_user_create $app #================================================= # PHP-FPM CONFIGURATION #================================================= +ynh_print_info "Upgrading php-fpm configuration..." # Create a dedicated php-fpm config ynh_add_fpm_config @@ -126,6 +133,7 @@ popd #================================================= # SETUP LOGROTATE #================================================= +ynh_print_info "Upgrading logrotate configuration..." # Use logrotate to manage app-specific logfile(s) #ynh_use_logrotate --non-append @@ -133,6 +141,7 @@ popd #================================================= # SETUP SYSTEMD #================================================= +ynh_print_info "Upgrading systemd configuration..." # Create a dedicated systemd config #ynh_add_systemd_config @@ -149,6 +158,7 @@ chown -R root: $final_path #================================================= # SETUP SSOWAT #================================================= +ynh_print_info "Upgrading SSOwat configuration..." # Make app public if necessary if [ $is_public -eq 1 ] @@ -160,5 +170,12 @@ fi #================================================= # RELOAD NGINX #================================================= +ynh_print_info "Reloading nginx web server..." systemctl reload nginx + +#================================================= +# END OF SCRIPT +#================================================= + +ynh_print_info "Upgrade of $app completed" From 8bba8c88e88b475431dad2f6bed85a38e45f64f1 Mon Sep 17 00:00:00 2001 From: yalh76 Date: Tue, 5 Mar 2019 22:22:50 +0100 Subject: [PATCH 37/55] add read will installing --- scripts/install | 1 + 1 file changed, 1 insertion(+) diff --git a/scripts/install b/scripts/install index 9631ca6..9cecdfc 100644 --- a/scripts/install +++ b/scripts/install @@ -15,6 +15,7 @@ source /usr/share/yunohost/helpers ynh_clean_setup () { ### Remove this function if there's nothing to clean before calling the remove script. + read -p "Press any key..." true } # Exit if an error occurs during the execution of the script From 1e7d5db3e2ab08cdb7e4f70e0d51fb6bb92a871c Mon Sep 17 00:00:00 2001 From: yalh76 Date: Tue, 5 Mar 2019 22:28:30 +0100 Subject: [PATCH 38/55] Remove composer_setup hash check --- scripts/install | 1 - 1 file changed, 1 deletion(-) diff --git a/scripts/install b/scripts/install index 9cecdfc..a8c9872 100644 --- a/scripts/install +++ b/scripts/install @@ -185,7 +185,6 @@ ynh_print_info "Concrete5 Installation, the installation can take long. So be pa pushd $final_path sudo php -r "copy('https://getcomposer.org/installer', 'composer-setup.php');" - sudo php -r "if (hash_file('sha384', 'composer-setup.php') === '93b54496392c062774670ac18b134c3b3a95e5a5e5c8f1a9f115f203b75bf9a129d5daa8ba6a13e2cc8a1da0806388a8') { echo 'Installer verified'; } else { echo 'Installer corrupt'; unlink('composer-setup.php'); } echo PHP_EOL;" sudo php composer-setup.php sudo php -r "unlink('composer-setup.php');" sudo ./composer.phar install From 8d5469910bde41ffcc26a24424d5706283de584a Mon Sep 17 00:00:00 2001 From: yalh76 Date: Tue, 5 Mar 2019 23:03:27 +0100 Subject: [PATCH 39/55] remove ADMIN PANEL --- scripts/install | 3 +-- scripts/restore | 2 +- 2 files changed, 2 insertions(+), 3 deletions(-) diff --git a/scripts/install b/scripts/install index a8c9872..7161bb1 100644 --- a/scripts/install +++ b/scripts/install @@ -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. - read -p "Press any key..." true } # Exit if an error occurs during the execution of the script @@ -314,7 +313,7 @@ ynh_print_info "Configuring log rotation..." ### - Remove the section "REMOVE SERVICE FROM ADMIN PANEL" in the remove script ### - As well as the section "ADVERTISE SERVICE IN ADMIN PANEL" in the restore script -yunohost service add $app --log "/var/log/$app/APP.log" +#yunohost service add $app --log "/var/log/$app/APP.log" # if using yunohost version 3.2 or more in the 'manifest.json', a description can be added #yunohost service add $app --description "$app daemon for XXX" --log "/var/log/$app/APP.log" diff --git a/scripts/restore b/scripts/restore index d46fbae..ff21cd6 100644 --- a/scripts/restore +++ b/scripts/restore @@ -110,7 +110,7 @@ ynh_print_info "Restoring the systemd configuration..." # ADVERTISE SERVICE IN ADMIN PANEL #================================================= -yunohost service add $app --log "/var/log/$app/APP.log" +#yunohost service add $app --log "/var/log/$app/APP.log" #================================================= # RESTORE THE CRON FILE From d055e62e3c4e5137126b4d9423304f21488fab63 Mon Sep 17 00:00:00 2001 From: yalh76 Date: Tue, 5 Mar 2019 23:53:43 +0100 Subject: [PATCH 40/55] Update to 8.4.5 --- README.md | 34 +++++++++++++--------------------- check_process | 2 +- conf/app.src | 4 ++-- manifest.json | 2 +- scripts/change_url | 9 +++++++++ scripts/install | 2 +- 6 files changed, 27 insertions(+), 26 deletions(-) diff --git a/README.md b/README.md index 1f212a5..6fb1bae 100644 --- a/README.md +++ b/README.md @@ -1,8 +1,9 @@ # concrete5_ynh -[![Integration level](https://dash.yunohost.org/integration/concrete5.svg)](https://ci-apps.yunohost.org/jenkins/job/concrete5%20%28Community%29/lastBuild/consoleFull) -[![Install concrete5 with YunoHost](https://install-app.yunohost.org/install-with-yunohost.png)](https://install-app.yunohost.org/?app=concrete5) -> *This package allow you to install concrete5 quickly and simply on a YunoHost server. +[![Integration level](https://dash.yunohost.org/integration/REPLACEBYYOURAPP.svg)](https://dash.yunohost.org/appci/app/REPLACEBYYOURAPP) +[![Install REPLACEBYYOURAPP with YunoHost](https://install-app.yunohost.org/install-with-yunohost.png)](https://install-app.yunohost.org/?app=REPLACEBYYOURAPP) + +> *This package allow you to install REPLACEBYYOURAPP 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.* ## Overview @@ -16,16 +17,7 @@ Features : * Marketing tools * **and more**... -## Etat : NOT WORKING - -Site officiel : https://www.concrete5.org/ - -**Shipped version:** 8.4.4 - - -## Licence - -LICENSE MIT +**Shipped version:** 8.4.5 ## Screenshots @@ -53,9 +45,9 @@ Can the app be used by multiple users? #### Supported architectures -* x86-64b - [![Build Status](https://ci-apps.yunohost.org/jenkins/job/concrete5%20(Community)/badge/icon)](https://ci-apps.yunohost.org/jenkins/job/concrete5%20(Community)/) -* ARMv8-A - [![Build Status](https://ci-apps-arm.yunohost.org/jenkins/job/concrete5%20(Community)%20(%7EARM%7E)/badge/icon)](https://ci-apps-arm.yunohost.org/jenkins/job/concrete5%20(Community)%20(%7EARM%7E)/) -* Jessie x86-64b - [![Build Status](https://ci-stretch.nohost.me/jenkins/job/concrete5%20(Community)/badge/icon)](https://ci-stretch.nohost.me/jenkins/job/concrete5%20(Community)/) +* x86-64b - [![Build Status](https://ci-apps.yunohost.org/ci/logs/REPLACEBYYOURAPP%20%28Community%29.svg)](https://ci-apps.yunohost.org/ci/apps/REPLACEBYYOURAPP/) +* ARMv8-A - [![Build Status](https://ci-apps-arm.yunohost.org/ci/logs/REPLACEBYYOURAPP%20%28Community%29.svg)](https://ci-apps-arm.yunohost.org/ci/apps/REPLACEBYYOURAPP/) +* Jessie x86-64b - [![Build Status](https://ci-stretch.nohost.me/ci/logs/REPLACEBYYOURAPP%20%28Community%29.svg)](https://ci-stretch.nohost.me/ci/apps/REPLACEBYYOURAPP/) ## Limitations @@ -70,8 +62,9 @@ https://yunohost.org/packaging_apps ## Links - * Report a bug: https://github.com/YunoHost-Apps/concrete5_ynh/issues + * Report a bug: https://github.com/YunoHost-Apps/REPLACEBYYOURAPP_ynh/issues * App website: https://www.concrete5.org/ + * GitHub App website: https://github.com/concrete5/concrete5 * YunoHost website: https://yunohost.org/ --- @@ -80,12 +73,11 @@ Developers info ---------------- **Only if you want to use a testing branch for coding, instead of merging directly into master.** -Please do your pull request to the [testing branch](https://github.com/YunoHost-Apps/concrete5_ynh/tree/testing). +Please do your pull request to the [testing branch](https://github.com/YunoHost-Apps/REPLACEBYYOURAPP_ynh/tree/testing). To try the testing branch, please proceed like that. ``` -sudo yunohost app install https://github.com/YunoHost-Apps/concrete5_ynh/tree/testing --debug +sudo yunohost app install https://github.com/YunoHost-Apps/REPLACEBYYOURAPP_ynh/tree/testing --debug or -sudo yunohost app upgrade concrete5 -u https://github.com/YunoHost-Apps/concrete5_ynh/tree/testing --debug +sudo yunohost app upgrade REPLACEBYYOURAPP -u https://github.com/YunoHost-Apps/REPLACEBYYOURAPP_ynh/tree/testing --debug ``` - diff --git a/check_process b/check_process index 83a4573..cf1c349 100644 --- a/check_process +++ b/check_process @@ -25,7 +25,7 @@ multi_instance=1 incorrect_path=1 port_already_use=0 - change_url=0 + change_url=1 ;;; Levels Level 1=auto Level 2=auto diff --git a/conf/app.src b/conf/app.src index c9b7390..924e56a 100644 --- a/conf/app.src +++ b/conf/app.src @@ -1,5 +1,5 @@ -SOURCE_URL=https://codeload.github.com/concrete5/concrete5/tar.gz/8.4.4 -SOURCE_SUM=7c862e4d3b2aed854fd86ee1a5d94222dd72f555d56828111db603005c1d1b6f +SOURCE_URL=https://github.com/concrete5/concrete5/archive/8.4.5.tar.gz +SOURCE_SUM=a8708e6d55dba3bcf6aeb2a377eaa851650cb8634343c7ce4e88045fd58d565e SOURCE_SUM_PRG=sha256sum SOURCE_FORMAT=tar.gz SOURCE_IN_SUBDIR=true diff --git a/manifest.json b/manifest.json index bd0bbe2..4844694 100644 --- a/manifest.json +++ b/manifest.json @@ -6,7 +6,7 @@ "en": "Create a modern Website", "fr": "Créer un site web moderne avec un CMS moderne" }, - "version": "8.4.4~ynh1", + "version": "8.4.5~ynh1", "url": "www.concrete5.org", "license": "MIT", "maintainer": { diff --git a/scripts/change_url b/scripts/change_url index f71fc77..93a67da 100644 --- a/scripts/change_url +++ b/scripts/change_url @@ -24,6 +24,7 @@ app=$YNH_APP_INSTANCE_NAME #================================================= # LOAD SETTINGS #================================================= +ynh_print_info "Loading installation settings..." # Needed for helper "ynh_add_nginx_config" final_path=$(ynh_app_setting_get $app final_path) @@ -62,6 +63,7 @@ fi #================================================= # MODIFY URL IN NGINX CONF #================================================= +ynh_print_info "Updating nginx web server configuration..." nginx_conf_path=/etc/nginx/conf.d/$old_domain.d/$app.conf @@ -98,5 +100,12 @@ fi #================================================= # RELOAD NGINX #================================================= +ynh_print_info "Reloading nginx web server..." systemctl reload nginx + +#================================================= +# END OF SCRIPT +#================================================= + +ynh_print_info "Change of URL completed for $app" diff --git a/scripts/install b/scripts/install index 7161bb1..77a5d34 100644 --- a/scripts/install +++ b/scripts/install @@ -68,7 +68,7 @@ ynh_webpath_register $app $domain $path_url ynh_print_info "Storing installation settings..." ynh_app_setting_set $app domain $domain -ynh_app_setting_set $app path_url $path_url +ynh_app_setting_set $app path $path_url ynh_app_setting_set $app admin $admin ynh_app_setting_set $app is_public $is_public ynh_app_setting_set $app language $language From ab5e4bd604e669ec13fc2ab0383cb48c75cb7ffc Mon Sep 17 00:00:00 2001 From: yalh76 Date: Tue, 5 Mar 2019 23:58:25 +0100 Subject: [PATCH 41/55] Fix REPLACEBYYOURAPP --- README.md | 20 ++++++++++---------- 1 file changed, 10 insertions(+), 10 deletions(-) diff --git a/README.md b/README.md index 6fb1bae..a19ab7c 100644 --- a/README.md +++ b/README.md @@ -1,9 +1,9 @@ # concrete5_ynh -[![Integration level](https://dash.yunohost.org/integration/REPLACEBYYOURAPP.svg)](https://dash.yunohost.org/appci/app/REPLACEBYYOURAPP) -[![Install REPLACEBYYOURAPP with YunoHost](https://install-app.yunohost.org/install-with-yunohost.png)](https://install-app.yunohost.org/?app=REPLACEBYYOURAPP) +[![Integration level](https://dash.yunohost.org/integration/concrete5.svg)](https://dash.yunohost.org/appci/app/concrete5) +[![Install concrete5 with YunoHost](https://install-app.yunohost.org/install-with-yunohost.png)](https://install-app.yunohost.org/?app=concrete5) -> *This package allow you to install REPLACEBYYOURAPP quickly and simply on a YunoHost server. +> *This package allow you to install concrete5 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.* ## Overview @@ -45,9 +45,9 @@ Can the app be used by multiple users? #### Supported architectures -* x86-64b - [![Build Status](https://ci-apps.yunohost.org/ci/logs/REPLACEBYYOURAPP%20%28Community%29.svg)](https://ci-apps.yunohost.org/ci/apps/REPLACEBYYOURAPP/) -* ARMv8-A - [![Build Status](https://ci-apps-arm.yunohost.org/ci/logs/REPLACEBYYOURAPP%20%28Community%29.svg)](https://ci-apps-arm.yunohost.org/ci/apps/REPLACEBYYOURAPP/) -* Jessie x86-64b - [![Build Status](https://ci-stretch.nohost.me/ci/logs/REPLACEBYYOURAPP%20%28Community%29.svg)](https://ci-stretch.nohost.me/ci/apps/REPLACEBYYOURAPP/) +* x86-64b - [![Build Status](https://ci-apps.yunohost.org/ci/logs/concrete5%20%28Community%29.svg)](https://ci-apps.yunohost.org/ci/apps/concrete5/) +* ARMv8-A - [![Build Status](https://ci-apps-arm.yunohost.org/ci/logs/concrete5%20%28Community%29.svg)](https://ci-apps-arm.yunohost.org/ci/apps/concrete5/) +* Jessie x86-64b - [![Build Status](https://ci-stretch.nohost.me/ci/logs/concrete5%20%28Community%29.svg)](https://ci-stretch.nohost.me/ci/apps/concrete5/) ## Limitations @@ -62,7 +62,7 @@ https://yunohost.org/packaging_apps ## Links - * Report a bug: https://github.com/YunoHost-Apps/REPLACEBYYOURAPP_ynh/issues + * Report a bug: https://github.com/YunoHost-Apps/concrete5_ynh/issues * App website: https://www.concrete5.org/ * GitHub App website: https://github.com/concrete5/concrete5 * YunoHost website: https://yunohost.org/ @@ -73,11 +73,11 @@ Developers info ---------------- **Only if you want to use a testing branch for coding, instead of merging directly into master.** -Please do your pull request to the [testing branch](https://github.com/YunoHost-Apps/REPLACEBYYOURAPP_ynh/tree/testing). +Please do your pull request to the [testing branch](https://github.com/YunoHost-Apps/concrete5_ynh/tree/testing). To try the testing branch, please proceed like that. ``` -sudo yunohost app install https://github.com/YunoHost-Apps/REPLACEBYYOURAPP_ynh/tree/testing --debug +sudo yunohost app install https://github.com/YunoHost-Apps/concrete5_ynh/tree/testing --debug or -sudo yunohost app upgrade REPLACEBYYOURAPP -u https://github.com/YunoHost-Apps/REPLACEBYYOURAPP_ynh/tree/testing --debug +sudo yunohost app upgrade concrete5 -u https://github.com/YunoHost-Apps/concrete5_ynh/tree/testing --debug ``` From 780c59436cead99eeeba65369552a02c009c972f Mon Sep 17 00:00:00 2001 From: yalh76 Date: Wed, 6 Mar 2019 00:31:20 +0100 Subject: [PATCH 42/55] Fix README.md --- README.md | 29 ++--------------------------- 1 file changed, 2 insertions(+), 27 deletions(-) diff --git a/README.md b/README.md index a19ab7c..e8c42fb 100644 --- a/README.md +++ b/README.md @@ -19,29 +19,15 @@ Features : **Shipped version:** 8.4.5 -## Screenshots - -![](Link to an screenshot for this app) - -## Demo - -* [Official demo](Link to a demo site for this app) - -## Configuration - -How to configure this app: by an admin panel, a plain file with SSH, or any other way. - ## Documentation - * Official documentation: Link to the official documentation of this app - * YunoHost documentation: If specific documentation is needed, feel free to contribute. + * Official documentation: https://documentation.concrete5.org/ ## YunoHost specific features #### Multi-users support -Are LDAP and HTTP auth supported? -Can the app be used by multiple users? +LDAP and HTTP auth are not supported? #### Supported architectures @@ -49,17 +35,6 @@ Can the app be used by multiple users? * ARMv8-A - [![Build Status](https://ci-apps-arm.yunohost.org/ci/logs/concrete5%20%28Community%29.svg)](https://ci-apps-arm.yunohost.org/ci/apps/concrete5/) * Jessie x86-64b - [![Build Status](https://ci-stretch.nohost.me/ci/logs/concrete5%20%28Community%29.svg)](https://ci-stretch.nohost.me/ci/apps/concrete5/) -## Limitations - -* Any known limitations. - -## Additional information - -* Other information you would add about this application - -**More information on the documentation page:** -https://yunohost.org/packaging_apps - ## Links * Report a bug: https://github.com/YunoHost-Apps/concrete5_ynh/issues From a3351b9aaa8be308b6313d93662ed78ade2377a0 Mon Sep 17 00:00:00 2001 From: yalh76 Date: Wed, 6 Mar 2019 00:32:05 +0100 Subject: [PATCH 43/55] cleanup --- README.md | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/README.md b/README.md index e8c42fb..e9c5342 100644 --- a/README.md +++ b/README.md @@ -27,7 +27,7 @@ Features : #### Multi-users support -LDAP and HTTP auth are not supported? +LDAP and HTTP auth are not supported #### Supported architectures From 5ec918eb202a14c9e7c5c871e6ea67afd9e526bc Mon Sep 17 00:00:00 2001 From: yalh76 Date: Wed, 6 Mar 2019 01:56:15 +0100 Subject: [PATCH 44/55] Fix upgrade --- manifest.json | 2 +- scripts/upgrade | 18 ++++++++---------- 2 files changed, 9 insertions(+), 11 deletions(-) diff --git a/manifest.json b/manifest.json index 4844694..c18b9d2 100644 --- a/manifest.json +++ b/manifest.json @@ -86,7 +86,7 @@ }, { "name": "website_title", - "type": "title", + "type": "string", "ask": { "en": "Your website's title.", "fr": "Le titre de votre site." diff --git a/scripts/upgrade b/scripts/upgrade index 74f70e5..28272ec 100644 --- a/scripts/upgrade +++ b/scripts/upgrade @@ -17,7 +17,7 @@ ynh_print_info "Loading installation settings..." app=$YNH_APP_INSTANCE_NAME domain=$(ynh_app_setting_get $app domain) -path_url=$(ynh_app_setting_get $app path_url) +path_url=$(ynh_app_setting_get $app path) admin=$(ynh_app_setting_get $app admin) is_public=$(ynh_app_setting_get $app is_public) final_path=$(ynh_app_setting_get $app final_path) @@ -79,7 +79,7 @@ path_url=$(ynh_normalize_url_path $path_url) ynh_print_info "Upgrading source files..." # Download, check integrity, uncompress and patch the source from app.src -#ynh_setup_source "$final_path" +ynh_setup_source "$final_path" #================================================= # NGINX CONFIGURATION @@ -92,6 +92,7 @@ ynh_add_nginx_config #================================================= # UPGRADE DEPENDENCIES #================================================= +ynh_print_info "Upgrading dependencies..." #ynh_install_app_dependencies deb1 deb2 @@ -114,22 +115,19 @@ ynh_add_fpm_config #================================================= # SPECIFIC UPGRADE #================================================= -# ... +# UPGRADE CONCRETE #================================================= +pushd $final_path + sudo ./concrete/bin/concrete5 c5:update --rerun --verbose --allow-as-root +popd + ### Verify the checksum of a file, stored by `ynh_store_file_checksum` in the install script. ### And create a backup of this file if the checksum is different. So the file will be backed up if the admin had modified it. #ynh_backup_if_checksum_is_different "$final_path/CONFIG_FILE" # Recalculate and store the checksum of the file for the next upgrade. #ynh_store_file_checksum "$final_path/CONFIG_FILE" -ynh_setup_source "$final_path" - -pushd $final_path -sudo ./concrete/bin/concrete5 c5:update --rerun --verbose --allow-as-root -popd - - #================================================= # SETUP LOGROTATE #================================================= From d5b1ddeb144abf8c2a4f433d75b22d21812695dd Mon Sep 17 00:00:00 2001 From: yalh76 Date: Fri, 22 Mar 2019 11:07:18 +0100 Subject: [PATCH 45/55] Update php-fpm.conf --- conf/php-fpm.conf | 57 ++++++++++++++++++++++++++++++++++------------- 1 file changed, 42 insertions(+), 15 deletions(-) diff --git a/conf/php-fpm.conf b/conf/php-fpm.conf index e7b169b..6ed1a8c 100644 --- a/conf/php-fpm.conf +++ b/conf/php-fpm.conf @@ -1,10 +1,11 @@ ; Start a new pool named 'www'. -; the variable $pool can we used in any directive and will be replaced by the +; the variable $pool can be used in any directive and will be replaced by the ; pool name ('www' here) [__NAMETOCHANGE__] ; Per pool prefix ; It only applies on the following directives: +; - 'access.log' ; - 'slowlog' ; - 'listen' (unixsocket) ; - 'chroot' @@ -24,17 +25,19 @@ group = __USER__ ; The address on which to accept FastCGI requests. ; Valid syntaxes are: -; 'ip.add.re.ss:port' - to listen on a TCP socket to a specific address on +; 'ip.add.re.ss:port' - to listen on a TCP socket to a specific IPv4 address on ; a specific port; -; 'port' - to listen on a TCP socket to all addresses on a -; specific port; +; '[ip:6:addr:ess]:port' - to listen on a TCP socket to a specific IPv6 address on +; a specific port; +; 'port' - to listen on a TCP socket to all addresses +; (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 -; Set listen(2) backlog. A value of '-1' means unlimited. -; Default Value: 128 (-1 on FreeBSD and OpenBSD) -;listen.backlog = 128 +; Set listen(2) backlog. +; Default Value: 511 (-1 on FreeBSD and OpenBSD) +;listen.backlog = 511 ; Set permissions for unix socket, if one is used. In Linux, read/write ; permissions must be set in order to allow connections from a web server. Many @@ -44,8 +47,13 @@ listen = /var/run/php/php7.0-fpm-__NAMETOCHANGE__.sock listen.owner = www-data listen.group = www-data ;listen.mode = 0660 +; When POSIX Access Control Lists are supported you can set them using +; these options, value is a comma separated list of user/group names. +; When set, listen.owner and listen.group are ignored +;listen.acl_users = +;listen.acl_groups = -; List of ipv4 addresses of FastCGI clients which are allowed to connect. +; List of addresses (IPv4/IPv6) of FastCGI clients which are allowed to connect. ; Equivalent to the FCGI_WEB_SERVER_ADDRS environment variable in the original ; PHP FCGI (5.2.2+). Makes sense only with a tcp listening socket. Each address ; must be separated by a comma. If this value is left blank, connections will be @@ -59,7 +67,13 @@ listen.group = www-data ; - The pool processes will inherit the master process priority ; unless it specified otherwise ; Default Value: no set -; priority = -19 +; process.priority = -19 + +; Set the process dumpable flag (PR_SET_DUMPABLE prctl) even if the process user +; or group is differrent than the master process user. It allows to create process +; core dump and ptrace the process for the pool user. +; Default Value: no +; process.dumpable = yes ; Choose how the process manager will control the number of child processes. ; Possible Values: @@ -215,7 +229,7 @@ pm.max_requests = 500 ; last request memory: 0 ; ; Note: There is a real-time FPM status monitoring sample web page available -; It's available in: ${prefix}/share/fpm/status.html +; It's available in: /usr/share/php/7.0/fpm/status.html ; ; Note: The value must start with a leading slash (/). The value can be ; anything, but it may not be a good idea to use the .php extension or it @@ -275,7 +289,7 @@ pm.max_requests = 500 ; - %{megabytes}M ; - %{mega}M ; %n: pool name -; %o: ouput header +; %o: output header ; it must be associated with embraces to specify the name of the header: ; - %{Content-Type}o ; - %{X-Powered-By}o @@ -291,9 +305,13 @@ pm.max_requests = 500 ; %t: server time the request was received ; it can accept a strftime(3) format: ; %d/%b/%Y:%H:%M:%S %z (default) +; The strftime(3) format must be encapsuled in a %{}t tag +; e.g. for a ISO8601 formatted timestring, use: %{%Y-%m-%dT%H:%M:%S%z}t ; %T: time the log has been written (the request has finished) ; it can accept a strftime(3) format: ; %d/%b/%Y:%H:%M:%S %z (default) +; The strftime(3) format must be encapsuled in a %{}t tag +; e.g. for a ISO8601 formatted timestring, use: %{%Y-%m-%dT%H:%M:%S%z}t ; %u: remote user ; ; Default: "%R - %u %t \"%m %r\" %s" @@ -349,13 +367,22 @@ chdir = __FINALPATH__ ; Default Value: no catch_workers_output = yes +; Clear environment in FPM workers +; Prevents arbitrary environment variables from reaching FPM worker processes +; by clearing the environment in workers before env vars specified in this +; pool configuration are added. +; Setting to "no" will make all environment variables available to PHP code +; via getenv(), $_ENV and $_SERVER. +; Default Value: yes +;clear_env = no + ; Limits the extensions of the main script FPM will allow to parse. This can ; prevent configuration mistakes on the web server side. You should only limit ; FPM to .php extensions to prevent malicious users to use other extensions to -; exectute php code. +; execute php code. ; Note: set an empty value to allow all extensions. ; Default Value: .php -;security.limit_extensions = .php .php3 .php4 .php5 +;security.limit_extensions = .php .php3 .php4 .php5 .php7 ; Pass environment variables like LD_LIBRARY_PATH. All $VARIABLEs are taken from ; the current environment. @@ -392,8 +419,8 @@ catch_workers_output = yes ;php_admin_value[memory_limit] = 32M ; Common values to change to increase file upload limit -; php_admin_value[upload_max_filesize] = 50M -; php_admin_value[post_max_size] = 50M +php_admin_value[upload_max_filesize] = 16M +php_admin_value[post_max_size] = 16M ; php_admin_flag[mail.add_x_header] = Off ; Other common parameters From 2520126227868b08790c1b91caafc263c00e3875 Mon Sep 17 00:00:00 2001 From: yalh76 Date: Fri, 22 Mar 2019 11:09:22 +0100 Subject: [PATCH 46/55] Removed not needed ynh_delete_file_checksum --- scripts/_common.sh | 11 ----------- 1 file changed, 11 deletions(-) diff --git a/scripts/_common.sh b/scripts/_common.sh index 2e03908..aa009f6 100644 --- a/scripts/_common.sh +++ b/scripts/_common.sh @@ -4,17 +4,6 @@ # PERSONAL HELPERS #================================================= -# Delete a file checksum from the app settings -# -# $app should be defined when calling this helper -# -# usage: ynh_remove_file_checksum file -# | arg: file - The file for which the checksum will be deleted -ynh_delete_file_checksum () { - local checksum_setting_name=checksum_${1//[\/ ]/_} # Replace all '/' and ' ' by '_' - ynh_app_setting_delete $app $checksum_setting_name -} - # Send an email to inform the administrator # # usage: ynh_send_readme_to_admin app_message [recipients] From 411962ffa709213ff77a0ccdeb1734c7373d2f04 Mon Sep 17 00:00:00 2001 From: yalh76 Date: Fri, 22 Mar 2019 11:18:31 +0100 Subject: [PATCH 47/55] Cleanup --- scripts/backup | 20 ---------- scripts/install | 102 ------------------------------------------------ scripts/restore | 36 +---------------- scripts/upgrade | 31 +-------------- 4 files changed, 2 insertions(+), 187 deletions(-) diff --git a/scripts/backup b/scripts/backup index 9e175ac..847f863 100644 --- a/scripts/backup +++ b/scripts/backup @@ -64,26 +64,6 @@ ynh_mysql_dump_db "$db_name" > db.sql #================================================= # SPECIFIC BACKUP -#================================================= -# BACKUP LOGROTATE -#================================================= -ynh_print_info "Backing up logrotate configuration..." - -#ynh_backup "/etc/logrotate.d/$app" - -#================================================= -# BACKUP SYSTEMD -#================================================= -ynh_print_info "Backing up systemd configuration..." - -#ynh_backup "/etc/systemd/system/$app.service" - -#================================================= -# BACKUP A CRON FILE -#================================================= - -#ynh_backup "/etc/cron.d/$app" - #================================================= # END OF SCRIPT #================================================= diff --git a/scripts/install b/scripts/install index 77a5d34..4073862 100644 --- a/scripts/install +++ b/scripts/install @@ -201,76 +201,6 @@ pushd $final_path --allow-as-root popd -#================================================= -# SETUP SYSTEMD -#================================================= -ynh_print_info "Configuring a systemd service..." - -### `ynh_systemd_config` is used to configure a systemd script for an app. -### It can be used for apps that use sysvinit (with adaptation) or systemd. -### Have a look at the app to be sure this app needs a systemd script. -### `ynh_systemd_config` will use the file conf/systemd.service -### If you're not using these lines: -### - You can remove those files in conf/. -### - Remove the section "BACKUP SYSTEMD" in the backup script -### - Remove also the section "STOP AND REMOVE SERVICE" in the remove script -### - As well as the section "RESTORE SYSTEMD" in the restore script -### - And the section "SETUP SYSTEMD" in the upgrade script - -# Create a dedicated systemd config -#ynh_add_systemd_config - -#================================================= -# SETUP APPLICATION WITH CURL -#================================================= - -### Use these lines only if the app installation needs to be finalized through -### web forms. We generally don't want to ask the final user, -### so we're going to use curl to automatically fill the fields and submit the -### forms. - -# Set right permissions for curl install -#chown -R $app: $final_path - -# Set the app as temporarily public for curl call -#ynh_print_info "Configuring SSOwat..." -#ynh_app_setting_set $app skipped_uris "/" -# Reload SSOwat config -#yunohost app ssowatconf - -# Reload Nginx -#systemctl reload nginx - -# Installation with curl -#ynh_print_info "Finalizing installation..." -#ynh_local_curl "/INSTALL_PATH" "key1=value1" "key2=value2" "key3=value3" - -# Remove the public access -#if [ $is_public -eq 0 ] -#then -# ynh_app_setting_delete $app skipped_uris -#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) - -#ynh_replace_string "match_string" "replace_string" "$final_path/CONFIG_FILE" - -#================================================= -# 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 "$final_path/CONFIG_FILE" - #================================================= # GENERIC FINALIZATION #================================================= @@ -285,38 +215,6 @@ ynh_print_info "Configuring a systemd service..." sudo chown -R www-data: $final_path sudo chmod 777 $final_path -R -#================================================= -# SETUP LOGROTATE -#================================================= -ynh_print_info "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 - -#================================================= -# ADVERTISE SERVICE IN ADMIN PANEL -#================================================= - -### `yunohost service add` is a CLI yunohost command to add a service in the admin panel. -### You'll find the service in the 'services' section of YunoHost admin panel. -### This CLI command would be useless if the app does not have any services (systemd or sysvinit) -### If you're not using these lines: -### - You can remove these files in conf/. -### - Remove the section "REMOVE SERVICE FROM ADMIN PANEL" in the remove script -### - As well as the section "ADVERTISE SERVICE IN ADMIN PANEL" in the restore script - -#yunohost service add $app --log "/var/log/$app/APP.log" -# if using yunohost version 3.2 or more in the 'manifest.json', a description can be added -#yunohost service add $app --description "$app daemon for XXX" --log "/var/log/$app/APP.log" - #================================================= # SETUP SSOWAT #================================================= diff --git a/scripts/restore b/scripts/restore index ff21cd6..38d4839 100644 --- a/scripts/restore +++ b/scripts/restore @@ -71,7 +71,7 @@ ynh_system_user_create $app #================================================= # Restore permissions on app files -chown -R $app: $final_path +chown -R www-data: $final_path #================================================= # RESTORE THE PHP-FPM CONFIGURATION @@ -81,14 +81,6 @@ ynh_restore_file "/etc/php/7.0/fpm/pool.d/$app.conf" #================================================= # SPECIFIC RESTORATION -#================================================= -# REINSTALL DEPENDENCIES -#================================================= -ynh_print_info "Reinstalling dependencies..." - -# Define and install dependencies -#ynh_install_app_dependencies deb1 deb2 - #================================================= # RESTORE THE MYSQL DATABASE #================================================= @@ -98,32 +90,6 @@ db_pwd=$(ynh_app_setting_get $app mysqlpwd) ynh_mysql_setup_db $db_name $db_name $db_pwd ynh_mysql_connect_as $db_name $db_pwd $db_name < ./db.sql -#================================================= -# RESTORE SYSTEMD -#================================================= -ynh_print_info "Restoring the systemd configuration..." - -#ynh_restore_file "/etc/systemd/system/$app.service" -#systemctl enable $app.service - -#================================================= -# ADVERTISE SERVICE IN ADMIN PANEL -#================================================= - -#yunohost service add $app --log "/var/log/$app/APP.log" - -#================================================= -# RESTORE THE CRON FILE -#================================================= - -#ynh_restore_file "/etc/cron.d/$app" - -#================================================= -# RESTORE THE LOGROTATE CONFIGURATION -#================================================= - -#ynh_restore_file "/etc/logrotate.d/$app" - #================================================= # GENERIC FINALIZATION #================================================= diff --git a/scripts/upgrade b/scripts/upgrade index 28272ec..3f12aaf 100644 --- a/scripts/upgrade +++ b/scripts/upgrade @@ -89,13 +89,6 @@ ynh_print_info "Upgrading nginx web server configuration..." # Create a dedicated nginx config ynh_add_nginx_config -#================================================= -# UPGRADE DEPENDENCIES -#================================================= -ynh_print_info "Upgrading dependencies..." - -#ynh_install_app_dependencies deb1 deb2 - #================================================= # CREATE DEDICATED USER #================================================= @@ -122,28 +115,6 @@ pushd $final_path sudo ./concrete/bin/concrete5 c5:update --rerun --verbose --allow-as-root popd -### Verify the checksum of a file, stored by `ynh_store_file_checksum` in the install script. -### And create a backup of this file if the checksum is different. So the file will be backed up if the admin had modified it. -#ynh_backup_if_checksum_is_different "$final_path/CONFIG_FILE" -# Recalculate and store the checksum of the file for the next upgrade. -#ynh_store_file_checksum "$final_path/CONFIG_FILE" - -#================================================= -# SETUP LOGROTATE -#================================================= -ynh_print_info "Upgrading logrotate configuration..." - -# Use logrotate to manage app-specific logfile(s) -#ynh_use_logrotate --non-append - -#================================================= -# SETUP SYSTEMD -#================================================= -ynh_print_info "Upgrading systemd configuration..." - -# Create a dedicated systemd config -#ynh_add_systemd_config - #================================================= # GENERIC FINALIZATION #================================================= @@ -151,7 +122,7 @@ ynh_print_info "Upgrading systemd configuration..." #================================================= # Set permissions on app files -chown -R root: $final_path +chown -R www-data: $final_path #================================================= # SETUP SSOWAT From b74690d4b58dcda2931194bba804e4ab71e44ac6 Mon Sep 17 00:00:00 2001 From: yalh76 Date: Fri, 22 Mar 2019 11:25:17 +0100 Subject: [PATCH 48/55] cleanup --- scripts/backup | 4 --- scripts/install | 81 ++----------------------------------------------- scripts/remove | 48 ----------------------------- scripts/restore | 4 --- 4 files changed, 2 insertions(+), 135 deletions(-) diff --git a/scripts/backup b/scripts/backup index 847f863..2348d9e 100644 --- a/scripts/backup +++ b/scripts/backup @@ -14,10 +14,6 @@ source /usr/share/yunohost/helpers # MANAGE SCRIPT FAILURE #================================================= -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 ynh_abort_if_errors diff --git a/scripts/install b/scripts/install index 4073862..bd62b5e 100644 --- a/scripts/install +++ b/scripts/install @@ -13,10 +13,6 @@ source /usr/share/yunohost/helpers # MANAGE SCRIPT FAILURE #================================================= -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 ynh_abort_if_errors @@ -33,17 +29,6 @@ password=$YNH_APP_ARG_PASSWORD website_title=$YNH_APP_ARG_WEBSITE_TITLE admin_email=$(ynh_user_get_info $admin 'mail') - -### 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 #================================================= @@ -51,8 +36,6 @@ app=$YNH_APP_INSTANCE_NAME #================================================= ynh_print_info "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 "This path already contains a folder" @@ -77,50 +60,11 @@ ynh_app_setting_set $app website_title $website_title #================================================= # STANDARD MODIFICATIONS -#================================================= -# FIND AND OPEN A PORT -#================================================= -ynh_print_info "Configuring firewall..." - -### Use these lines if you have to open a port for the application -### `ynh_find_port` will find the first available port starting from the given port. -### If you're not using these lines: -### - Remove the section "CLOSE A PORT" in the remove script - -# Find a free port -#port=$(ynh_find_port 8095) -# Open this port -#ynh_exec_warn_less yunohost firewall allow --no-upnp TCP $port -#ynh_app_setting_set $app port $port - -#================================================= -# INSTALL DEPENDENCIES -#================================================= -ynh_print_info "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 -### - As well as the section "REINSTALL DEPENDENCIES" in the restore script -### - And the section "UPGRADE DEPENDENCIES" in the upgrade script - -#ynh_install_app_dependencies deb1 deb2 - #================================================= # CREATE A MYSQL DATABASE #================================================= ynh_print_info "Creating a MySQL 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 - db_name=$(ynh_sanitize_dbid $app) ynh_app_setting_set $app db_name $db_name ynh_mysql_setup_db $db_name $db_name @@ -130,10 +74,6 @@ ynh_mysql_setup_db $db_name $db_name #================================================= ynh_print_info "Setting up 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 final_path $final_path # Download, check integrity, uncompress and patch the source from app.src ynh_setup_source "$final_path" @@ -143,8 +83,6 @@ ynh_setup_source "$final_path" #================================================= ynh_print_info "Configuring nginx web server..." -### `ynh_add_nginx_config` will use the file conf/nginx.conf - # Create a dedicated nginx config ynh_add_nginx_config @@ -161,17 +99,6 @@ ynh_system_user_create $app #================================================= ynh_print_info "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 and conf/php-fpm.ini -### 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 @@ -207,13 +134,9 @@ popd # SECURE FILES AND DIRECTORIES #================================================= -### For security reason, any app should set the permissions to root: before anything else. -### Then, if write authorization is needed, any access should be given only to directories -### that really need such authorization. - # Set permissions to app files -sudo chown -R www-data: $final_path -sudo chmod 777 $final_path -R +chown -R www-data: $final_path + #================================================= # SETUP SSOWAT diff --git a/scripts/remove b/scripts/remove index e2cf5ea..6da30a6 100644 --- a/scripts/remove +++ b/scripts/remove @@ -24,25 +24,6 @@ final_path=$(ynh_app_setting_get $app final_path) #================================================= # STANDARD REMOVE -#================================================= -# REMOVE SERVICE FROM ADMIN PANEL -#================================================= - -# Remove a service from the admin panel, added by `yunohost service add` -#if yunohost service status $app >/dev/null 2>&1 -#then -# ynh_print_info "Removing $app service" -# yunohost service remove $app -#fi - -#================================================= -# STOP AND REMOVE SERVICE -#================================================= -ynh_print_info "Stopping and removing the systemd service" - -# Remove the dedicated systemd config -#ynh_remove_systemd_config - #================================================= # REMOVE THE MYSQL DATABASE #================================================= @@ -51,14 +32,6 @@ ynh_print_info "Removing the MySQL database" # Remove a database if it exists, along with the associated user ynh_mysql_remove_db $db_user $db_name -#================================================= -# REMOVE DEPENDENCIES -#================================================= -ynh_print_info "Removing dependencies" - -# Remove metapackage and its dependencies -#ynh_remove_app_dependencies - #================================================= # REMOVE APP MAIN DIR #================================================= @@ -83,33 +56,12 @@ ynh_print_info "Removing php-fpm configuration" # Remove the dedicated php-fpm config ynh_remove_fpm_config -#================================================= -# REMOVE LOGROTATE CONFIGURATION -#================================================= -ynh_print_info "Removing logrotate configuration" - -# Remove the app-specific logrotate config -#ynh_remove_logrotate - -#================================================= -# CLOSE A PORT -#================================================= - -#if yunohost firewall list | grep -q "\- $port$" -#then -# ynh_print_info "Closing port $port" -# ynh_exec_warn_less yunohost firewall disallow TCP $port -#fi - #================================================= # SPECIFIC REMOVE #================================================= # REMOVE THE CRON FILE #================================================= -# Remove a cron file -#ynh_secure_remove "/etc/cron.d/$app" - # Remove a directory securely ynh_secure_remove "/etc/$app/" diff --git a/scripts/restore b/scripts/restore index 38d4839..a6c19cb 100644 --- a/scripts/restore +++ b/scripts/restore @@ -14,10 +14,6 @@ source /usr/share/yunohost/helpers # MANAGE SCRIPT FAILURE #================================================= -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 ynh_abort_if_errors From 09e7aacd9a85104dbb88d13f99fefc42af5ff907 Mon Sep 17 00:00:00 2001 From: yalh76 Date: Fri, 22 Mar 2019 11:26:43 +0100 Subject: [PATCH 49/55] Update remove --- scripts/remove | 12 ------------ 1 file changed, 12 deletions(-) diff --git a/scripts/remove b/scripts/remove index 6da30a6..39a2544 100644 --- a/scripts/remove +++ b/scripts/remove @@ -56,18 +56,6 @@ ynh_print_info "Removing php-fpm configuration" # Remove the dedicated php-fpm config ynh_remove_fpm_config -#================================================= -# SPECIFIC REMOVE -#================================================= -# REMOVE THE CRON FILE -#================================================= - -# Remove a directory securely -ynh_secure_remove "/etc/$app/" - -# Remove the log files -ynh_secure_remove "/var/log/$app/" - #================================================= # GENERIC FINALIZATION #================================================= From 98e7ead3808d73b453817becda1c399385987a82 Mon Sep 17 00:00:00 2001 From: yalh76 Date: Fri, 22 Mar 2019 21:27:18 +0100 Subject: [PATCH 50/55] fix folder owner --- scripts/install | 3 +-- scripts/restore | 2 +- scripts/upgrade | 2 +- 3 files changed, 3 insertions(+), 4 deletions(-) diff --git a/scripts/install b/scripts/install index bd62b5e..f07a8fa 100644 --- a/scripts/install +++ b/scripts/install @@ -135,8 +135,7 @@ popd #================================================= # Set permissions to app files -chown -R www-data: $final_path - +chown -R $app: $final_path #================================================= # SETUP SSOWAT diff --git a/scripts/restore b/scripts/restore index a6c19cb..73176d6 100644 --- a/scripts/restore +++ b/scripts/restore @@ -67,7 +67,7 @@ ynh_system_user_create $app #================================================= # Restore permissions on app files -chown -R www-data: $final_path +chown -R $app: $final_path #================================================= # RESTORE THE PHP-FPM CONFIGURATION diff --git a/scripts/upgrade b/scripts/upgrade index 3f12aaf..2d1fefa 100644 --- a/scripts/upgrade +++ b/scripts/upgrade @@ -122,7 +122,7 @@ popd #================================================= # Set permissions on app files -chown -R www-data: $final_path +chown -R $app: $final_path #================================================= # SETUP SSOWAT From 18477d245896945e802cb98e731224cd75f3a82c Mon Sep 17 00:00:00 2001 From: yalh76 Date: Fri, 22 Mar 2019 21:53:06 +0100 Subject: [PATCH 51/55] roll back to admin_name and admin_pass --- README.md | 2 +- check_process | 4 ++-- conf/app.src | 4 ++-- manifest.json | 6 +++--- scripts/install | 8 ++++---- scripts/upgrade | 2 +- 6 files changed, 13 insertions(+), 13 deletions(-) diff --git a/README.md b/README.md index e9c5342..e342d65 100644 --- a/README.md +++ b/README.md @@ -17,7 +17,7 @@ Features : * Marketing tools * **and more**... -**Shipped version:** 8.4.5 +**Shipped version:** 8.5.0 ## Documentation diff --git a/check_process b/check_process index cf1c349..16ddc2e 100644 --- a/check_process +++ b/check_process @@ -7,10 +7,10 @@ ; Manifest domain="domain.tld" (DOMAIN) path="/path" (PATH) - admin="john" (USER) + admin_name="john" (USER) language="fr_FR" is_public=1 (PUBLIC|public=1|private=0) - password="pass" + admin_pass="pass" website_title="site" ; Checks diff --git a/conf/app.src b/conf/app.src index 924e56a..ad951e1 100644 --- a/conf/app.src +++ b/conf/app.src @@ -1,5 +1,5 @@ -SOURCE_URL=https://github.com/concrete5/concrete5/archive/8.4.5.tar.gz -SOURCE_SUM=a8708e6d55dba3bcf6aeb2a377eaa851650cb8634343c7ce4e88045fd58d565e +SOURCE_URL=https://github.com/concrete5/concrete5/archive/8.5.0.tar.gz +SOURCE_SUM=0817919036201331bd610e1e77fb83732b235ab2b6ed1f19b2312899a7929318 SOURCE_SUM_PRG=sha256sum SOURCE_FORMAT=tar.gz SOURCE_IN_SUBDIR=true diff --git a/manifest.json b/manifest.json index c18b9d2..3d0c058 100644 --- a/manifest.json +++ b/manifest.json @@ -6,7 +6,7 @@ "en": "Create a modern Website", "fr": "Créer un site web moderne avec un CMS moderne" }, - "version": "8.4.5~ynh1", + "version": "8.5.0~ynh1", "url": "www.concrete5.org", "license": "MIT", "maintainer": { @@ -44,7 +44,7 @@ "default": "/concrete" }, { - "name": "admin", + "name": "admin_name", "type": "user", "ask": { "en": "Choose an admin user", @@ -72,7 +72,7 @@ "default": "en_US" }, { - "name": "password", + "name": "admin_pass", "type": "password", "ask": { "en": "Set the administrator password", diff --git a/scripts/install b/scripts/install index f07a8fa..8672443 100644 --- a/scripts/install +++ b/scripts/install @@ -22,12 +22,12 @@ ynh_abort_if_errors domain=$YNH_APP_ARG_DOMAIN path_url=$YNH_APP_ARG_PATH -admin=$YNH_APP_ARG_ADMIN +admin_name=$YNH_APP_ARG_ADMIN_NAME is_public=$YNH_APP_ARG_IS_PUBLIC language=$YNH_APP_ARG_LANGUAGE password=$YNH_APP_ARG_PASSWORD website_title=$YNH_APP_ARG_WEBSITE_TITLE -admin_email=$(ynh_user_get_info $admin 'mail') +admin_email=$(ynh_user_get_info $admin_name 'mail') app=$YNH_APP_INSTANCE_NAME @@ -52,7 +52,7 @@ ynh_print_info "Storing installation settings..." ynh_app_setting_set $app domain $domain ynh_app_setting_set $app path $path_url -ynh_app_setting_set $app admin $admin +ynh_app_setting_set $app admin_name $admin_name ynh_app_setting_set $app is_public $is_public ynh_app_setting_set $app language $language ynh_app_setting_set $app admin_email $admin_email @@ -120,7 +120,7 @@ pushd $final_path --db-password=$db_pwd \ --site="$website_title" \ --admin-email="$admin_email" \ - --admin-password=$password \ + --admin-password="$admin_pass" \ --language=$language \ --site-locale=$language \ --verbose \ diff --git a/scripts/upgrade b/scripts/upgrade index 2d1fefa..acfb610 100644 --- a/scripts/upgrade +++ b/scripts/upgrade @@ -18,7 +18,7 @@ app=$YNH_APP_INSTANCE_NAME domain=$(ynh_app_setting_get $app domain) path_url=$(ynh_app_setting_get $app path) -admin=$(ynh_app_setting_get $app admin) +admin_name=$(ynh_app_setting_get $app admin_name) is_public=$(ynh_app_setting_get $app is_public) final_path=$(ynh_app_setting_get $app final_path) language=$(ynh_app_setting_get $app language) From e34f5fe1a625814229f9009d58c8916968ddfa26 Mon Sep 17 00:00:00 2001 From: yalh76 Date: Fri, 22 Mar 2019 22:01:48 +0100 Subject: [PATCH 52/55] fix unbound variable --- scripts/install | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/scripts/install b/scripts/install index 8672443..71f70e0 100644 --- a/scripts/install +++ b/scripts/install @@ -25,7 +25,7 @@ path_url=$YNH_APP_ARG_PATH admin_name=$YNH_APP_ARG_ADMIN_NAME is_public=$YNH_APP_ARG_IS_PUBLIC language=$YNH_APP_ARG_LANGUAGE -password=$YNH_APP_ARG_PASSWORD +admin_pass=$YNH_APP_ARG_ADMIN_PASS website_title=$YNH_APP_ARG_WEBSITE_TITLE admin_email=$(ynh_user_get_info $admin_name 'mail') From b782bccb330c72ea707629ea14e27473ec16eef4 Mon Sep 17 00:00:00 2001 From: yalh76 Date: Fri, 22 Mar 2019 22:05:52 +0100 Subject: [PATCH 53/55] Roll back to 8.4.5 --- README.md | 2 +- conf/app.src | 4 ++-- manifest.json | 2 +- 3 files changed, 4 insertions(+), 4 deletions(-) diff --git a/README.md b/README.md index e342d65..e9c5342 100644 --- a/README.md +++ b/README.md @@ -17,7 +17,7 @@ Features : * Marketing tools * **and more**... -**Shipped version:** 8.5.0 +**Shipped version:** 8.4.5 ## Documentation diff --git a/conf/app.src b/conf/app.src index ad951e1..924e56a 100644 --- a/conf/app.src +++ b/conf/app.src @@ -1,5 +1,5 @@ -SOURCE_URL=https://github.com/concrete5/concrete5/archive/8.5.0.tar.gz -SOURCE_SUM=0817919036201331bd610e1e77fb83732b235ab2b6ed1f19b2312899a7929318 +SOURCE_URL=https://github.com/concrete5/concrete5/archive/8.4.5.tar.gz +SOURCE_SUM=a8708e6d55dba3bcf6aeb2a377eaa851650cb8634343c7ce4e88045fd58d565e SOURCE_SUM_PRG=sha256sum SOURCE_FORMAT=tar.gz SOURCE_IN_SUBDIR=true diff --git a/manifest.json b/manifest.json index 3d0c058..4ab067e 100644 --- a/manifest.json +++ b/manifest.json @@ -6,7 +6,7 @@ "en": "Create a modern Website", "fr": "Créer un site web moderne avec un CMS moderne" }, - "version": "8.5.0~ynh1", + "version": "8.4.5~ynh1", "url": "www.concrete5.org", "license": "MIT", "maintainer": { From 92e5e0ab0553d2aaffba8179cc622681901d2081 Mon Sep 17 00:00:00 2001 From: yalh76 Date: Fri, 22 Mar 2019 22:17:52 +0100 Subject: [PATCH 54/55] cleanup --- check_process | 3 +-- conf/config.yml | 38 -------------------------------------- 2 files changed, 1 insertion(+), 40 deletions(-) delete mode 100644 conf/config.yml diff --git a/check_process b/check_process index 16ddc2e..e16a37b 100644 --- a/check_process +++ b/check_process @@ -11,8 +11,7 @@ language="fr_FR" is_public=1 (PUBLIC|public=1|private=0) admin_pass="pass" - website_title="site" - + website_title="site" ; Checks pkg_linter=1 setup_sub_dir=1 diff --git a/conf/config.yml b/conf/config.yml deleted file mode 100644 index baec957..0000000 --- a/conf/config.yml +++ /dev/null @@ -1,38 +0,0 @@ -appNamespace: "chooseAnUniqueNameForYourApp" -timezone: "Europe/Paris" -doctrine: - driver: "pdo_mysql" - host: "localhost" - user: "db_user" - password: 'db_pass' - dbname: "db_name" - port: null - unix_socket: null - path: null -cacheDriver: - type: null - host: null - port: null -security: - secret: 'change#this#secret#very#important' -mailer: - type: null - host: "localhost" - port: 25 - encryption: false - username: '' - password: '' -entities: - - "src/Roadiz/Core/Entities" - - "src/Roadiz/Core/AbstractEntities" - - "gen-src/GeneratedNodeSources" -rememberMeLifetime: 2592000 -additionalServiceProviders: { } -additionalCommands: - - \Themes\DefaultTheme\Commands\DefaultThemeCommand -assetsProcessing: - driver: gd - defaultQuality: 90 - maxPixelSize: 1920 - jpegoptimPath: null - pngquantPath: null From 69df710bbcff85f2cf08629b9559adbb25c4c2ca Mon Sep 17 00:00:00 2001 From: yalh76 Date: Sat, 23 Mar 2019 01:25:41 +0100 Subject: [PATCH 55/55] cleaning --- conf/nginx.conf | 2 -- 1 file changed, 2 deletions(-) diff --git a/conf/nginx.conf b/conf/nginx.conf index f2277ea..901ac24 100644 --- a/conf/nginx.conf +++ b/conf/nginx.conf @@ -9,7 +9,6 @@ location __PATH__/ { rewrite ^ https://$server_name$request_uri? permanent; } -### Example PHP configuration (remove it if not used) index index.php; # Common parameter to increase upload size limit in conjunction with dedicated php-fpm file @@ -26,7 +25,6 @@ location __PATH__/ { fastcgi_param PATH_INFO $fastcgi_path_info; fastcgi_param SCRIPT_FILENAME $request_filename; } -### End of PHP configuration part # Include SSOWAT user panel. include conf.d/yunohost_panel.conf.inc;