1
0
Fork 0
mirror of https://github.com/YunoHost-Apps/wemawema_ynh.git synced 2024-10-01 13:34:56 +02:00

Merge pull request #3 from ericgaspar/v.26.1

Upgrade to V.26.1
This commit is contained in:
Éric Gaspar 2020-10-02 22:14:09 +02:00 committed by GitHub
commit f884fb6303
No known key found for this signature in database
GPG key ID: 4AEE18F83AFDEB23
19 changed files with 311 additions and 136 deletions

2
.gitignore vendored
View file

@ -1,2 +0,0 @@
*~
*.sw[op]

View file

@ -18,4 +18,4 @@ FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE
SOFTWARE. SOFTWARE.

View file

@ -1,11 +1,68 @@
# WemaWema app for YunoHost # WemaWema for YunoHost
[![Integration level](https://dash.yunohost.org/integration/wemawema.svg)](https://dash.yunohost.org/appci/app/wemawema) ![](https://ci-apps.yunohost.org/ci/badges/wemawema.status.svg) ![](https://ci-apps.yunohost.org/ci/badges/wemawema.maintain.svg) [![Integration level](https://dash.yunohost.org/integration/wemawema.svg)](https://dash.yunohost.org/appci/app/wemawema) ![](https://ci-apps.yunohost.org/ci/badges/wemawema.status.svg) ![](https://ci-apps.yunohost.org/ci/badges/wemawema.maintain.svg)
[![Install WemaWema for YunoHost](https://install-app.yunohost.org/install-with-yunohost.png)](https://install-app.yunohost.org/?app=wemawema)
- [Yunohost project](https://yunohost.org) *[Lire ce readme en français.](./README_fr.md)*
- [WemaWema website](https://luc.frama.io/wemawema)
- [WemaWema git repository](https://framagit.org/luc/wemawema)
![WemaWema](https://framagit.org/uploads/-/system/project/avatar/17831/Logo.png "WemaWema logo") WemaWema > *This package allows you to install WemaWema quickly and simply on a YunoHost server.
=== If you don't have YunoHost, please consult [the guide](https://yunohost.org/#/install) to learn how to install it.*
WemaWema is a "WE MAKE PORN" meme generator, but it can do more
## Overview
WemaWema is a *WE MAKE PORN* meme generator, but it can do more.
**Shipped version:** 26.1
## Screenshots
![](sources/WemaWema.png)
## Demo
* [Official demo](https://luc.frama.io/wemawema/?w=WE+MAKE&wx=400&wy=160&ws=150&wc=%23000000&wa=0&wf=Open+Sans&wfs=bold&ww=725&p=PORN&px=400&py=350&ps=220&pc=%23000000&pa=0&pf=Open+Sans&pfs=bold&pw=725&co=%23fcd205&ra=0&gli=false&bgt=plain&rc=%23000000&bgr=%23fcd205&egr=%23ffffff&or=lr&bgi=beer&cor=20&bth=20&width=800&height=400&x=0&y=0&s=1.000&bgu=&r=false&rx=0&ry=0&rs=100&rr=0&woc=%23ffffff&wos=0&poc=%23ffffff&pos=0)
## Documentation
* Official documentation: https://framagit.org/luc/wemawema
* YunoHost documentation: If specific documentation is needed, feel free to contribute.
## YunoHost specific features
#### Multi-user support
* Are LDAP and HTTP auth supported? **No**
* Can the app be used by multiple users? **Yes**
#### Supported architectures
* x86-64 - [![Build Status](https://ci-apps.yunohost.org/ci/logs/wemawema%20%28Apps%29.svg)](https://ci-apps.yunohost.org/ci/apps/wemawema/)
* ARMv8-A - [![Build Status](https://ci-apps-arm.yunohost.org/ci/logs/wemawema%20%28Apps%29.svg)](https://ci-apps-arm.yunohost.org/ci/apps/wemawema/)
## Limitations
* Any known limitations.
## Additional information
* Other info you would like to add about this app.
## Links
* Report a bug: https://github.com/YunoHost-Apps/wemawema_ynh/issues
* App website: https://luc.frama.io/wemawema
* Upstream app repository: https://framagit.org/luc/wemawema
* YunoHost website: https://yunohost.org/
---
## Developer info
Please send your pull request to the [testing branch](https://github.com/YunoHost-Apps/wemawema_ynh/tree/testing).
To try the testing branch, please proceed like that.
```
sudo yunohost app install https://github.com/YunoHost-Apps/wemawema_ynh/tree/testing --debug
or
sudo yunohost app upgrade wemawema -u https://github.com/YunoHost-Apps/wemawema_ynh/tree/testing --debug
```

67
README_fr.md Normal file
View file

@ -0,0 +1,67 @@
# WemaWema pour YunoHost
[![Integration level](https://dash.yunohost.org/integration/wemawema.svg)](https://dash.yunohost.org/appci/app/wemawema) ![](https://ci-apps.yunohost.org/ci/badges/wemawema.status.svg) ![](https://ci-apps.yunohost.org/ci/badges/wemawema.maintain.svg)
[![Installer WemaWema avec YunoHost](https://install-app.yunohost.org/install-with-yunohost.png)](https://install-app.yunohost.org/?app=wemawema)
*[Read this readme in english.](./README.md)*
> *Ce package vous permet d'installer WemaWema rapidement et simplement sur un serveur YunoHost.
Si vous n'avez pas YunoHost, consultez [le guide](https://yunohost.org/#/install) pour apprendre comment l'installer.*
## Vue d'ensemble
WemaWema est un générateur de mèmes *WE MAKE PORN*.
**Version incluse :** 26.1
## Captures d'écran
![](sources/WemaWema.png)
## Démo
* [Démo officielle](https://luc.frama.io/wemawema/?w=WE+MAKE&wx=400&wy=160&ws=150&wc=%23000000&wa=0&wf=Open+Sans&wfs=bold&ww=725&p=PORN&px=400&py=350&ps=220&pc=%23000000&pa=0&pf=Open+Sans&pfs=bold&pw=725&co=%23fcd205&ra=0&gli=false&bgt=plain&rc=%23000000&bgr=%23fcd205&egr=%23ffffff&or=lr&bgi=beer&cor=20&bth=20&width=800&height=400&x=0&y=0&s=1.000&bgu=&r=false&rx=0&ry=0&rs=100&rr=0&woc=%23ffffff&wos=0&poc=%23ffffff&pos=0)
## Documentation
* Documentation officielle : https://framagit.org/luc/wemawema
* Documentation YunoHost : Si une documentation spécifique est nécessaire, n'hésitez pas à contribuer.
## Caractéristiques spécifiques YunoHost
#### Support multi-utilisateur
* L'authentification LDAP et HTTP est-elle prise en charge ? **Non**
* L'application peut-elle être utilisée par plusieurs utilisateurs ? **Oui**
#### Architectures supportées
* x86-64 - [![Build Status](https://ci-apps.yunohost.org/ci/logs/wemawema%20%28Apps%29.svg)](https://ci-apps.yunohost.org/ci/apps/wemawema/)
* ARMv8-A - [![Build Status](https://ci-apps-arm.yunohost.org/ci/logs/wemawema%20%28Apps%29.svg)](https://ci-apps-arm.yunohost.org/ci/apps/wemawema/)
## Limitations
* Limitations connues.
## Informations additionnelles
* Autres informations que vous souhaitez ajouter sur cette application.
## Liens
* Signaler un bug : https://github.com/YunoHost-Apps/wemawema_ynh/issues
* Site de l'application : https://luc.frama.io/wemawema
* Dépôt de l'application principale : https://framagit.org/luc/wemawema
* Site web YunoHost : https://yunohost.org/
---
## Informations pour les développeurs
Merci de faire vos pull request sur la [branche testing](https://github.com/YunoHost-Apps/wemawema_ynh/tree/testing).
Pour essayer la branche testing, procédez comme suit.
```
sudo yunohost app install https://github.com/YunoHost-Apps/wemawema_ynh/tree/testing --debug
ou
sudo yunohost app upgrade wemawema -u https://github.com/YunoHost-Apps/wemawema_ynh/tree/testing --debug
```

View file

@ -19,8 +19,8 @@
backup_restore=1 backup_restore=1
multi_instance=1 multi_instance=1
incorrect_path=1 incorrect_path=1
port_already_use=0 port_already_use=1
change_url=0 change_url=1
;;; Levels ;;; Levels
Level 1=auto Level 1=auto
Level 2=auto Level 2=auto

View file

@ -1,5 +1,5 @@
SOURCE_URL=https://framagit.org/luc/wemawema/repository/25.0/archive.tar.gz SOURCE_URL=https://framagit.org/luc/wemawema/-/archive/26.1/wemawema-26.1.tar.gz
SOURCE_SUM=b78a5832f72e295d6ab0ebf628ab3c21a2aea70cb0086e9c8bba0957eeb4f958 SOURCE_SUM=e06b539502d517866eac5bcdd1db9c7cfc6d5a45212749460aa2502c009966db
SOURCE_SUM_PRG=sha256sum SOURCE_SUM_PRG=sha256sum
SOURCE_FORMAT=tar.gz SOURCE_FORMAT=tar.gz
SOURCE_IN_SUBDIR=true SOURCE_IN_SUBDIR=true

View file

@ -1,8 +1,10 @@
location __PATH__ { #sub_path_only rewrite ^__PATH__$ __PATH__/ permanent;
location __PATH__/ {
# Path to source # Path to source
alias __FINALPATH__/ ; alias __FINALPATH__/ ;
# Force usage of https
if ($scheme = http) { if ($scheme = http) {
rewrite ^ https://$server_name$request_uri? permanent; rewrite ^ https://$server_name$request_uri? permanent;
} }

View file

@ -3,18 +3,19 @@
"id": "wemawema", "id": "wemawema",
"packaging_format": 1, "packaging_format": 1,
"description": { "description": {
"en": "WemaWema is a \"WE MAKE PORN\" meme generator but it can do more", "en": "\"WE MAKE PORN\" meme generator but it can do more.",
"fr": "WemaWema est un générateur de mème « WE MAKE PORN » mais il peut faire bien plus" "fr": "Générateur de mème « WE MAKE PORN » mais il peut faire bien plus."
}, },
"version": "26.1~ynh1",
"url": "https://framagit.org/luc/wemawema", "url": "https://framagit.org/luc/wemawema",
"license": "AGPLv3", "license": "AGPL-3.0-only",
"maintainer": { "maintainer": {
"name": "Luc Didry", "name": "Luc Didry",
"email": "luc@didry.org", "email": "luc@didry.org",
"url": "https://fiat-tux.fr" "url": "https://fiat-tux.fr"
}, },
"requirements": { "requirements": {
"yunohost": ">> 2.6.4" "yunohost": ">> 3.8.0"
}, },
"multi_instance": true, "multi_instance": true,
"services": [ "services": [

18
pull_request_template.md Normal file
View file

@ -0,0 +1,18 @@
## Problem
- *Description of why you made this PR*
## Solution
- *And how do you fix that problem*
## PR Status
- [ ] Code finished.
- [ ] Tested with Package_check.
- [ ] Fix or enhancement tested.
- [ ] Upgrade from last version tested.
- [ ] Can be reviewed and tested.
## Package_check results
---
*If you have access to [App Continuous Integration for packagers](https://yunohost.org/#/packaging_apps_ci) you can provide a link to the package_check results like below, replacing '-NUM-' in this link by the PR number and USERNAME by your username on the ci-apps-dev. Or you provide a screenshot or a pastebin of the results*
[![Build Status](https://ci-apps-dev.yunohost.org/jenkins/job/wemawema_ynh%20PR-NUM-%20(USERNAME)/badge/icon)](https://ci-apps-dev.yunohost.org/jenkins/job/wemawema_ynh%20PR-NUM-%20(USERNAME)/)

View file

@ -1,13 +1,17 @@
#!/bin/bash #!/bin/bash
# ============= FUTURE YUNOHOST HELPER ============= #=================================================
# Delete a file checksum from the app settings # COMMON VARIABLES
# #=================================================
# $app should be defined when calling this helper
# #=================================================
# usage: ynh_remove_file_checksum file # PERSONAL HELPERS
# | 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 # EXPERIMENTAL HELPERS
} #=================================================
#=================================================
# FUTURE OFFICIAL HELPERS
#=================================================

View file

@ -6,12 +6,8 @@
# IMPORT GENERIC HELPERS # IMPORT GENERIC HELPERS
#================================================= #=================================================
if [ ! -e _common.sh ]; then #Keep this path for calling _common.sh inside the execution's context of backup and restore scripts
# Get the _common.sh file if it's not in the current directory source ../settings/scripts/_common.sh
cp ../settings/scripts/_common.sh ./_common.sh
chmod a+rx _common.sh
fi
source _common.sh
source /usr/share/yunohost/helpers source /usr/share/yunohost/helpers
#================================================= #=================================================
@ -27,9 +23,8 @@ ynh_abort_if_errors
app=$YNH_APP_INSTANCE_NAME app=$YNH_APP_INSTANCE_NAME
final_path=$(ynh_app_setting_get $app final_path) final_path=$(ynh_app_setting_get --app=$app --key=final_path)
domain=$(ynh_app_setting_get $app domain) domain=$(ynh_app_setting_get --app=$app --key=domain)
db_name=$(ynh_app_setting_get $app db_name)
#================================================= #=================================================
# STANDARD BACKUP STEPS # STANDARD BACKUP STEPS

View file

@ -22,13 +22,29 @@ new_path=$YNH_APP_NEW_PATH
app=$YNH_APP_INSTANCE_NAME app=$YNH_APP_INSTANCE_NAME
#================================================= #=================================================
# CHECK THE SYNTAX OF THE PATHS # LOAD SETTINGS
#================================================= #=================================================
ynh_script_progression --message="Loading installation settings..." --weight=1
test -n "$old_path" || old_path="/" # Needed for helper "ynh_add_nginx_config"
test -n "$new_path" || new_path="/" final_path=$(ynh_app_setting_get --app=$app --key=final_path)
new_path=$(ynh_normalize_url_path $new_path)
old_path=$(ynh_normalize_url_path $old_path) #=================================================
# BACKUP BEFORE UPGRADE THEN ACTIVE TRAP
#=================================================
ynh_script_progression --message="Backing up the app before changing its url (may take a while)..." --weight=2
# Backup the current version of the app
ynh_backup_before_upgrade
ynh_clean_setup () {
# Remove the new domain config file, the remove script won't do it as it doesn't know yet its location.
ynh_secure_remove --file="/etc/nginx/conf.d/$new_domain.d/$app.conf"
# restore it if the upgrade fails
ynh_restore_upgradebackup
}
# Exit if an error occurs during the execution of the script
ynh_abort_if_errors
#================================================= #=================================================
# CHECK WHICH PARTS SHOULD BE CHANGED # CHECK WHICH PARTS SHOULD BE CHANGED
@ -51,6 +67,7 @@ fi
#================================================= #=================================================
# MODIFY URL IN NGINX CONF # MODIFY URL IN NGINX CONF
#================================================= #=================================================
ynh_script_progression --message="Updating nginx web server configuration..." --weight=1
nginx_conf_path=/etc/nginx/conf.d/$old_domain.d/$app.conf nginx_conf_path=/etc/nginx/conf.d/$old_domain.d/$app.conf
@ -58,30 +75,33 @@ nginx_conf_path=/etc/nginx/conf.d/$old_domain.d/$app.conf
if [ $change_path -eq 1 ] if [ $change_path -eq 1 ]
then then
# Make a backup of the original nginx config file if modified # Make a backup of the original nginx config file if modified
ynh_backup_if_checksum_is_different "$nginx_conf_path" ynh_backup_if_checksum_is_different --file="$nginx_conf_path"
# Replace locations starting with old_path # Set global variables for nginx helper
# Look for every location possible patterns (see https://nginx.org/en/docs/http/ngx_http_core_module.html#location) domain="$old_domain"
ynh_replace_string "location\( \(=\|~\|~\*\|\^~\)\)\? $old_path" "location\1 $new_path" "$nginx_conf_path" path_url="$new_path"
# Replace path in "return" directives # Create a dedicated nginx config
ynh_replace_string "return \([[:digit:]]\{3\}\) $old_path" "return \1 $new_path" "$nginx_conf_path" ynh_add_nginx_config
# Calculate and store the nginx config file checksum
ynh_store_file_checksum "$nginx_conf_path"
fi fi
# Change the domain for nginx # Change the domain for nginx
if [ $change_domain -eq 1 ] if [ $change_domain -eq 1 ]
then then
# Delete file checksum for the old conf file location # Delete file checksum for the old conf file location
ynh_delete_file_checksum "$nginx_conf_path" ynh_delete_file_checksum --file="$nginx_conf_path"
mv $nginx_conf_path /etc/nginx/conf.d/$new_domain.d/$app.conf mv $nginx_conf_path /etc/nginx/conf.d/$new_domain.d/$app.conf
# Store file checksum for the new config file location # Store file checksum for the new config file location
ynh_store_file_checksum "/etc/nginx/conf.d/$new_domain.d/$app.conf" ynh_store_file_checksum --file="/etc/nginx/conf.d/$new_domain.d/$app.conf"
fi fi
#=================================================
# GENERIC FINALISATION
#================================================= #=================================================
# RELOAD NGINX # RELOAD NGINX
#================================================= #=================================================
ynh_script_progression --message="Reloading nginx web server..." --weight=1
systemctl reload nginx ynh_systemd_action --service_name=nginx --action=reload
#=================================================
# END OF SCRIPT
#=================================================
ynh_script_progression --message="Change of URL completed for $app" --last

View file

@ -24,54 +24,43 @@ domain=$YNH_APP_ARG_DOMAIN
path_url=$YNH_APP_ARG_PATH path_url=$YNH_APP_ARG_PATH
is_public=$YNH_APP_ARG_IS_PUBLIC is_public=$YNH_APP_ARG_IS_PUBLIC
# 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 app=$YNH_APP_INSTANCE_NAME
#================================================= #=================================================
# CHECK IF THE APP CAN BE INSTALLED WITH THESE ARGS # CHECK IF THE APP CAN BE INSTALLED WITH THESE ARGS
#================================================= #=================================================
ynh_script_progression --message="Validating installation parameters..." --weight=1
final_path=/var/www/$app final_path=/var/www/$app
test ! -e "$final_path" || ynh_die "This path already contains a folder" test ! -e "$final_path" || ynh_die --message="This path already contains a folder"
# Normalize the url path syntax
path_url=$(ynh_normalize_url_path $path_url)
# Check web path availability
ynh_webpath_available $domain $path_url
# Register (book) web path # Register (book) web path
ynh_webpath_register $app $domain $path_url ynh_webpath_register --app=$app --domain=$domain --path_url=$path_url
#================================================= #=================================================
# STORE SETTINGS FROM MANIFEST # STORE SETTINGS FROM MANIFEST
#================================================= #=================================================
ynh_script_progression --message="Storing installation settings..." --weight=1
ynh_app_setting_set $app domain $domain ynh_app_setting_set --app=$app --key=domain --value=$domain
ynh_app_setting_set $app path $path_url ynh_app_setting_set --app=$app --key=path --value=$path_url
ynh_app_setting_set $app is_public $is_public ynh_app_setting_set --app=$app --key=is_public --value=$is_public
#================================================= #=================================================
# STANDARD MODIFICATIONS # STANDARD MODIFICATIONS
#================================================= #=================================================
# DOWNLOAD, CHECK AND UNPACK SOURCE # DOWNLOAD, CHECK AND UNPACK SOURCE
#================================================= #=================================================
ynh_script_progression --message="Setting up source files..." --weight=2
ynh_app_setting_set $app final_path $final_path ynh_app_setting_set --app=$app --key=final_path --value=$final_path
# Download, check integrity, uncompress and patch the source from app.src # Download, check integrity, uncompress and patch the source from app.src
ynh_setup_source "$final_path" ynh_setup_source --dest_dir="$final_path"
#================================================= #=================================================
# NGINX CONFIGURATION # NGINX CONFIGURATION
#================================================= #=================================================
ynh_script_progression --message="Configuring nginx web server..." --weight=3
# Create a dedicated nginx config # Create a dedicated nginx config
ynh_add_nginx_config ynh_add_nginx_config
@ -88,20 +77,25 @@ chown -R www-data: $final_path
#================================================= #=================================================
# SETUP SSOWAT # SETUP SSOWAT
#================================================= #=================================================
ynh_script_progression --message="Configuring SSOwat..." --weight=2
if [ $is_public -eq 0 ] # Make app public if necessary or protect it
then # Remove the public access
ynh_app_setting_delete $app skipped_uris
fi
# Make app public if necessary
if [ $is_public -eq 1 ] if [ $is_public -eq 1 ]
then then
# unprotected_uris allows SSO credentials to be passed anyway. # Everyone can access the app.
ynh_app_setting_set $app unprotected_uris "/" # The "main" permission is automatically created before the install script.
ynh_permission_update --permission "main" --add "visitors"
fi fi
#================================================= #=================================================
# RELOAD NGINX # RELOAD NGINX
#================================================= #=================================================
ynh_script_progression --message="Reloading nginx web server..." --weight=1
systemctl reload nginx ynh_systemd_action --service_name=nginx --action=reload
#=================================================
# END OF SCRIPT
#=================================================
ynh_script_progression --message="Installation of $app completed" --last

View file

@ -12,18 +12,22 @@ source /usr/share/yunohost/helpers
#================================================= #=================================================
# LOAD SETTINGS # LOAD SETTINGS
#================================================= #=================================================
ynh_script_progression --message="Loading installation settings..." --weight=1
app=$YNH_APP_INSTANCE_NAME app=$YNH_APP_INSTANCE_NAME
domain=$(ynh_app_setting_get $app domain) domain=$(ynh_app_setting_get --app=$app --key=domain)
port=$(ynh_app_setting_get $app port) final_path=$(ynh_app_setting_get --app=$app --key=final_path)
final_path=$(ynh_app_setting_get $app final_path)
#port=$(ynh_app_setting_get $app port)
#================================================= #=================================================
# STANDARD REMOVE # STANDARD REMOVE
#================================================= #=================================================
# REMOVE APP MAIN DIR # REMOVE APP MAIN DIR
#================================================= #=================================================
ynh_script_progression --message="Removing app main directory..." --weight=2
# Remove the app directory securely # Remove the app directory securely
ynh_secure_remove "$final_path" ynh_secure_remove "$final_path"
@ -31,6 +35,13 @@ ynh_secure_remove "$final_path"
#================================================= #=================================================
# REMOVE NGINX CONFIGURATION # REMOVE NGINX CONFIGURATION
#================================================= #=================================================
ynh_script_progression --message="Removing nginx web server configuration..." --weight=1
# Remove the dedicated nginx config # Remove the dedicated nginx config
ynh_remove_nginx_config ynh_remove_nginx_config
#=================================================
# END OF SCRIPT
#=================================================
ynh_script_progression --message="Removal of $app completed" --last

View file

@ -6,12 +6,8 @@
# IMPORT GENERIC HELPERS # IMPORT GENERIC HELPERS
#================================================= #=================================================
if [ ! -e _common.sh ]; then #Keep this path for calling _common.sh inside the execution's context of backup and restore scripts
# Get the _common.sh file if it's not in the current directory source ../settings/scripts/_common.sh
cp ../settings/scripts/_common.sh ./_common.sh
chmod a+rx _common.sh
fi
source _common.sh
source /usr/share/yunohost/helpers source /usr/share/yunohost/helpers
#================================================= #=================================================
@ -24,22 +20,23 @@ ynh_abort_if_errors
#================================================= #=================================================
# LOAD SETTINGS # LOAD SETTINGS
#================================================= #=================================================
ynh_script_progression --message="Loading installation settings..." --weight=1
app=$YNH_APP_INSTANCE_NAME app=$YNH_APP_INSTANCE_NAME
domain=$(ynh_app_setting_get $app domain) domain=$(ynh_app_setting_get --app=$app --key=domain)
path_url=$(ynh_app_setting_get $app path) path_url=$(ynh_app_setting_get --app=$app --key=path)
final_path=$(ynh_app_setting_get $app final_path) final_path=$(ynh_app_setting_get --app=$app --key=final_path)
db_name=$(ynh_app_setting_get $app db_name)
#================================================= #=================================================
# CHECK IF THE APP CAN BE RESTORED # CHECK IF THE APP CAN BE RESTORED
#================================================= #=================================================
ynh_script_progression --message="Validating restoration parameters..." --weight=1
ynh_webpath_available $domain $path_url \ ynh_webpath_available --domain=$domain --path_url=$path_url \
|| ynh_die "Path not available: ${domain}${path_url}" || ynh_die --message="Path not available: ${domain}${path_url}"
test ! -d $final_path \ test ! -d $final_path \
|| ynh_die "There is already a directory: $final_path " || ynh_die --message="There is already a directory: $final_path "
#================================================= #=================================================
# STANDARD RESTORATION STEPS # STANDARD RESTORATION STEPS
@ -52,8 +49,13 @@ ynh_restore_file "/etc/nginx/conf.d/$domain.d/$app.conf"
#================================================= #=================================================
# RESTORE THE APP MAIN DIR # RESTORE THE APP MAIN DIR
#================================================= #=================================================
ynh_script_progression --message="Restoring the app main directory..." --weight=3
ynh_restore_file "$final_path" ynh_restore_file --origin_path="$final_path"
#=================================================
# RESTORE USER RIGHTS
#=================================================
# Restore permissions on app files # Restore permissions on app files
chown -R www-data: $final_path chown -R www-data: $final_path
@ -63,5 +65,12 @@ chown -R www-data: $final_path
#================================================= #=================================================
# RELOAD NGINX # RELOAD NGINX
#================================================= #=================================================
ynh_script_progression --message="Reloading nginx web server..." --weight=1
systemctl reload nginx ynh_systemd_action --service_name=nginx --action=reload
#=================================================
# END OF SCRIPT
#=================================================
ynh_script_progression --message="Restoration completed for $app" --last

View file

@ -12,20 +12,25 @@ source /usr/share/yunohost/helpers
#================================================= #=================================================
# LOAD SETTINGS # LOAD SETTINGS
#================================================= #=================================================
ynh_script_progression --message="Loading installation settings..." --weight=1
app=$YNH_APP_INSTANCE_NAME app=$YNH_APP_INSTANCE_NAME
domain=$(ynh_app_setting_get $app domain) domain=$(ynh_app_setting_get --app=$app --key=domain)
path_url=$(ynh_app_setting_get $app path) path_url=$(ynh_app_setting_get --app=$app --key=path)
admin=$(ynh_app_setting_get $app admin) is_public=$(ynh_app_setting_get --app=$app --key=is_public)
is_public=$(ynh_app_setting_get $app is_public) final_path=$(ynh_app_setting_get --app=$app --key=final_path)
final_path=$(ynh_app_setting_get $app final_path)
port=$(ynh_app_setting_get $app port) #=================================================
db_name=$(ynh_app_setting_get $app db_name) # CHECK VERSION
#=================================================
upgrade_type=$(ynh_check_app_version_changed)
#================================================= #=================================================
# ENSURE DOWNWARD COMPATIBILITY # ENSURE DOWNWARD COMPATIBILITY
#================================================= #=================================================
ynh_script_progression --message="Ensuring downward compatibility..." --weight=1
# Fix is_public as a boolean value # Fix is_public as a boolean value
if [ "$is_public" = "Yes" ]; then if [ "$is_public" = "Yes" ]; then
@ -68,12 +73,18 @@ path_url=$(ynh_normalize_url_path $path_url)
# DOWNLOAD, CHECK AND UNPACK SOURCE # DOWNLOAD, CHECK AND UNPACK SOURCE
#================================================= #=================================================
# Download, check integrity, uncompress and patch the source from app.src if [ "$upgrade_type" == "UPGRADE_APP" ]
ynh_setup_source "$final_path" then
ynh_script_progression --message="Upgrading source files..." --weight=3
# Download, check integrity, uncompress and patch the source from app.src
ynh_setup_source --dest_dir="$final_path"
fi
#================================================= #=================================================
# NGINX CONFIGURATION # NGINX CONFIGURATION
#================================================= #=================================================
ynh_script_progression --message="Upgrading nginx web server configuration..." --weight=1
# Create a dedicated nginx config # Create a dedicated nginx config
ynh_add_nginx_config ynh_add_nginx_config
@ -87,23 +98,15 @@ ynh_add_nginx_config
# Set right permissions for curl installation # Set right permissions for curl installation
chown -R www-data: $final_path chown -R www-data: $final_path
#=================================================
# SETUP SSOWAT
#=================================================
if [ $is_public -eq 0 ]
then # Remove the public access
ynh_app_setting_delete $app skipped_uris
fi
# 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 # RELOAD NGINX
#================================================= #=================================================
ynh_script_progression --message="Reloading nginx web server..." --weight=1
systemctl reload nginx ynh_systemd_action --service_name=nginx --action=reload
#=================================================
# END OF SCRIPT
#=================================================
ynh_script_progression --message="Upgrade of $app completed" --last

BIN
sources/WemaWema.png Normal file

Binary file not shown.

After

Width:  |  Height:  |  Size: 111 KiB

View file

@ -1,2 +0,0 @@
*~
*.sw[op]

View file

@ -1,2 +0,0 @@
*~
*.sw[op]