1
0
Fork 0
mirror of https://github.com/YunoHost-Apps/icecoder_ynh.git synced 2024-09-03 19:26:10 +02:00

Merge pull request #33 from YunoHost-Apps/example

Apply example_ynh
This commit is contained in:
yalh76 2022-03-28 19:49:41 +02:00 committed by GitHub
commit cb10eeb8c5
No known key found for this signature in database
GPG key ID: 4AEE18F83AFDEB23
20 changed files with 147 additions and 331 deletions

View file

@ -8,7 +8,7 @@ about: When creating a bug report, please use the following template to provide
1. *Read this whole template first.* 1. *Read this whole template first.*
2. *Determine if you are on the right place:* 2. *Determine if you are on the right place:*
- *If you were performing an action on the app from the webadmin or the CLI (install, update, backup, restore, change_url...), you are on the right place!* - *If you were performing an action on the app from the webadmin or the CLI (install, update, backup, restore, change_url...), you are on the right place!*
- *Otherwise, the issue may be due to ICEcoder itself. Refer to its documentation or repository for help.* - *Otherwise, the issue may be due to the app itself. Refer to its documentation or repository for help.*
- *When in doubt, post here and we will figure it out together.* - *When in doubt, post here and we will figure it out together.*
3. *Delete the italic comments as you write over them below, and remove this guide.* 3. *Delete the italic comments as you write over them below, and remove this guide.*
--- ---
@ -31,7 +31,7 @@ about: When creating a bug report, please use the following template to provide
- *If you performed a command from the CLI, the command itself is enough. For example:* - *If you performed a command from the CLI, the command itself is enough. For example:*
```sh ```sh
sudo yunohost app install icecoder sudo yunohost app install the_app
``` ```
- *If you used the webadmin, please perform the equivalent command from the CLI first.* - *If you used the webadmin, please perform the equivalent command from the CLI first.*
- *If the error occurs in your browser, explain what you did:* - *If the error occurs in your browser, explain what you did:*

16
.github/PULL_REQUEST_TEMPLATE.md vendored Normal file
View file

@ -0,0 +1,16 @@
## Problem
- *Description of why you made this PR*
## Solution
- *And how do you fix that problem*
## PR Status
- [ ] Code finished and ready to be reviewed/tested
- [ ] The fix/enhancement were manually tested (if applicable)
## Automatic tests
Automatic tests can be triggered on https://ci-apps-dev.yunohost.org/ *after creating the PR*, by commenting "!testme", "!gogogadgetoci" or "By the power of systemd, I invoke The Great App CI to test this Pull Request!". (N.B. : for this to work you need to be a member of the Yunohost-Apps organization)

2
.gitignore vendored
View file

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

View file

@ -1,3 +1,8 @@
<!--
N.B.: This README was automatically generated by https://github.com/YunoHost/apps/tree/master/tools/README-generator
It shall NOT be edited by hand.
-->
# ICEcoder for YunoHost # ICEcoder for YunoHost
[![Integration level](https://dash.yunohost.org/integration/icecoder.svg)](https://dash.yunohost.org/appci/app/icecoder) ![](https://ci-apps.yunohost.org/ci/badges/icecoder.status.svg) ![](https://ci-apps.yunohost.org/ci/badges/icecoder.maintain.svg) [![Integration level](https://dash.yunohost.org/integration/icecoder.svg)](https://dash.yunohost.org/appci/app/icecoder) ![](https://ci-apps.yunohost.org/ci/badges/icecoder.status.svg) ![](https://ci-apps.yunohost.org/ci/badges/icecoder.maintain.svg)
@ -5,38 +10,20 @@
*[Lire ce readme en français.](./README_fr.md)* *[Lire ce readme en français.](./README_fr.md)*
> *This package allows you to install ICEcoder quickly and simply on a YunoHost server. > *This package allows you to install ICEcoder 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.* If you don't have YunoHost, please consult [the guide](https://yunohost.org/#/install) to learn how to install it.*
## Overview ## Overview
A code editor in your browser. A code editor in your browser.
**Shipped version:** 8.0
## Demo
http://demo.icecoder.net/ICEcoder/ **Shipped version:** 8.1~ynh1
## Configuration **Demo:** http://demo.icecoder.net/ICEcoder/
How to configure this app: From ICEcoder options screen. ## Disclaimers / important information
## Documentation
* Official documentation: https://icecoder.net/manual
* 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 (It is internal to the app).
#### Supported architectures
* x86-64 - [![Build Status](https://ci-apps.yunohost.org/ci/logs/icecoder%20%28Apps%29.svg)](https://ci-apps.yunohost.org/ci/apps/icecoder/)
* ARMv8-A - [![Build Status](https://ci-apps-arm.yunohost.org/ci/logs/icecoder%20%28Apps%29.svg)](https://ci-apps-arm.yunohost.org/ci/apps/icecoder/)
## Limitations ## Limitations
@ -47,14 +34,13 @@ How to configure this app: From ICEcoder options screen.
* You will need to configure things like password **directly** in the app. * You will need to configure things like password **directly** in the app.
* If you change the URL of this app, you don't change the real URL but the internal path (the process is the same as installation). * If you change the URL of this app, you don't change the real URL but the internal path (the process is the same as installation).
## Links ## Documentation and resources
* Report a bug: https://github.com/YunoHost-Apps/icecoder_ynh/issues * Official app website: https://icecoder.net
* App website: https://icecoder.net/ * Official admin documentation: https://icecoder.net/manual
* Upstream app repository: https://github.com/icecoder/ICEcoder * Upstream app code repository: https://github.com/icecoder/ICEcoder
* YunoHost website: https://yunohost.org/ * YunoHost documentation for this app: https://yunohost.org/app_icecoder
* Report a bug: https://github.com/YunoHost-Apps/icecoder_ynh/issues
---
## Developer info ## Developer info
@ -66,3 +52,5 @@ sudo yunohost app install https://github.com/YunoHost-Apps/icecoder_ynh/tree/tes
or or
sudo yunohost app upgrade icecoder -u https://github.com/YunoHost-Apps/icecoder_ynh/tree/testing --debug sudo yunohost app upgrade icecoder -u https://github.com/YunoHost-Apps/icecoder_ynh/tree/testing --debug
``` ```
**More info regarding app packaging:** https://yunohost.org/packaging_apps

View file

@ -3,40 +3,22 @@
[![Niveau d'intégration](https://dash.yunohost.org/integration/icecoder.svg)](https://dash.yunohost.org/appci/app/icecoder) ![](https://ci-apps.yunohost.org/ci/badges/icecoder.status.svg) ![](https://ci-apps.yunohost.org/ci/badges/icecoder.maintain.svg) [![Niveau d'intégration](https://dash.yunohost.org/integration/icecoder.svg)](https://dash.yunohost.org/appci/app/icecoder) ![](https://ci-apps.yunohost.org/ci/badges/icecoder.status.svg) ![](https://ci-apps.yunohost.org/ci/badges/icecoder.maintain.svg)
[![Installer ICEcoder avec YunoHost](https://install-app.yunohost.org/install-with-yunohost.svg)](https://install-app.yunohost.org/?app=icecoder) [![Installer ICEcoder avec YunoHost](https://install-app.yunohost.org/install-with-yunohost.svg)](https://install-app.yunohost.org/?app=icecoder)
*[Read this readme in english.](./README.md)* *[Read this readme in english.](./README.md)*
*[Lire ce readme en français.](./README_fr.md)*
> *Ce package vous permet d'installer ICEcoder rapidement et simplement sur un serveur YunoHost. > *Ce package vous permet d'installer ICEcoder 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.* Si vous n'avez pas YunoHost, regardez [ici](https://yunohost.org/#/install) pour savoir comment l'installer et en profiter.*
## Vue d'ensemble ## Vue d'ensemble
Un éditeur de code dans votre navigateur. Un éditeur de code dans votre navigateur.
**Version incluse :** 8.0
## Démo **Version incluse :** 8.1~ynh1
* http://demo.icecoder.net/ICEcoder/ **Démo :** http://demo.icecoder.net/ICEcoder/
## Configuration ## Avertissements / informations importantes
Comment configurer cette app: Depuis l'écran des options d'ICEcoder
## Documentation
* Documentation officielle: https://icecoder.net/manual
* Documentation YunoHost : Si une documentation spécifique est nécessaire, n'hésitez pas à contribuer.
## Caractéristiques spécifiques YunoHost
#### Support multi-utilisateurs
* L'authentification LDAP et HTTP est-elle prise en charge ? Non.
* L'application peut-elle être utilisée par plusieurs utilisateurs ? Non (c'est interne à l'app).
#### Architectures supportées
* x86-64 - [![Build Status](https://ci-apps.yunohost.org/ci/logs/icecoder%20%28Apps%29.svg)](https://ci-apps.yunohost.org/ci/apps/icecoder/)
* ARMv8-A - [![Build Status](https://ci-apps-arm.yunohost.org/ci/logs/icecoder%20%28Apps%29.svg)](https://ci-apps-arm.yunohost.org/ci/apps/icecoder/)
## Limitations ## Limitations
@ -47,14 +29,13 @@ Comment configurer cette app: Depuis l'écran des options d'ICEcoder
* Vous devrez configurer des éléments comme le mot de passe **directement** dans l'application. * Vous devrez configurer des éléments comme le mot de passe **directement** dans l'application.
* Si vous changez l'URL de cette application, vous ne changez pas l'URL réelle mais le chemin interne (le processus est le même que pour l'installation). * Si vous changez l'URL de cette application, vous ne changez pas l'URL réelle mais le chemin interne (le processus est le même que pour l'installation).
## Liens ## Documentations et ressources
* Signaler un bug : https://github.com/YunoHost-Apps/icecoder_ynh/issues * Site officiel de l'app : https://icecoder.net
* Site de l'application : https://icecoder.net * Documentation officielle de l'admin : https://icecoder.net/manual
* Dépôt de l'application principale : https://github.com/icecoder/ICEcoder * Dépôt de code officiel de l'app : https://github.com/icecoder/ICEcoder
* Site web YunoHost : https://yunohost.org/ * Documentation YunoHost pour cette app : https://yunohost.org/app_icecoder
* Signaler un bug : https://github.com/YunoHost-Apps/icecoder_ynh/issues
---
## Informations pour les développeurs ## Informations pour les développeurs
@ -66,3 +47,5 @@ sudo yunohost app install https://github.com/YunoHost-Apps/icecoder_ynh/tree/tes
ou ou
sudo yunohost app upgrade icecoder -u https://github.com/YunoHost-Apps/icecoder_ynh/tree/testing --debug sudo yunohost app upgrade icecoder -u https://github.com/YunoHost-Apps/icecoder_ynh/tree/testing --debug
``` ```
**Plus d'infos sur le packaging d'applications :** https://yunohost.org/packaging_apps

View file

@ -1,18 +1,24 @@
;; Test complet ;; Test complet
; pre-install ; pre-install
sudo yunohost app install my_webapp -a domain=domain.tld&path=/site&admin=john&is_public=1&password=pass sudo yunohost app install my_webapp -a "domain=domain.tld&path=/path&with_sftp=1&password=myreallystrengthpassword&is_public=1&phpversion=7.3&with_mysql=1"
; Manifest ; Manifest
domain="domain.tld" (DOMAIN) app_id="my_webapp"
app_id="my_webapp" (APP_ID) sub_folder="/www"
domain="domain.tld"
path="/icecoder"
; Checks ; Checks
pkg_linter=1 pkg_linter=1
setup_sub_dir=0 setup_sub_dir=1
setup_root=1 setup_root=0
setup_nourl=0 setup_nourl=0
setup_private=0 setup_private=0
setup_public=0 setup_public=0
upgrade=1 upgrade=1
# upgrade=1 from_commit=CommitHash
backup_restore=1 backup_restore=1
multi_instance=0 multi_instance=0
port_already_use=0 port_already_use=0
change_url=1 change_url=1
;;; Options
Email=
Notification=none

0
doc/.gitkeep Normal file
View file

2
doc/DESCRIPTION.md Normal file
View file

@ -0,0 +1,2 @@
A code editor in your browser.

1
doc/DESCRIPTION_fr.md Normal file
View file

@ -0,0 +1 @@
Un éditeur de code dans votre navigateur.

8
doc/DISCLAIMER.md Normal file
View file

@ -0,0 +1,8 @@
## Limitations
* If the editor's current folder is where the editor is, the editor's folder is visible in the file tree.
## Additional information
* You will need to configure things like password **directly** in the app.
* If you change the URL of this app, you don't change the real URL but the internal path (the process is the same as installation).

8
doc/DISCLAIMER_fr.md Normal file
View file

@ -0,0 +1,8 @@
## Limitations
* Si le dossier actuel de l'éditeur se trouve là où se trouve l'éditeur, le dossier de l'éditeur est visible dans l'arbre des fichiers.
## Informations additionnelles
* Vous devrez configurer des éléments comme le mot de passe **directement** dans l'application.
* Si vous changez l'URL de cette application, vous ne changez pas l'URL réelle mais le chemin interne (le processus est le même que pour l'installation).

0
doc/screenshots/.gitkeep Normal file
View file

View file

@ -8,13 +8,20 @@
}, },
"version": "8.1~ynh1", "version": "8.1~ynh1",
"url": "https://icecoder.net", "url": "https://icecoder.net",
"upstream": {
"license": "AGPL-3.0-only",
"website": "https://icecoder.net",
"demo": "http://demo.icecoder.net/ICEcoder/",
"admindoc": "https://icecoder.net/manual",
"code": "https://github.com/icecoder/ICEcoder"
},
"license": "AGPL-3.0-only", "license": "AGPL-3.0-only",
"maintainer": { "maintainer": {
"name": "Stylix58", "name": "Stylix58",
"email": "lateman-jpeg@outlook.fr" "email": "lateman-jpeg@outlook.fr"
}, },
"requirements": { "requirements": {
"yunohost": ">= 4.1.3" "yunohost": ">= 4.3.0"
}, },
"multi_instance": true, "multi_instance": true,
"services": [ "services": [
@ -22,7 +29,7 @@
"php7.3-fpm" "php7.3-fpm"
], ],
"arguments": { "arguments": {
"install" : [ "install": [
{ {
"name": "app_id", "name": "app_id",
"type": "string", "type": "string",
@ -34,6 +41,19 @@
"en": "You can get the ID in Custom Webapp's settings.", "en": "You can get the ID in Custom Webapp's settings.",
"fr": "Vous pouvez obtenir l'ID dans les paramètres de la Custom Webapp." "fr": "Vous pouvez obtenir l'ID dans les paramètres de la Custom Webapp."
} }
},
{
"name": "sub_folder",
"type": "path",
"ask": {
"en": "Indicate the name of the final_path subfolder containing the files accessible from your browser",
"fr": "Indiquer le nom du sous-dossier du final_path contenant les fichiers accessibles depuis votre navigateur"
},
"help": {
"en": "For example for Custom Webapp it is located in the /www subfolder.",
"fr": "Par exemple pour Custom Webapp il se situe dans le sous-dossier /www."
},
"default": "/www"
} }
] ]
} }

View file

@ -1,16 +0,0 @@
## 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
---
* An automatic package_check will be launch at https://ci-apps-dev.yunohost.org/, when you add a specific comment to your Pull Request: "!testme", "!gogogadgetoci" or "By the power of systemd, I invoke The Great App CI to test this Pull Request!"* (You can only do this with an opened Pull Request)

View file

@ -25,19 +25,12 @@ ynh_print_info --message="Loading installation settings..."
app=$YNH_APP_INSTANCE_NAME app=$YNH_APP_INSTANCE_NAME
final_path=$(ynh_app_setting_get --app=$app --key=final_path) final_path=$(ynh_app_setting_get --app=$app --key=final_path)
domain=$(ynh_app_setting_get --app=$app --key=domain)
phpversion=$(ynh_app_setting_get --app=$app --key=phpversion)
#================================================= #=================================================
# DECLARE DATA AND CONF FILES TO BACKUP # DECLARE DATA AND CONF FILES TO BACKUP
#================================================= #=================================================
ynh_print_info --message="Declaring files to be backed up..." ynh_print_info --message="Declaring files to be backed up..."
### N.B. : the following 'ynh_backup' calls are only a *declaration* of what needs
### to be backuped and not an actual copy of any file. The actual backup that
### creates and fill the archive with the files happens in the core after this
### script is called. Hence ynh_backups calls takes basically 0 seconds to run.
#================================================= #=================================================
# BACKUP THE APP MAIN DIR # BACKUP THE APP MAIN DIR
#================================================= #=================================================

View file

@ -1,80 +0,0 @@
#!/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
#=================================================
ynh_script_progression --message="Loading installation settings..." --weight=1
# Needed for helper "ynh_add_nginx_config"
final_path=$(ynh_app_setting_get --app=$app --key=final_path)
# Add settings here as needed by your application
#db_name=$(ynh_app_setting_get --app=$app --key=db_name)
#db_user=$db_name
#db_pwd=$(ynh_app_setting_get --app=$app --key=db_pwd)
#=================================================
# BACKUP BEFORE UPGRADE THEN ACTIVE TRAP
#=================================================
ynh_script_progression --message="Backing up the app before changing its URL (may take a while)..." --weight=1
# 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
#=================================================
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
#=================================================
# SPECIFIC MODIFICATIONS
#=================================================
# TODO: really automatize permissiosn system
#=================================================
#=================================================
# END OF SCRIPT
#=================================================
ynh_script_progression --message="Change of URL completed for $app" --last

View file

@ -21,94 +21,44 @@ ynh_abort_if_errors
#================================================= #=================================================
app_id=$YNH_APP_ARG_APP_ID app_id=$YNH_APP_ARG_APP_ID
path_url="/in-$app_id-folder" sub_folder=$YNH_APP_ARG_SUB_FOLDER
### 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 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
#================================================= #=================================================
### About --weight and --time ynh_script_progression --message="Validating installation parameters..."
### ynh_script_progression will show to your final users the progression of each scripts.
### In order to do that, --weight will represent the relative time of execution compared to the other steps in the script.
### --time is a packager option, it will show you the execution time since the previous call.
### This option should be removed before releasing your app.
### Use the execution time, given by --time, to estimate the weight of a step.
### A common way to do it is to set a weight equal to the execution time in second +1.
### The execution time is given for the duration since the previous call. So the weight should be applied to this previous call.
ynh_script_progression --message="Validating installation parameters..." --weight=1
### If the app uses NGINX as web server (written in HTML/PHP in most cases), the final path should be "/var/www/$app". final_path=$(ynh_app_setting_get --app=$app_id --key=final_path)$sub_folder/icecoder
### If the app provides an internal web server (or uses another application server such as uWSGI), the final path should be "/opt/yunohost/$app" test -e "$(ynh_app_setting_get --app=$app_id --key=final_path)" || ynh_die --message="You don't have installed $app_id before installing this app"
final_path=/var/www/$YNH_APP_ARG_APP_ID/www/icecoder
#test ! -e "/var/www/$YNH_APP_ARG_APP_ID/icecoder" || ynh_die --message="You have already installed a app instance here before install this app instance"
test -e "/var/www/$YNH_APP_ARG_APP_ID" || ynh_die --message="You don't have installed a webapp before install this app"
test ! -e "$final_path" || ynh_die --message="This path already contains a folder" test ! -e "$final_path" || ynh_die --message="This path already contains a folder"
#================================================= #=================================================
# STORE SETTINGS FROM MANIFEST # STORE SETTINGS FROM MANIFEST
#================================================= #=================================================
ynh_script_progression --message="Storing installation settings..." --weight=1 ynh_script_progression --message="Storing installation settings..."
ynh_app_setting_set --app=$app --key=domain --value=none.ynh.fr
ynh_app_setting_set --app=$app --key=path --value=$path_url
ynh_app_setting_set --app=$app --key=app_id --value=$app_id ynh_app_setting_set --app=$app --key=app_id --value=$app_id
ynh_app_setting_set --app=$app --key=sub_folder --value=$sub_folder
#================================================= #=================================================
# DOWNLOAD, CHECK AND UNPACK SOURCE # DOWNLOAD, CHECK AND UNPACK SOURCE
#================================================= #=================================================
ynh_script_progression --message="Setting up source files..." --weight=1 ynh_script_progression --message="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=$app --key=final_path --value=$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 --dest_dir="$final_path" ynh_setup_source --dest_dir="$final_path"
chmod 750 "$final_path"
chmod -R o-rwx "$final_path"
chown -R $app_id:www-data "$final_path"
#================================================= #=================================================
# GENERIC FINALIZATION # 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 $YNH_APP_ARG_APP_ID $final_path
#=================================================
# SETUP LOGROTATE
#=================================================
ynh_script_progression --message="Configuring log rotation..." --weight=1
### `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
#================================================= #=================================================
# END OF SCRIPT # END OF SCRIPT
#================================================= #=================================================
ynh_script_progression --message="Installation of $app completed" --last ynh_script_progression --message="Installation of $app completed"

View file

@ -12,17 +12,18 @@ source /usr/share/yunohost/helpers
#================================================= #=================================================
# LOAD SETTINGS # LOAD SETTINGS
#================================================= #=================================================
ynh_script_progression --message="Loading installation settings..." --weight=1 ynh_script_progression --message="Loading installation settings..."
app=$YNH_APP_INSTANCE_NAME app=$YNH_APP_INSTANCE_NAME
domain=$(ynh_app_setting_get --app=$app --key=domain)
final_path=$(ynh_app_setting_get --app=$app --key=final_path) final_path=$(ynh_app_setting_get --app=$app --key=final_path)
#=================================================
# STANDARD REMOVE
#================================================= #=================================================
# REMOVE APP MAIN DIR # REMOVE APP MAIN DIR
#================================================= #=================================================
ynh_script_progression --message="Removing app main directory..." --weight=1 ynh_script_progression --message="Removing app main directory..."
# Remove the app directory securely # Remove the app directory securely
ynh_secure_remove --file="$final_path" ynh_secure_remove --file="$final_path"
@ -31,4 +32,4 @@ ynh_secure_remove --file="$final_path"
# END OF SCRIPT # END OF SCRIPT
#================================================= #=================================================
ynh_script_progression --message="Removal of $app completed" --last ynh_script_progression --message="Removal of $app completed"

View file

@ -20,51 +20,36 @@ ynh_abort_if_errors
#================================================= #=================================================
# LOAD SETTINGS # LOAD SETTINGS
#================================================= #=================================================
ynh_script_progression --message="Loading installation settings..." --weight=1 ynh_script_progression --message="Loading installation settings..."
app=$YNH_APP_INSTANCE_NAME app=$YNH_APP_INSTANCE_NAME
domain=$(ynh_app_setting_get --app=$app --key=domain)
path_url=$(ynh_app_setting_get --app=$app --key=path)
final_path=$(ynh_app_setting_get --app=$app --key=final_path) final_path=$(ynh_app_setting_get --app=$app --key=final_path)
app_id=$(ynh_app_setting_get --app=$app --key=app_id) app_id=$(ynh_app_setting_get --app=$app --key=app_id)
sub_folder=$(ynh_app_setting_get --app=$app --key=sub_folder)
#================================================= #=================================================
# CHECK IF THE APP CAN BE RESTORED # CHECK IF THE APP CAN BE RESTORED
#================================================= #=================================================
ynh_script_progression --message="Validating restoration parameters..." --weight=1 ynh_script_progression --message="Validating restoration parameters..."
#test ! -e "/var/www/$YNH_APP_ARG_APP_ID/icecoder" || ynh_die --message="You have already restored a app instance here before restore this app instance!" test -e "$(ynh_app_setting_get --app=$app_id --key=final_path)" || ynh_die --message="You don't have installed $app_id before installing this app"
test -e "/var/www/$YNH_APP_ARG_APP_ID" || ynh_die --message="You don't have installed a webapp before restore this app!" test ! -e "$final_path" || ynh_die --message="This path already contains a folder"
ynh_webpath_available --domain=$domain --path_url=$path_url \
|| ynh_die --message="Path not available: ${domain}${path_url}"
test ! -d $final_path \
|| ynh_die --message="There is already a directory: $final_path "
#================================================= #=================================================
# STANDARD RESTORATION STEPS # STANDARD RESTORATION STEPS
#=================================================
# RESTORE THE NGINX CONFIGURATION
#=================================================
ynh_restore_file --origin_path="/etc/nginx/conf.d/$domain.d/$app.conf"
#================================================= #=================================================
# RESTORE THE APP MAIN DIR # RESTORE THE APP MAIN DIR
#================================================= #=================================================
ynh_script_progression --message="Restoring the app main directory..." --weight=1 ynh_script_progression --message="Restoring the app main directory..."
ynh_restore_file --origin_path="$final_path" ynh_restore_file --origin_path="$final_path"
#================================================= chmod 750 "$final_path"
# RESTORE USER RIGHTS chmod -R o-rwx "$final_path"
#================================================= chown -R $app_id:www-data "$final_path"
chown -R $app_id $final_path
#================================================= #=================================================
# END OF SCRIPT # END OF SCRIPT
#================================================= #=================================================
ynh_script_progression --message="Restoration completed for $app" --last ynh_script_progression --message="Restoration completed for $app"

View file

@ -12,73 +12,24 @@ source /usr/share/yunohost/helpers
#================================================= #=================================================
# LOAD SETTINGS # LOAD SETTINGS
#================================================= #=================================================
ynh_script_progression --message="Loading installation settings..." --weight=1 ynh_script_progression --message="Loading installation settings..."
app=$YNH_APP_INSTANCE_NAME app=$YNH_APP_INSTANCE_NAME
domain=$(ynh_app_setting_get --app=$app --key=domain) app_id=$(ynh_app_setting_get --app=$app --key=app_id)
path_url=$(ynh_app_setting_get --app=$app --key=path)
final_path=$(ynh_app_setting_get --app=$app --key=final_path) final_path=$(ynh_app_setting_get --app=$app --key=final_path)
#================================================= #=================================================
# CHECK VERSION # CHECK VERSION
#================================================= #=================================================
ynh_script_progression --message="Checking version..."
### This helper will compare the version of the currently installed app and the version of the upstream package.
### $upgrade_type can have 2 different values
### - UPGRADEsome_config_file_APP if the upstream app version has changed
### - UPGRADE_PACKAGE if only the YunoHost package has changed
### ynh_check_app_version_changed will stop the upgrade if the app is up to date.
### UPGRADE_APP should be used to upgrade the core app only if there's an upgrade to do.
upgrade_type=$(ynh_check_app_version_changed) upgrade_type=$(ynh_check_app_version_changed)
#=================================================
# ENSURE DOWNWARD COMPATIBILITY
#=================================================
ynh_script_progression --message="Ensuring downward compatibility..." --weight=1
#
# N.B. : the followings setting migrations snippets are provided as *EXAMPLES*
# of what you may want to do in some cases (e.g. a setting was not defined on
# some legacy installs and you therefore want to initiaze stuff during upgrade)
#
# If db_name doesn't exist, create it
#if [ -z "$db_name" ]; then
# db_name=$(ynh_sanitize_dbid --db_name=$app)
# ynh_app_setting_set --app=$app --key=db_name --value=$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=$app --key=final_path --value=$final_path
#fi
### If nobody installed your app before 4.1,
### then you may safely remove these lines
# Cleaning legacy permissions
if ynh_legacy_permissions_exists; then
ynh_legacy_permissions_delete_all
ynh_app_setting_delete --app=$app --key=is_public
fi
if ! ynh_permission_exists --permission="admin"; then
# Create the required permissions
ynh_permission_create --permission="admin" --url="/admin" --allowed=$admin
fi
# Create a permission if needed
if ! ynh_permission_exists --permission="api"; then
ynh_permission_create --permission="api" --url "/api" --allowed="visitors" --show_tile="false" --protected="true"
fi
#================================================= #=================================================
# BACKUP BEFORE UPGRADE THEN ACTIVE TRAP # BACKUP BEFORE UPGRADE THEN ACTIVE TRAP
#================================================= #=================================================
ynh_script_progression --message="Backing up the app before upgrading (may take a while)..." --weight=1 ynh_script_progression --message="Backing up the app before upgrading (may take a while)..."
# Backup the current version of the app # Backup the current version of the app
ynh_backup_before_upgrade ynh_backup_before_upgrade
@ -89,29 +40,31 @@ ynh_clean_setup () {
# Exit if an error occurs during the execution of the script # Exit if an error occurs during the execution of the script
ynh_abort_if_errors ynh_abort_if_errors
#=================================================
# ENSURE DOWNWARD COMPATIBILITY
#=================================================
ynh_script_progression --message="Ensuring downward compatibility..."
#================================================= #=================================================
# DOWNLOAD, CHECK AND UNPACK SOURCE # DOWNLOAD, CHECK AND UNPACK SOURCE
#================================================= #=================================================
if [ "$upgrade_type" == "UPGRADE_APP" ] if [ "$upgrade_type" == "UPGRADE_APP" ]
then then
ynh_script_progression --message="Upgrading source files..." --weight=1 ynh_script_progression --message="Upgrading source files..."
# 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 --dest_dir="$final_path" ynh_setup_source --dest_dir="$final_path" --keep="/data"
fi fi
chmod 750 "$final_path"
chmod -R o-rwx "$final_path"
chown -R $app_id:www-data "$final_path"
#================================================= #=================================================
# GENERIC FINALIZATION # GENERIC FINALIZATION
#=================================================
# PERMISSIONS SETUP
#=================================================
# Configure internal permissions for ICEcoder
chown -R $app $final_path
#================================================= #=================================================
# END OF SCRIPT # END OF SCRIPT
#================================================= #=================================================
ynh_script_progression --message="Upgrade of $app completed" --last ynh_script_progression --message="Upgrade of $app completed"