uT&7XC1Y(YEk#EuCS=mLzW#4jMzS_TL
zP>b(ajzq(uZ1=n{_Xxxwj2l3dt?RB0dRvM_r_tp49u*e9#ZYNrknkiXRVceR!D_58
z*ZX(dQx5dg45NLTcy*y>}vUB&j(&6Zd
zLc6=8@dsC@=!dRf87q4WRf+jI2*gYjyWN#%qA?vk*7QXBT1397{-C1RqZ2uOrt3R>
zChATPtge;vQCW`@6bV{Mh(*Ozn}a@{U^v>2QBYZEW`6628*HN-1NUTe1#J4T(y@~Y$XbOJxwR(_!E`RGaGb77k
z^BU&Ujnn#*XQJs=NpPBEOkLjDE}*E11j&(NpXqDWZ+?<+-|wK8p6&4%BoW`XzsH%M
zJTO3}i;?!|%7v!yCSHhEvt`9=ny>`BJs{JeO()f3Yo{<%Wbt=Jrn(E{vCw@AD0<$}
zzLy1KdG0{A>GJ@4R-BjXjTuIGR^r`|p3+A_pOmc0
z{oMs8hraC@O-);sfRVo3)iv+G$pW&qJoVO<+_kXb;Ut`l<(7fmYnce_GGNzFAtyK@^ki
z`O4U}k_4&@-=_NU_&scm;{Wh!=R__oP&5310$vw;iClP{ba3`e5}3l(?^WpV9N%RA
zZx-L<>`J-|Y+^o{0Q<4n!~6BZG1#i-d)dAb|5Ce#$5P6{G6EXk5%>1DgKG}b9<;6o0(iGZ;Z4y2D6~Q*kQ`8G
zPw6rb+Tpp;GrZo2;bL~BZa$V-Ks)7zo0k>qqbG6s-2E)jEpk1|$v~T1Uz_fj>FK*f
zKrJ%f2`5Y?P!p#<_dD4>t?}x;CuDYvtD`06LL=RW2z}449$hV;T-0TZwRcYIP5?X*
zhiUQ|>Ce!RX~ht)8K~Splprnw_m3!46sP80q$P+==$sGcdHbN)`pW+ocZ5QDmo%wU
zlqOQRLHw;jKF(NhT=5yYs1-wfaU$;!i6>>)K^VxMH1na*SL3DNMH5n-HD##O{evQ=
zcMe%^F-f@g6UDCYmVm<4+g+C+Z4}mMl-$tTLtbs>tp_wA*c?w-hm|H|{@D(4eQL#s
zqbLY4-wLWjfmoFEy3XS6?)2P1@o-yOMSSF-_NO~1c}8!1V;lkhc$UE!TT;!>pF{ps
z3~a~4jd74^-#
z?r{M%ZW$
zi50Jh2>Vz4Mp#xr%tbH6nTp-X^ZE1%7u>n$0pV=D=6lCO0X9#pEp{`GOb-uM?`}Xr
zPK)1#Q^?5o4Wj01>;ZV_JF~gKOFO`VuDk`iBp!15u;Zw9N<-dw1vwFci4Gb!BT%e`
zU@lJ4uZ(OtQf|$BTew5X-?jPFQ3+yyP5$k`t(iy(v5ptedtbgbH4+n=!$)Ur0M|
zcnJpdNdxkC`aGEYIPfsi>F=*aQb37n{xLw0n4R31-V9I(yamnK90KPtgK1Z)c}LS@
z*mHM&O}DEpBj5@?Zby1xs$=JN^w@yr+RrpkU&q=^@!y=LGJfU2?!NmdeRXv}!$uT3
z$HV#zAYwqZ_<^`8-?tG&Q*pA@y|K_UfI--2BEUe=k4r=sj_~elTfiRz`_5j9IUsd&
zT=T^fs{BSyv#H0_FFy7^*dX5@Uk`VZ1uTDqy7-S`Dn)pchMLw#x2eYAQKN4(Ewx$r
z2h+CNt%YLjKDs5r>d8JGcP
z5NNzuW_c-N|I2ygYya)90k5TKV>Vap>aiNP*C|jD9LKrxHT}z
zi{Q_KgaxiQ1#SBTqh!(~;;AE~;P*>^21`{4=gbCBiv|Ytt@?YT&H`aTxMl~Pwb|&ji7ohj`oI?A5@P_dJ
paMBa-@0~xj-;qSs|Bwnmj4tE$%CO<}<^I1E3NotFRgxy({}(bKD-8eu
literal 0
HcmV?d00001
diff --git a/manifest.json b/manifest.json
new file mode 100644
index 0000000..b4a3d32
--- /dev/null
+++ b/manifest.json
@@ -0,0 +1,44 @@
+{
+ "name": "GitList",
+ "id": "gitlist",
+ "packaging_format": 1,
+ "description": {
+ "en": "Elegant and modern git repository viewer",
+ "fr": "Visualiseur de référentiel git élégant et moderne"
+ },
+ "version": "2.0.0~ynh1",
+ "url": "https://gitlist.org/",
+ "upstream": {
+ "license": "free",
+ "website": "https://gitlist.org/",
+ "demo": "https://demo.example.com",
+ "admindoc": "https://github.com/klaussilveira/gitlist/wiki",
+ "code": "https://github.com/klaussilveira/gitlist"
+ },
+ "license": "free",
+ "maintainer": {
+ "name": "",
+ "email": ""
+ },
+ "requirements": {
+ "yunohost": ">= 11.0.9"
+ },
+ "multi_instance": true,
+ "services": [
+ "nginx",
+ "php8.1-fpm"
+ ],
+ "arguments": {
+ "install": [
+ {
+ "name": "domain",
+ "type": "domain"
+ },
+ {
+ "name": "is_public",
+ "type": "boolean",
+ "default": true
+ }
+ ]
+ }
+}
diff --git a/scripts/_common.sh b/scripts/_common.sh
new file mode 100644
index 0000000..94e5b7a
--- /dev/null
+++ b/scripts/_common.sh
@@ -0,0 +1,26 @@
+#!/bin/bash
+
+#=================================================
+# COMMON VARIABLES
+#=================================================
+# PHP APP SPECIFIC
+#=================================================
+
+YNH_PHP_VERSION=8.1
+
+php_dependencies="php$YNH_PHP_VERSION-fpm"
+
+# dependencies used by the app (must be on a single line)
+pkg_dependencies="$php_dependencies"
+
+#=================================================
+# PERSONAL HELPERS
+#=================================================
+
+#=================================================
+# EXPERIMENTAL HELPERS
+#=================================================
+
+#=================================================
+# FUTURE OFFICIAL HELPERS
+#=================================================
diff --git a/scripts/backup b/scripts/backup
new file mode 100755
index 0000000..ff029f0
--- /dev/null
+++ b/scripts/backup
@@ -0,0 +1,69 @@
+#!/bin/bash
+
+#=================================================
+# GENERIC START
+#=================================================
+# IMPORT GENERIC HELPERS
+#=================================================
+
+# Keep this path for calling _common.sh inside the execution's context of backup and restore scripts
+source ../settings/scripts/_common.sh
+source /usr/share/yunohost/helpers
+
+#=================================================
+# 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
+#=================================================
+ynh_print_info --message="Loading installation settings..."
+
+app=$YNH_APP_INSTANCE_NAME
+
+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)
+datadir=$(ynh_app_setting_get --app=$app --key=datadir)
+
+#=================================================
+# DECLARE DATA AND CONF FILES TO BACKUP
+#=================================================
+ynh_print_info --message="Declaring files to be backed up..."
+
+#=================================================
+# BACKUP THE APP MAIN DIR
+#=================================================
+
+ynh_backup --src_path="$final_path"
+
+#=================================================
+# BACKUP THE DATA DIR
+#=================================================
+
+ynh_backup --src_path="$datadir" --is_big
+
+#=================================================
+# BACKUP THE NGINX CONFIGURATION
+#=================================================
+
+ynh_backup --src_path="/etc/nginx/conf.d/$domain.d/$app.conf"
+
+#=================================================
+# BACKUP THE PHP-FPM CONFIGURATION
+#=================================================
+
+ynh_backup --src_path="/etc/php/$phpversion/fpm/pool.d/$app.conf"
+
+#=================================================
+# END OF SCRIPT
+#=================================================
+
+ynh_print_info --message="Backup script completed for $app. (YunoHost will then actually copy those files to the archive)."
diff --git a/scripts/change_url b/scripts/change_url
new file mode 100644
index 0000000..322641b
--- /dev/null
+++ b/scripts/change_url
@@ -0,0 +1,134 @@
+#!/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 CHANGE URL 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
+
+#=================================================
+# STANDARD MODIFICATIONS
+#=================================================
+# STOP SYSTEMD SERVICE
+#=================================================
+ynh_script_progression --message="Stopping a systemd service..." --weight=1
+
+ynh_systemd_action --service_name=$app --action="stop" --log_path="/var/log/$app/$app.log"
+
+#=================================================
+# 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
+
+# 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 --file="$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 --file="$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 --file="/etc/nginx/conf.d/$new_domain.d/$app.conf"
+fi
+
+#=================================================
+# SPECIFIC MODIFICATIONS
+#=================================================
+# ...
+#=================================================
+
+#=================================================
+# GENERIC FINALISATION
+#=================================================
+# START SYSTEMD SERVICE
+#=================================================
+ynh_script_progression --message="Starting a systemd service..." --weight=1
+
+ynh_systemd_action --service_name=$app --action="start" --log_path="/var/log/$app/$app.log"
+
+#=================================================
+# RELOAD NGINX
+#=================================================
+ynh_script_progression --message="Reloading NGINX web server..." --weight=1
+
+ynh_systemd_action --service_name=nginx --action=reload
+
+#=================================================
+# END OF SCRIPT
+#=================================================
+
+ynh_script_progression --message="Change of URL completed for $app" --last
diff --git a/scripts/config b/scripts/config
new file mode 100644
index 0000000..91c2de7
--- /dev/null
+++ b/scripts/config
@@ -0,0 +1,95 @@
+#!/bin/bash
+
+#=================================================
+# GENERIC STARTING
+#=================================================
+# IMPORT GENERIC HELPERS
+#=================================================
+
+source _common.sh
+source /usr/share/yunohost/helpers
+
+ynh_abort_if_errors
+
+#=================================================
+# RETRIEVE ARGUMENTS
+#=================================================
+
+phpversion=$(ynh_app_setting_get --app=$app --key=phpversion)
+current_fpm_footprint=$(ynh_app_setting_get --app=$app --key=fpm_footprint)
+
+#=================================================
+# SPECIFIC GETTERS FOR TOML SHORT KEY
+#=================================================
+
+get__fpm_footprint() {
+ # Free footprint value for php-fpm
+ # Check if current_fpm_footprint is an integer
+ if [ "$current_fpm_footprint" -eq "$current_fpm_footprint" ] 2> /dev/null
+ then
+ echo "specific"
+ else
+ echo "$current_fpm_footprint"
+ fi
+}
+
+get__free_footprint() {
+ # Free footprint value for php-fpm
+ # Check if current_fpm_footprint is an integer
+ if [ "$current_fpm_footprint" -eq "$current_fpm_footprint" ] 2> /dev/null
+ then
+ # If current_fpm_footprint is an integer, that's a numeric value for the footprint
+ echo "$current_fpm_footprint"
+ else
+ echo "0"
+ fi
+}
+
+#=================================================
+# SPECIFIC SETTERS FOR TOML SHORT KEYS
+#=================================================
+
+set__fpm_footprint() {
+ if [ "$fpm_footprint" != "specific" ]
+ then
+ ynh_app_setting_set --app=$app --key=fpm_footprint --value="$fpm_footprint"
+ fi
+}
+
+set__fpm_free_footprint() {
+ if [ "$fpm_footprint" = "specific" ]
+ then
+ ynh_app_setting_set --app=$app --key=fpm_footprint --value="$fpm_free_footprint"
+ fi
+}
+
+#=================================================
+# GENERIC FINALIZATION
+#=================================================
+
+ynh_app_config_validate() {
+ _ynh_app_config_validate
+
+ if [ "${changed[fpm_usage]}" == "true" ] || [ "${changed[fpm_footprint]}" == "true" ] || [ "${changed[fpm_free_footprint]}" == "true" ]; then
+ # If fpm_footprint is set to 'specific', use $fpm_free_footprint value.
+ if [ "$fpm_footprint" = "specific" ]
+ then
+ fpm_footprint=$fpm_free_footprint
+ fi
+
+ if [ "$fpm_footprint" == "0" ]
+ then
+ ynh_print_err --message="When selecting 'specific', you have to set a footprint value into the field below."
+
+ exit 0
+ fi
+ fi
+}
+
+ynh_app_config_apply() {
+ _ynh_app_config_apply
+
+ ynh_add_fpm_config --phpversion=$phpversion --usage=$fpm_usage --footprint=$fpm_footprint
+}
+
+ynh_app_config_run $1
diff --git a/scripts/install b/scripts/install
new file mode 100755
index 0000000..df18f41
--- /dev/null
+++ b/scripts/install
@@ -0,0 +1,152 @@
+#!/bin/bash
+
+#=================================================
+# GENERIC START
+#=================================================
+# IMPORT GENERIC HELPERS
+#=================================================
+
+source _common.sh
+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
+
+#=================================================
+# RETRIEVE ARGUMENTS FROM THE MANIFEST
+#=================================================
+
+domain=$YNH_APP_ARG_DOMAIN
+path_url="/"
+is_public=$YNH_APP_ARG_IS_PUBLIC
+
+app=$YNH_APP_INSTANCE_NAME
+
+fpm_footprint="low"
+fpm_free_footprint=0
+fpm_usage="low"
+
+#=================================================
+# CHECK IF THE APP CAN BE INSTALLED WITH THESE ARGS
+#=================================================
+ynh_script_progression --message="Validating installation parameters..." --weight=1
+
+final_path=/var/www/$app
+test ! -e "$final_path" || ynh_die --message="This path already contains a folder"
+
+# Register (book) web path
+ynh_webpath_register --app=$app --domain=$domain --path_url=$path_url
+
+#=================================================
+# STORE SETTINGS FROM MANIFEST
+#=================================================
+ynh_script_progression --message="Storing installation settings..." --weight=1
+
+ynh_app_setting_set --app=$app --key=domain --value=$domain
+ynh_app_setting_set --app=$app --key=path --value=$path_url
+ynh_app_setting_set --app=$app --key=fpm_footprint --value=$fpm_footprint
+ynh_app_setting_set --app=$app --key=fpm_free_footprint --value=$fpm_free_footprint
+ynh_app_setting_set --app=$app --key=fpm_usage --value=$fpm_usage
+
+#=================================================
+# INSTALL DEPENDENCIES
+#=================================================
+ynh_script_progression --message="Installing dependencies..." --weight=1
+
+ynh_install_app_dependencies $pkg_dependencies
+
+#=================================================
+# CREATE DEDICATED USER
+#=================================================
+ynh_script_progression --message="Configuring system user..." --weight=1
+
+# Create a system user
+ynh_system_user_create --username=$app --home_dir="$final_path"
+
+#=================================================
+# DOWNLOAD, CHECK AND UNPACK SOURCE
+#=================================================
+ynh_script_progression --message="Setting up source files..." --weight=1
+
+ynh_app_setting_set --app=$app --key=final_path --value=$final_path
+# Download, check integrity, uncompress and patch the source from app.src
+ynh_setup_source --dest_dir="$final_path"
+
+chmod 750 "$final_path"
+chmod -R o-rwx "$final_path"
+chown -R $app:www-data "$final_path"
+
+#=================================================
+# PHP-FPM CONFIGURATION
+#=================================================
+ynh_script_progression --message="Configuring PHP-FPM..." --weight=1
+
+# Create a dedicated PHP-FPM config
+ynh_add_fpm_config --usage=$fpm_usage --footprint=$fpm_footprint
+phpversion=$(ynh_app_setting_get --app=$app --key=phpversion)
+
+#=================================================
+# CREATE DATA DIRECTORY
+#=================================================
+ynh_script_progression --message="Creating a data directory..." --weight=1
+
+datadir=/home/yunohost.app/$app
+ynh_app_setting_set --app=$app --key=datadir --value=$datadir
+
+mkdir -p $datadir
+
+chmod 750 "$datadir"
+chmod -R o-rwx "$datadir"
+chown -R $app:www-data "$datadir"
+
+#=================================================
+# NGINX CONFIGURATION
+#=================================================
+ynh_script_progression --message="Configuring NGINX web server..." --weight=1
+
+# Create a dedicated NGINX config
+ynh_add_nginx_config
+
+#=================================================
+# ADD A CONFIGURATION
+#=================================================
+ynh_script_progression --message="Adding a configuration file..." --weight=1
+
+ynh_add_config --template="../conf/config.yml" --destination="$final_path/config/config.yml"
+
+chmod 400 "$final_path/config/config.yml"
+chown $app:$app "$final_path/config/config.yml"
+
+#=================================================
+# SETUP SSOWAT
+#=================================================
+ynh_script_progression --message="Configuring permissions..." --weight=1
+
+# Make app public if necessary
+if [ $is_public -eq 1 ]
+then
+ # Everyone can access the app.
+ # The "main" permission is automatically created before the install script.
+ ynh_permission_update --permission="main" --add="visitors"
+fi
+
+#=================================================
+# RELOAD NGINX
+#=================================================
+ynh_script_progression --message="Reloading NGINX web server..." --weight=1
+
+ynh_systemd_action --service_name=nginx --action=reload
+
+#=================================================
+# END OF SCRIPT
+#=================================================
+
+ynh_script_progression --message="Installation of $app completed" --last
diff --git a/scripts/remove b/scripts/remove
new file mode 100755
index 0000000..fd9282e
--- /dev/null
+++ b/scripts/remove
@@ -0,0 +1,80 @@
+#!/bin/bash
+
+#=================================================
+# GENERIC START
+#=================================================
+# IMPORT GENERIC HELPERS
+#=================================================
+
+source _common.sh
+source /usr/share/yunohost/helpers
+
+#=================================================
+# LOAD SETTINGS
+#=================================================
+ynh_script_progression --message="Loading installation settings..." --weight=1
+
+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)
+datadir=$(ynh_app_setting_get --app=$app --key=datadir)
+
+#=================================================
+# REMOVE APP MAIN DIR
+#=================================================
+ynh_script_progression --message="Removing app main directory..." --weight=1
+
+# Remove the app directory securely
+ynh_secure_remove --file="$final_path"
+
+#=================================================
+# REMOVE DATA DIR
+#=================================================
+
+# Remove the data directory if --purge option is used
+if [ "${YNH_APP_PURGE:-0}" -eq 1 ]
+then
+ ynh_script_progression --message="Removing app data directory..." --weight=1
+ ynh_secure_remove --file="$datadir"
+fi
+
+#=================================================
+# REMOVE NGINX CONFIGURATION
+#=================================================
+ynh_script_progression --message="Removing NGINX web server configuration..." --weight=1
+
+# Remove the dedicated NGINX config
+ynh_remove_nginx_config
+
+#=================================================
+# REMOVE PHP-FPM CONFIGURATION
+#=================================================
+ynh_script_progression --message="Removing PHP-FPM configuration..." --weight=1
+
+# Remove the dedicated PHP-FPM config
+ynh_remove_fpm_config
+
+#=================================================
+# REMOVE DEPENDENCIES
+#=================================================
+ynh_script_progression --message="Removing dependencies..." --weight=1
+
+# Remove metapackage and its dependencies
+ynh_remove_app_dependencies
+
+#=================================================
+# GENERIC FINALIZATION
+#=================================================
+# REMOVE DEDICATED USER
+#=================================================
+ynh_script_progression --message="Removing the dedicated system user..." --weight=1
+
+# Delete a system user
+ynh_system_user_delete --username=$app
+
+#=================================================
+# END OF SCRIPT
+#=================================================
+
+ynh_script_progression --message="Removal of $app completed" --last
diff --git a/scripts/restore b/scripts/restore
new file mode 100755
index 0000000..96ba913
--- /dev/null
+++ b/scripts/restore
@@ -0,0 +1,123 @@
+#!/bin/bash
+
+#=================================================
+# GENERIC START
+#=================================================
+# IMPORT GENERIC HELPERS
+#=================================================
+
+# Keep this path for calling _common.sh inside the execution's context of backup and restore scripts
+source ../settings/scripts/_common.sh
+source /usr/share/yunohost/helpers
+
+#=================================================
+# 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
+#=================================================
+ynh_script_progression --message="Loading installation settings..." --weight=1
+
+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)
+phpversion=$(ynh_app_setting_get --app=$app --key=phpversion)
+datadir=$(ynh_app_setting_get --app=$app --key=datadir)
+
+fpm_footprint=$(ynh_app_setting_get --app=$app --key=fpm_footprint)
+fpm_usage=$(ynh_app_setting_get --app=$app --key=fpm_usage)
+
+#=================================================
+# CHECK IF THE APP CAN BE RESTORED
+#=================================================
+ynh_script_progression --message="Validating restoration parameters..." --weight=1
+
+test ! -d $final_path \
+ || ynh_die --message="There is already a directory: $final_path "
+
+#=================================================
+# STANDARD RESTORATION STEPS
+#=================================================
+# RECREATE THE DEDICATED USER
+#=================================================
+ynh_script_progression --message="Recreating the dedicated system user..." --weight=1
+
+# Create the dedicated user (if not existing)
+ynh_system_user_create --username=$app --home_dir="$final_path"
+
+#=================================================
+# RESTORE THE APP MAIN DIR
+#=================================================
+ynh_script_progression --message="Restoring the app main directory..." --weight=1
+
+ynh_restore_file --origin_path="$final_path"
+
+chmod 750 "$final_path"
+chmod -R o-rwx "$final_path"
+chown -R $app:www-data "$final_path"
+
+#=================================================
+# RESTORE THE DATA DIRECTORY
+#=================================================
+ynh_script_progression --message="Restoring the data directory..." --weight=1
+
+ynh_restore_file --origin_path="$datadir" --not_mandatory
+
+mkdir -p $datadir
+
+chmod 750 "$datadir"
+chmod -R o-rwx "$datadir"
+chown -R $app:www-data "$datadir"
+
+#=================================================
+# SPECIFIC RESTORATION
+#=================================================
+# REINSTALL DEPENDENCIES
+#=================================================
+ynh_script_progression --message="Reinstalling dependencies..." --weight=1
+
+# Define and install dependencies
+ynh_install_app_dependencies $pkg_dependencies
+
+#=================================================
+# RESTORE THE PHP-FPM CONFIGURATION
+#=================================================
+ynh_script_progression --message="Restoring the PHP-FPM configuration..." --time --weight=1
+
+ynh_restore_file --origin_path="/etc/php/$phpversion/fpm/pool.d/$app.conf"
+
+# Recreate a dedicated php-fpm config
+ynh_add_fpm_config --usage=$fpm_usage --footprint=$fpm_footprint --phpversion=$phpversion
+
+#=================================================
+# RESTORE THE NGINX CONFIGURATION
+#=================================================
+ynh_script_progression --message="Restoring the NGINX web server configuration..." --time --weight=1
+
+ynh_restore_file --origin_path="/etc/nginx/conf.d/$domain.d/$app.conf"
+
+#=================================================
+# GENERIC FINALIZATION
+#=================================================
+# RELOAD NGINX AND PHP-FPM
+#=================================================
+ynh_script_progression --message="Reloading NGINX web server and PHP-FPM..." --weight=1
+
+ynh_systemd_action --service_name=php$phpversion-fpm --action=reload
+ynh_systemd_action --service_name=nginx --action=reload
+
+#=================================================
+# END OF SCRIPT
+#=================================================
+
+ynh_script_progression --message="Restoration completed for $app" --last
diff --git a/scripts/upgrade b/scripts/upgrade
new file mode 100644
index 0000000..f7ba3d8
--- /dev/null
+++ b/scripts/upgrade
@@ -0,0 +1,145 @@
+#!/bin/bash
+
+#=================================================
+# GENERIC START
+#=================================================
+# IMPORT GENERIC HELPERS
+#=================================================
+
+source _common.sh
+source /usr/share/yunohost/helpers
+
+#=================================================
+# LOAD SETTINGS
+#=================================================
+ynh_script_progression --message="Loading installation settings..." --weight=1
+
+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)
+
+fpm_footprint=$(ynh_app_setting_get --app=$app --key=fpm_footprint)
+fpm_free_footprint=$(ynh_app_setting_get --app=$app --key=fpm_free_footprint)
+fpm_usage=$(ynh_app_setting_get --app=$app --key=fpm_usage)
+
+#=================================================
+# CHECK VERSION
+#=================================================
+
+upgrade_type=$(ynh_check_app_version_changed)
+
+#=================================================
+# BACKUP BEFORE UPGRADE THEN ACTIVE TRAP
+#=================================================
+ynh_script_progression --message="Backing up the app before upgrading (may take a while)..." --weight=1
+
+# Backup the current version of the app
+ynh_backup_before_upgrade
+ynh_clean_setup () {
+ # Restore it if the upgrade fails
+ ynh_restore_upgradebackup
+}
+# Exit if an error occurs during the execution of the script
+ynh_abort_if_errors
+
+#=================================================
+# ENSURE DOWNWARD COMPATIBILITY
+#=================================================
+ynh_script_progression --message="Ensuring downward compatibility..." --weight=1
+
+# If fpm_footprint doesn't exist, create it
+if [ -z "$fpm_footprint" ]; then
+ fpm_footprint=low
+ ynh_app_setting_set --app=$app --key=fpm_footprint --value=$fpm_footprint
+fi
+
+# If fpm_free_footprint doesn't exist, create it
+if [ -z "$fpm_free_footprint" ]; then
+ fpm_free_footprint=0
+ ynh_app_setting_set --app=$app --key=fpm_free_footprint --value=$fpm_free_footprint
+fi
+
+# If fpm_usage doesn't exist, create it
+if [ -z "$fpm_usage" ]; then
+ fpm_usage=low
+ ynh_app_setting_set --app=$app --key=fpm_usage --value=$fpm_usage
+fi
+
+# Cleaning legacy permissions
+if ynh_legacy_permissions_exists; then
+ ynh_legacy_permissions_delete_all
+
+ ynh_app_setting_delete --app=$app --key=is_public
+fi
+
+#=================================================
+# CREATE DEDICATED USER
+#=================================================
+ynh_script_progression --message="Making sure dedicated system user exists..." --weight=1
+
+# Create a dedicated user (if not existing)
+ynh_system_user_create --username=$app --home_dir="$final_path"
+
+#=================================================
+# DOWNLOAD, CHECK AND UNPACK SOURCE
+#=================================================
+
+if [ "$upgrade_type" == "UPGRADE_APP" ]
+then
+ ynh_script_progression --message="Upgrading source files..." --weight=1
+
+ # Download, check integrity, uncompress and patch the source from app.src
+ ynh_setup_source --dest_dir="$final_path"
+fi
+
+chmod 750 "$final_path"
+chmod -R o-rwx "$final_path"
+chown -R $app:www-data "$final_path"
+
+#=================================================
+# UPGRADE DEPENDENCIES
+#=================================================
+ynh_script_progression --message="Upgrading dependencies..." --weight=1
+
+ynh_install_app_dependencies $pkg_dependencies
+
+#=================================================
+# PHP-FPM CONFIGURATION
+#=================================================
+ynh_script_progression --message="Upgrading PHP-FPM configuration..." --weight=1
+
+# Create a dedicated PHP-FPM config
+ynh_add_fpm_config --phpversion=$phpversion --usage=$fpm_usage --footprint=$fpm_footprint
+phpversion=$(ynh_app_setting_get --app=$app --key=phpversion)
+
+#=================================================
+# NGINX CONFIGURATION
+#=================================================
+ynh_script_progression --message="Upgrading NGINX web server configuration..." --time --weight=1
+
+# Create a dedicated NGINX config
+ynh_add_nginx_config
+
+#=================================================
+# UPDATE A CONFIG FILE
+#=================================================
+ynh_script_progression --message="Updating a configuration file..." --weight=1
+
+ynh_add_config --template="some_config_file" --destination="$final_path/some_config_file"
+chmod 400 "$final_path/some_config_file"
+chown $app:$app "$final_path/some_config_file"
+
+#=================================================
+# RELOAD NGINX
+#=================================================
+ynh_script_progression --message="Reloading NGINX web server..." --weight=1
+
+ynh_systemd_action --service_name=nginx --action=reload
+
+#=================================================
+# END OF SCRIPT
+#=================================================
+
+ynh_script_progression --message="Upgrade of $app completed" --last
diff --git a/sources/extra_files/app/.gitignore b/sources/extra_files/app/.gitignore
new file mode 100644
index 0000000..783a4ae
--- /dev/null
+++ b/sources/extra_files/app/.gitignore
@@ -0,0 +1,2 @@
+*~
+*.sw[op]
diff --git a/sources/patches/.gitignore b/sources/patches/.gitignore
new file mode 100644
index 0000000..783a4ae
--- /dev/null
+++ b/sources/patches/.gitignore
@@ -0,0 +1,2 @@
+*~
+*.sw[op]