From d753c306e6833a533102df25d646e0632cba45ff Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?F=C3=A9lix=20Pi=C3=A9dallu?= Date: Sun, 14 Jul 2024 17:30:01 +0200 Subject: [PATCH] Coding style --- manifest.toml | 21 ++++++++++++++------- scripts/backup | 8 +------- scripts/change_url | 2 -- scripts/install | 28 +++++++++++----------------- scripts/remove | 6 +----- scripts/restore | 12 +++--------- scripts/upgrade | 28 +++++++++++----------------- sources/extra_files/app/.gitignore | 2 -- sources/patches/.gitignore | 2 -- 9 files changed, 41 insertions(+), 68 deletions(-) delete mode 100644 sources/extra_files/app/.gitignore delete mode 100644 sources/patches/.gitignore diff --git a/manifest.toml b/manifest.toml index 8245942..c9def5a 100644 --- a/manifest.toml +++ b/manifest.toml @@ -1,3 +1,5 @@ +#:schema https://raw.githubusercontent.com/YunoHost/apps/master/schemas/manifest.v2.schema.json + packaging_format = 2 id = "directorylister" @@ -44,7 +46,7 @@ ram.runtime = "50M" [install.language] ask.en = "Choose the application language" ask.fr = "Choisissez la langue de l'application" - type = "string" + type = "select" choices = ["fr", "en"] default = "fr" @@ -52,11 +54,11 @@ ram.runtime = "50M" [resources.sources] - [resources.sources.main] - in_subdir = false - url = "https://github.com/DirectoryLister/DirectoryLister/archive/refs/tags/4.1.0.tar.gz" - sha256 = "4b2d2eade47ad1f48775bf2b1b66f25131f53ffa1563978dd9b771aedde400ef" - autoupdate.strategy = "latest_github_tag" + [resources.sources.main] + in_subdir = false + url = "https://github.com/DirectoryLister/DirectoryLister/archive/refs/tags/4.1.0.tar.gz" + sha256 = "4b2d2eade47ad1f48775bf2b1b66f25131f53ffa1563978dd9b771aedde400ef" + autoupdate.strategy = "latest_github_tag" [resources.system_user] @@ -66,4 +68,9 @@ ram.runtime = "50M" main.url = "/" [resources.apt] - packages = "php8.2-fpm, php8.2-fileinfo, php8.2-dom, php8.2-zip" + packages = [ + "php8.2-fpm", + "php8.2-fileinfo", + "php8.2-dom", + "php8.2-zip", + ] diff --git a/scripts/backup b/scripts/backup index 18f83fe..03eff4f 100755 --- a/scripts/backup +++ b/scripts/backup @@ -1,7 +1,5 @@ #!/bin/bash -#================================================= -# GENERIC START #================================================= # IMPORT GENERIC HELPERS #================================================= @@ -22,15 +20,11 @@ ynh_print_info --message="Declaring files to be backed up..." ynh_backup --src_path="$install_dir" #================================================= -# BACKUP THE NGINX CONFIGURATION +# SYSTEM 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" #================================================= diff --git a/scripts/change_url b/scripts/change_url index 4ba8cf7..cfcb0d6 100644 --- a/scripts/change_url +++ b/scripts/change_url @@ -1,7 +1,5 @@ #!/bin/bash -#================================================= -# GENERIC STARTING #================================================= # IMPORT GENERIC HELPERS #================================================= diff --git a/scripts/install b/scripts/install index 8be7c4e..32620b3 100755 --- a/scripts/install +++ b/scripts/install @@ -1,7 +1,5 @@ #!/bin/bash -#================================================= -# GENERIC START #================================================= # IMPORT GENERIC HELPERS #================================================= @@ -9,8 +7,6 @@ source _common.sh source /usr/share/yunohost/helpers -#================================================= -# APP "BUILD" (DEPLOYING SOURCES, VENV, COMPILING ETC) #================================================= # DOWNLOAD, CHECK AND UNPACK SOURCE #================================================= @@ -19,7 +15,17 @@ ynh_script_progression --message="Setting up source files..." --weight=1 # Download, check integrity, uncompress and patch the source from app.src ynh_setup_source --dest_dir="$install_dir" -chown -R $app:www-data "$install_dir" +chown -R "$app:www-data" "$install_dir" + +#================================================= +# ADD A CONFIGURATION +#================================================= +ynh_script_progression --message="Adding a configuration file..." --weight=1 + +ynh_add_config --template=".env.example" --destination="$install_dir/.env" + +chmod 400 "$install_dir/.env" +chown "$app:$app" "$install_dir/.env" #================================================= # SYSTEM CONFIGURATION @@ -32,18 +38,6 @@ ynh_add_fpm_config # Create a dedicated NGINX config using the conf/nginx.conf template ynh_add_nginx_config -#================================================= -# APP INITIAL CONFIGURATION -#================================================= -# ADD A CONFIGURATION -#================================================= -ynh_script_progression --message="Adding a configuration file..." --weight=1 - -ynh_add_config --template=".env.example" --destination="$install_dir/.env" - -chmod 400 "$install_dir/.env" -chown $app:$app "$install_dir/.env" - #================================================= # END OF SCRIPT #================================================= diff --git a/scripts/remove b/scripts/remove index f717a6a..d15ed06 100755 --- a/scripts/remove +++ b/scripts/remove @@ -1,7 +1,5 @@ #!/bin/bash -#================================================= -# GENERIC START #================================================= # IMPORT GENERIC HELPERS #================================================= @@ -10,9 +8,7 @@ source _common.sh source /usr/share/yunohost/helpers #================================================= -# REMOVE SYSTEM CONFIGURATIONS -#================================================= -# REMOVE SYSTEMD SERVICE +# REMOVE SYSTEMD SERVICE #================================================= ynh_script_progression --message="Removing system configurations related to $app..." --weight=1 diff --git a/scripts/restore b/scripts/restore index 99cabb7..15ebd20 100755 --- a/scripts/restore +++ b/scripts/restore @@ -1,7 +1,5 @@ #!/bin/bash -#================================================= -# GENERIC START #================================================= # IMPORT GENERIC HELPERS #================================================= @@ -17,12 +15,10 @@ ynh_script_progression --message="Restoring the app main directory..." --weight= ynh_restore_file --origin_path="$install_dir" -chown -R $app:www-data "$install_dir" +chown -R "$app:www-data" "$install_dir" #================================================= -# RESTORE SYSTEM CONFIGURATIONS -#================================================= -# RESTORE THE PHP-FPM CONFIGURATION +# SYSTEM CONFIGURATION #================================================= ynh_script_progression --message="Restoring system configurations related to $app..." --weight=1 @@ -30,15 +26,13 @@ ynh_restore_file --origin_path="/etc/php/$phpversion/fpm/pool.d/$app.conf" ynh_restore_file --origin_path="/etc/nginx/conf.d/$domain.d/$app.conf" -#================================================= -# GENERIC FINALIZATION #================================================= # RELOAD NGINX AND PHP-FPM OR THE APP SERVICE #================================================= ynh_script_progression --message="Reloading NGINX web server and $app's service..." --weight=1 # Typically you only have either $app or php-fpm but not both at the same time... -ynh_systemd_action --service_name=php$phpversion-fpm --action=reload +ynh_systemd_action --service_name="php$phpversion-fpm" --action=reload ynh_systemd_action --service_name=nginx --action=reload diff --git a/scripts/upgrade b/scripts/upgrade index 1e5ccc4..1251d4a 100755 --- a/scripts/upgrade +++ b/scripts/upgrade @@ -1,7 +1,5 @@ #!/bin/bash -#================================================= -# GENERIC START #================================================= # IMPORT GENERIC HELPERS #================================================= @@ -9,8 +7,6 @@ source _common.sh source /usr/share/yunohost/helpers -#================================================= -# "REBUILD" THE APP (DEPLOY NEW SOURCES, RERUN NPM BUILD...) #================================================= # DOWNLOAD, CHECK AND UNPACK SOURCE #================================================= @@ -19,7 +15,17 @@ 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="$install_dir" --keep=".env" -chown -R $app:www-data "$install_dir" +chown -R "$app:www-data" "$install_dir" + +#================================================= +# UPDATE A CONFIG FILE +#================================================= +# ynh_script_progression --message="Updating a configuration file..." --weight=1 + +# ynh_add_config --template=".env.example" --destination="$install_dir/.env" + +# chmod 400 "$install_dir/.env" +# chown $app:$app "$install_dir/.env" #================================================= # REAPPLY SYSTEM CONFIGURATIONS @@ -30,18 +36,6 @@ ynh_add_fpm_config ynh_add_nginx_config -#================================================= -# RECONFIGURE THE APP (UPDATE CONF, APPLY MIGRATIONS...) -#================================================= -# UPDATE A CONFIG FILE -#================================================= -#ynh_script_progression --message="Updating a configuration file..." --weight=1 - -#ynh_add_config --template=".env.example" --destination="$install_dir/.env" - -#chmod 400 "$install_dir/.env" -#chown $app:$app "$install_dir/.env" - #================================================= # END OF SCRIPT #================================================= diff --git a/sources/extra_files/app/.gitignore b/sources/extra_files/app/.gitignore deleted file mode 100644 index 783a4ae..0000000 --- a/sources/extra_files/app/.gitignore +++ /dev/null @@ -1,2 +0,0 @@ -*~ -*.sw[op] diff --git a/sources/patches/.gitignore b/sources/patches/.gitignore deleted file mode 100644 index 783a4ae..0000000 --- a/sources/patches/.gitignore +++ /dev/null @@ -1,2 +0,0 @@ -*~ -*.sw[op]