From ef0ee9c4fc4325b18f62430e6e7b0c691e4306cd Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Josu=C3=A9=20Tille?= Date: Sun, 11 Feb 2018 00:23:13 +0100 Subject: [PATCH] Add title for each part of code --- manifest.json | 2 +- scripts/_common.sh | 9 ++++++++- scripts/backup | 8 ++++++++ scripts/change_url | 4 ++++ scripts/install | 12 ++++++++++++ scripts/remove | 11 ++++++++--- scripts/restore | 12 ++++++++++++ scripts/upgrade | 16 ++++++++++++++++ 8 files changed, 69 insertions(+), 5 deletions(-) diff --git a/manifest.json b/manifest.json index b771772..6143905 100644 --- a/manifest.json +++ b/manifest.json @@ -57,7 +57,7 @@ "en": "Is it a public server ?", "fr": "Est-ce un serveur publique ?" }, - "default": 0 + "default": false } ] } diff --git a/scripts/_common.sh b/scripts/_common.sh index 4b22333..ea6b6eb 100755 --- a/scripts/_common.sh +++ b/scripts/_common.sh @@ -1,9 +1,16 @@ #!/bin/bash -# Retrieve arguments +#================================================= +# SET ALL CONSTANTS +#================================================= + app=$YNH_APP_INSTANCE_NAME final_path="/var/www/$app" +#================================================= +# DEFINE ALL COMMON FONCTIONS +#================================================= + config_nginx() { if [ "$path_url" != "/" ] then diff --git a/scripts/backup b/scripts/backup index 450dfc5..82efe6a 100644 --- a/scripts/backup +++ b/scripts/backup @@ -1,5 +1,9 @@ #!/bin/bash +#================================================= +# GENERIC START +#================================================= + # Source YunoHost helpers source /usr/share/yunohost/helpers @@ -9,6 +13,10 @@ ynh_abort_if_errors # Import common cmd source ../settings/scripts/_common.sh +#================================================= +# STANDARD BACKUP STEPS +#================================================= + # Retrieve arguments domain=$(ynh_app_setting_get $app domain) diff --git a/scripts/change_url b/scripts/change_url index f085501..c6b9cfa 100644 --- a/scripts/change_url +++ b/scripts/change_url @@ -1,5 +1,9 @@ #!/bin/bash +#================================================= +# GENERIC START +#================================================= + # Source YunoHost helpers source /usr/share/yunohost/helpers diff --git a/scripts/install b/scripts/install index 9dba384..fae7de7 100644 --- a/scripts/install +++ b/scripts/install @@ -1,5 +1,9 @@ #!/bin/bash +#================================================= +# GENERIC START +#================================================= + # Source YunoHost helpers source /usr/share/yunohost/helpers @@ -27,6 +31,10 @@ ynh_app_setting_set $app is_public $is_public ynh_app_setting_set $app default_home_server $default_home_server ynh_app_setting_set $app final_path $final_path +#================================================= +# STANDARD MODIFICATIONS +#================================================= + # Create a system user ynh_system_user_create $app @@ -42,6 +50,10 @@ config_riot # Config nginx config_nginx +#================================================= +# GENERIC FINALIZATION +#================================================= + # Set final permission set_permission diff --git a/scripts/remove b/scripts/remove index 39df17e..af7295e 100755 --- a/scripts/remove +++ b/scripts/remove @@ -1,14 +1,19 @@ #!/bin/bash +#================================================= +# GENERIC START +#================================================= + # Source YunoHost helpers source /usr/share/yunohost/helpers -# Stop script if errors -set -u - # Import common cmd source ./_common.sh +#================================================= +# STANDARD REMOVE +#================================================= + # Retrieve arguments domain=$(ynh_app_setting_get $app domain) diff --git a/scripts/restore b/scripts/restore index c626c48..b129c41 100644 --- a/scripts/restore +++ b/scripts/restore @@ -1,5 +1,9 @@ #!/bin/bash +#================================================= +# GENERIC START +#================================================= + # Source YunoHost helpers source /usr/share/yunohost/helpers @@ -16,12 +20,20 @@ path_url=$(ynh_app_setting_get $app path) # Check domain/path availability ynh_webpath_available $domain $path_url || ynh_die "$domain/$path_url is not available, please use an other domain or path." +#================================================= +# STANDARD RESTORATION STEPS +#================================================= + # Create a system user ynh_system_user_create $app # Restore all config and data ynh_restore +#================================================= +# GENERIC FINALIZATION +#================================================= + # Set final permission set_permission diff --git a/scripts/upgrade b/scripts/upgrade index 629261d..231d46d 100644 --- a/scripts/upgrade +++ b/scripts/upgrade @@ -1,5 +1,9 @@ #!/bin/bash +#================================================= +# GENERIC START +#================================================= + # Source YunoHost helpers source /usr/share/yunohost/helpers @@ -16,9 +20,17 @@ is_public=$(ynh_app_setting_get $app is_public) final_path=$(ynh_app_setting_get $app final_path) default_home_server=$(ynh_app_setting_get $app default_home_server) +#================================================= +# MIGRATION FROM OLD VERSION +#================================================= + # Create a system user grep "riot" "/etc/passwd" || ynh_system_user_create $app +#================================================= +# STANDARD UPGRADE STEPS +#================================================= + # Get source and install in source dir ynh_secure_remove $final_path/bundles install_source @@ -32,6 +44,10 @@ config_riot # Update nginx config config_nginx +#================================================= +# GENERIC FINALIZATION +#================================================= + # Set final permission set_permission