From 61acfc11def0759834dd29033eaeea2355c8b9f7 Mon Sep 17 00:00:00 2001 From: Yunohost-Bot <> Date: Mon, 15 Mar 2021 00:25:29 +0100 Subject: [PATCH 1/7] [autopatch] Autopatch to migrate to new permission system --- scripts/install | 5 ++--- scripts/upgrade | 10 ++++++++++ 2 files changed, 12 insertions(+), 3 deletions(-) diff --git a/scripts/install b/scripts/install index ce78784..94a2981 100644 --- a/scripts/install +++ b/scripts/install @@ -48,7 +48,6 @@ ynh_user_exists --username="$admin" ynh_script_progression --message="Storing installation settings..." 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=is_public --value=$is_public ynh_app_setting_set --app="$app" --key=admin_user --value="$admin" ynh_app_setting_set --app="$app" --key=backup_core_only --value=$backup_core_only ynh_app_setting_set --app="$app" --key=final_path --value="$final_path" @@ -108,7 +107,7 @@ ynh_add_fpm_config # create admin user in bozon ynh_script_progression --message="Configuring admin user in BoZon..." --weight=2 ## set the app as temporarily public for curl call -ynh_app_setting_set --app="$app" --key=unprotected_uris --value="/" + ## reload SSOwat config yunohost app ssowatconf ## reload Nginx @@ -132,7 +131,7 @@ if [ $is_public -eq 0 ]; then domainluaregex=$(echo "$domain" | sed -e 's/[]().%+*?[^$[]/\%&/g' | sed -e 's/\-/\%&/g') pathluaregex=$([ "$path_url" == "/" ] || echo "$path_url" | sed -e 's/[]().%+*?[^$[]/\%&/g' | sed -e 's/\-/\%&/g') regexList="${domainluaregex}${pathluaregex}/index%.php$","${domainluaregex}${pathluaregex}/index%.php%?p=.*$" - ynh_app_setting_set --app="$app" --key=protected_regex --value="$regexList" + fi #================================================= diff --git a/scripts/upgrade b/scripts/upgrade index d299ece..e637872 100644 --- a/scripts/upgrade +++ b/scripts/upgrade @@ -55,6 +55,16 @@ fi # Exit if an error occurs during the execution of the script ynh_abort_if_errors +#================================================= +# Migrate legacy permissions to new system +#================================================= +if ynh_legacy_permissions_exists +then + ynh_legacy_permissions_delete_all + + ynh_app_setting_delete --app=$app --key=is_public +fi + #================================================= # STANDARD UPGRADE STEPS #================================================= From 77d417a6a8fdd5c2dafeb79c50a369a89256ddc8 Mon Sep 17 00:00:00 2001 From: yalh76 Date: Thu, 28 Jul 2022 03:39:57 +0200 Subject: [PATCH 2/7] Apply example_ynh --- check_process | 13 +- conf/app.src | 6 +- conf/nginx.conf | 125 ++++++++-------- conf/php-fpm.conf | 2 +- doc/.gitkeep | 0 doc/DESCRIPTION.md | 1 + doc/DISCLAIMER.md | 0 doc/screenshots/.gitkeep | 0 .../screenshots}/bozon_screenshot.png | Bin manifest.json | 52 ++----- scripts/_common.sh | 11 +- scripts/backup | 57 +++---- scripts/change_url | 74 ++++----- scripts/install | 109 +++++++++----- scripts/remove | 50 +++++-- scripts/restore | 83 ++++++----- scripts/upgrade | 141 +++++++++--------- 17 files changed, 384 insertions(+), 340 deletions(-) create mode 100644 doc/.gitkeep create mode 100644 doc/DESCRIPTION.md create mode 100644 doc/DISCLAIMER.md create mode 100644 doc/screenshots/.gitkeep rename {sources => doc/screenshots}/bozon_screenshot.png (100%) diff --git a/check_process b/check_process index 2313518..70cdcac 100644 --- a/check_process +++ b/check_process @@ -1,20 +1,17 @@ ;; Test complet (bozon=sans bdd) auto_remove=1 ; Manifest - domain="domain.tld" (DOMAIN) - path="/path" (PATH) + domain="domain.tld" + path="/path" is_public=1 - language="fr" - filesize="2G" - admin="john" (USER) - password="super_secret_password" (PASSWORD) - backup_core_only=1 + admin="john" + password="super_secret_password" ; Checks pkg_linter=1 setup_sub_dir=1 setup_root=1 setup_nourl=0 - setup_private=0 + setup_private=1 setup_public=1 upgrade=1 upgrade=1 from_commit=03e787291ba1104f195fdeb5103071b9546b4ad5 diff --git a/conf/app.src b/conf/app.src index bb03661..9db3b05 100644 --- a/conf/app.src +++ b/conf/app.src @@ -1,5 +1,7 @@ SOURCE_URL=https://github.com/broncowdd/BoZoN/archive/ce0265e0dd13bc1e3cbbf0d96b846f65d1a17173.zip SOURCE_SUM=42e8e81771cb3489297a75138a69cf83c82edc3e6ea5988b8d436254ac502b1b +SOURCE_SUM_PRG=sha256sum SOURCE_FORMAT=zip - -#sha256sum obtain with shasum -a 256 $SOURCE_URL +SOURCE_IN_SUBDIR=true +SOURCE_FILENAME= +SOURCE_EXTRACT=true diff --git a/conf/nginx.conf b/conf/nginx.conf index 598fa6f..ed41b7a 100644 --- a/conf/nginx.conf +++ b/conf/nginx.conf @@ -1,67 +1,64 @@ #sub_path_only rewrite ^__PATH__$ __PATH__/ permanent; location __PATH__/ { - # Path to source - alias __FINALPATH__/; - - # Force usage of https - if ($scheme = http) { - rewrite ^ https://$server_name$request_uri? permanent; - } - - # Add headers to serve security related headers - more_set_headers "Strict-Transport-Security: max-age=15768000; includeSubDomains; preload;"; - more_set_headers "X-Content-Type-Options: nosniff"; - more_set_headers "X-XSS-Protection: 1; mode=block"; - more_set_headers "X-Robots-Tag: none"; - more_set_headers "X-Download-Options: noopen"; - more_set_headers "X-Permitted-Cross-Domain-Policies: none"; - more_set_headers "Referrer-Policy: no-referrer"; - - # Set max upload size - client_max_body_size 10G; - fastcgi_buffers 64 4K; - client_body_timeout 60m; - proxy_read_timeout 60m; - - # Disable gzip to avoid the removal of the ETag header - gzip off; - - index index.php; - try_files $uri $uri/ index.php; - - location ~ [^/]\.php(/|$) { - include fastcgi_params; - fastcgi_split_path_info ^(.+?\.php)(/.*)$; - fastcgi_pass unix:/var/run/php/php7.0-fpm-__NAME__.sock; - fastcgi_index index.php; - fastcgi_param REMOTE_USER $remote_user; - fastcgi_param PATH_INFO $fastcgi_path_info; - fastcgi_param SCRIPT_FILENAME $request_filename; - fastcgi_param HTTPS on; - fastcgi_param modHeadersAvailable true; - fastcgi_intercept_errors on; - fastcgi_read_timeout 60m; - fastcgi_send_timeout 60m; - } - - location ^~ __PATH__/(uploads|thumbs){ - deny all; - } - - location ^~ __PATH__/private { - deny all; - location ~* __PATH__/private/temp/.*\.zip$ { - allow all; - } - } - - location ^~ __PATH__/core { - deny all; - location ~* __PATH__/core/.*\.js$ { - allow all; - } - } - - # Include SSOWAT user panel. - include conf.d/yunohost_panel.conf.inc; + + # Path to source + alias __FINALPATH__/; + + # Add headers to serve security related headers + more_set_headers "Strict-Transport-Security: max-age=15768000; includeSubDomains; preload;"; + more_set_headers "X-Content-Type-Options: nosniff"; + more_set_headers "X-XSS-Protection: 1; mode=block"; + more_set_headers "X-Robots-Tag: none"; + more_set_headers "X-Download-Options: noopen"; + more_set_headers "X-Permitted-Cross-Domain-Policies: none"; + more_set_headers "Referrer-Policy: no-referrer"; + + # Set max upload size + client_max_body_size 10G; + fastcgi_buffers 64 4K; + client_body_timeout 60m; + proxy_read_timeout 60m; + + # Disable gzip to avoid the removal of the ETag header + gzip off; + + index index.php; + + try_files $uri $uri/ index.php; + location ~ [^/]\.php(/|$) { + fastcgi_split_path_info ^(.+?\.php)(/.*)$; + fastcgi_pass unix:/var/run/php/php__PHPVERSION__-fpm-__NAME__.sock; + + fastcgi_index index.php; + include fastcgi_params; + fastcgi_param REMOTE_USER $remote_user; + fastcgi_param PATH_INFO $fastcgi_path_info; + fastcgi_param SCRIPT_FILENAME $request_filename; + fastcgi_param HTTPS on; + fastcgi_param modHeadersAvailable true; + fastcgi_intercept_errors on; + fastcgi_read_timeout 60m; + fastcgi_send_timeout 60m; + } + + location ^~ __PATH__/(uploads|thumbs){ + deny all; + } + + location ^~ __PATH__/private { + deny all; + location ~* __PATH__/private/temp/.*\.zip$ { + allow all; + } + } + + location ^~ __PATH__/core { + deny all; + location ~* __PATH__/core/.*\.js$ { + allow all; + } + } + + # Include SSOWAT user panel. + include conf.d/yunohost_panel.conf.inc; } diff --git a/conf/php-fpm.conf b/conf/php-fpm.conf index cce626a..a98c4b1 100644 --- a/conf/php-fpm.conf +++ b/conf/php-fpm.conf @@ -33,7 +33,7 @@ group = __USER__ ; (IPv6 and IPv4-mapped) on a specific port; ; '/path/to/unix/socket' - to listen on a unix socket. ; Note: This value is mandatory. -listen = /var/run/php/php7.0-fpm-__NAMETOCHANGE__.sock +listen = /var/run/php/php__PHPVERSION__-fpm-__NAMETOCHANGE__.sock ; Set listen(2) backlog. ; Default Value: 511 (-1 on FreeBSD and OpenBSD) diff --git a/doc/.gitkeep b/doc/.gitkeep new file mode 100644 index 0000000..e69de29 diff --git a/doc/DESCRIPTION.md b/doc/DESCRIPTION.md new file mode 100644 index 0000000..ba8c08c --- /dev/null +++ b/doc/DESCRIPTION.md @@ -0,0 +1 @@ +BoZoN is a minimalist Drag & drop file sharing app. diff --git a/doc/DISCLAIMER.md b/doc/DISCLAIMER.md new file mode 100644 index 0000000..e69de29 diff --git a/doc/screenshots/.gitkeep b/doc/screenshots/.gitkeep new file mode 100644 index 0000000..e69de29 diff --git a/sources/bozon_screenshot.png b/doc/screenshots/bozon_screenshot.png similarity index 100% rename from sources/bozon_screenshot.png rename to doc/screenshots/bozon_screenshot.png diff --git a/manifest.json b/manifest.json index 6d7fafb..29e5640 100644 --- a/manifest.json +++ b/manifest.json @@ -6,77 +6,49 @@ "en": "Minimalist Drag & drop file sharing app", "fr": "Application minimaliste de partage de fichiers" }, - "url": "https://github.com/broncowdd/BoZoN", - "license": "AGPL-3.0", "version": "2.4.18~ynh1", + "url": "https://github.com/broncowdd/BoZoN", + "upstream": { + "license": "AGPL-3.0", + "code": "https://github.com/broncowdd/BoZoN" + }, + "license": "AGPL-3.0", "maintainer": { "name": "ewilly", "email": "ewilly@neuf.fr" }, "requirements": { - "yunohost": ">= 3.8.1" + "yunohost": ">= 4.3.0" }, "multi_instance": false, "services": [ "nginx", - "php7.0-fpm" + "php7.3-fpm" ], "arguments": { - "install" : [ + "install": [ { "name": "domain", - "type": "domain", - "ask": { - "en": "Choose a domain for BoZoN", - "fr": "Choisissez un domaine pour BoZoN" - }, - "example": "domain.org" + "type": "domain" }, { "name": "path", "type": "path", - "ask": { - "en": "Choose a path for BoZoN", - "fr": "Choisissez un chemin pour BoZoN" - }, "example": "/bozon", "default": "/bozon" }, { "name": "is_public", "type": "boolean", - "ask": { - "en": "Should this application be public? (if not, sharing file with unregistered users will still work)", - "fr": "Est-ce que cette application doit être visible publiquement ? (dans le cas contraire, le partage de fichiers avec des utilisateurs externes fonctionnera tout de même)" - }, "default": false }, { "name": "admin", - "type": "user", - "ask": { - "en": "Choose an admin user for BoZoN", - "fr": "Choisissez un administrateur pour BoZoN" - }, - "example": "homer" + "type": "user" }, { "name": "password", - "type": "password", - "ask": { - "en": "Choose an admin password for BoZoN", - "fr": "Choisissez un mot de passe administrateur pour BoZoN" - }, - "example": "super_secret_password" - }, - { - "name": "backup_core_only", - "type": "boolean", - "ask": { - "en": "When backing up, should only the core of the app be backed up? (uploaded files to BoZoN such as videos, pictures, documents, etc. will not be backed up)", - "fr": "En cas de sauvegarde, doit-être uniquement sauvegardé le cœur de l'application ? (les fichiers transférés dans BoZoN tels que les vidéos, images, documents, etc. ne seront pas sauvegardés)" - }, - "default": true + "type": "password" } ] } diff --git a/scripts/_common.sh b/scripts/_common.sh index e6d2688..ef1c9b8 100644 --- a/scripts/_common.sh +++ b/scripts/_common.sh @@ -5,11 +5,12 @@ #================================================= # dependencies used by the app -pkg_dependencies="php-zip php-curl php-gd" +pkg_dependencies="php$YNH_DEFAULT_PHP_VERSION-zip php$YNH_DEFAULT_PHP_VERSION-curl php$YNH_DEFAULT_PHP_VERSION-gd" #================================================= # PERSONAL HELPERS #================================================= + # Check if directory/file already exists (path in argument) myynh_check_path () { [ -z "$1" ] && ynh_die --message="No argument supplied" @@ -31,12 +32,12 @@ myynh_clean_source () { myynh_set_permissions () { [ $(find "$final_path" -type f | wc -l) -gt 0 ] && find "$final_path" -type f | xargs chmod 0644 [ $(find "$final_path" -type d | wc -l) -gt 0 ] && find "$final_path" -type d | xargs chmod 0755 - [ $(find "$data_path" -type f | wc -l) -gt 0 ] && find "$data_path" -type f | xargs chmod 0644 - [ $(find "$data_path" -type d | wc -l) -gt 0 ] && find "$data_path" -type d | xargs chmod 0755 + [ $(find "$datadir" -type f | wc -l) -gt 0 ] && find "$datadir" -type f | xargs chmod 0644 + [ $(find "$datadir" -type d | wc -l) -gt 0 ] && find "$datadir" -type d | xargs chmod 0755 chown -R root:"$app" "$final_path" chown -R "$app": "$final_path/private" - chown -R "$app": "$data_path" - chown root: "$data_path" + chown -R "$app": "$datadir" + chown root: "$datadir" } #Convert --data to --data-urlencode before ynh_local_curl diff --git a/scripts/backup b/scripts/backup index 52daa89..7b168bf 100644 --- a/scripts/backup +++ b/scripts/backup @@ -1,14 +1,11 @@ #!/bin/bash -# to test the functionnality : -# yunohost backup create -n "bozon-test" --apps bozon -# yunohost backup delete bozon-test - #================================================= # GENERIC START #================================================= # IMPORT GENERIC HELPERS #================================================= -#Keep this path for calling _common.sh inside the execution's context of backup and restore scripts + +# 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 @@ -21,44 +18,48 @@ ynh_abort_if_errors #================================================= # LOAD SETTINGS #================================================= -ynh_script_progression --message="Loading installation settings..." +ynh_print_info --message="Loading installation settings..." + 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) -data_path=$(ynh_app_setting_get --app="$app" --key=data_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) +datadir=$(ynh_app_setting_get --app=$app --key=datadir) #================================================= -# STANDARD BACKUP STEPS +# DECLARE DATA AND CONF FILES TO BACKUP +#================================================= +ynh_print_info --message="Declaring files to be backed up..." + #================================================= # BACKUP THE APP MAIN DIR #================================================= -ynh_script_progression --message="Backing up the main app directory..." -if [ -e "$final_path" ]; then - ynh_backup --src_path="$final_path" -fi + +ynh_backup --src_path="$final_path" + +#================================================= +# BACKUP THE DATA DIR +#================================================= + +ynh_backup --src_path="$datadir" --is_big + #================================================= # BACKUP THE NGINX CONFIGURATION #================================================= -ynh_script_progression --message="Backing up nginx web server configuration..." + ynh_backup --src_path="/etc/nginx/conf.d/$domain.d/$app.conf" #================================================= # BACKUP THE PHP-FPM CONFIGURATION #================================================= -ynh_script_progression --message="Backing up php-fpm configuration..." -ynh_backup --src_path="/etc/php/7.0/fpm/pool.d/$app.conf" -##================================================= +ynh_backup --src_path="/etc/php/$phpversion/fpm/pool.d/$app.conf" + +#================================================= # SPECIFIC BACKUP #================================================= -# BACKUP THE DATA DIRECTORY +# END OF SCRIPT #================================================= -ynh_script_progression --message="Backing up data directory..." -if [ -e "$data_path" ]; then - backup_core_only=$(ynh_app_setting_get "$app" backup_core_only) - if [ $backup_core_only -eq 0 ]; then - ynh_backup --src_path="$data_path" --is_big - else - echo "Data dir will not be saved, because backup_core_only is set to true." >&2 - fi -fi + +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 index 2c633e0..f5c3329 100644 --- a/scripts/change_url +++ b/scripts/change_url @@ -12,34 +12,36 @@ source /usr/share/yunohost/helpers #================================================= # RETRIEVE ARGUMENTS #================================================= -app=$YNH_APP_INSTANCE_NAME + old_domain=$YNH_APP_OLD_DOMAIN -new_domain=$YNH_APP_NEW_DOMAIN old_path=$YNH_APP_OLD_PATH + +new_domain=$YNH_APP_NEW_DOMAIN new_path=$YNH_APP_NEW_PATH -# definie useful vars -old_nginx_conf="/etc/nginx/conf.d/$old_domain.d/$app.conf" -new_nginx_conf="/etc/nginx/conf.d/$new_domain.d/$app.conf" -new_path=$(ynh_normalize_url_path --path_url="$new_path") +app=$YNH_APP_INSTANCE_NAME #================================================= # LOAD SETTINGS #================================================= -ynh_script_progression --message="Loading installation settings..." --time --weight=1 +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) #================================================= -# BACKUP BEFORE UPGRADE THEN ACTIVE TRAP +# BACKUP BEFORE CHANGE URL THEN ACTIVE TRAP #================================================= -ynh_script_progression --message="Backing up the app before changing its url (may take a while)..." --time --weight=1 -# backup the current version of the app +ynh_script_progression --message="Backing up the app before changing its URL (may take a while)..." + +# 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_clean_check_starting + # 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 + + # Restore it if the upgrade fails ynh_restore_upgradebackup } # Exit if an error occurs during the execution of the script @@ -48,12 +50,16 @@ ynh_abort_if_errors #================================================= # CHECK WHICH PARTS SHOULD BE CHANGED #================================================= + change_domain=0 -if [ "$old_domain" != "$new_domain" ]; then +if [ "$old_domain" != "$new_domain" ] +then change_domain=1 fi + change_path=0 -if [ "$old_path" != "$new_path" ]; then +if [ "$old_path" != "$new_path" ] +then change_path=1 fi @@ -62,42 +68,42 @@ fi #================================================= # MODIFY URL IN NGINX CONF #================================================= -ynh_script_progression --message="Updating nginx web server configuration..." --time --weight=1 +ynh_script_progression --message="Updating NGINX web server configuration..." --weight=1 -# 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="$old_nginx_conf" - # Set global variables for nginx helper +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 + # Create a dedicated NGINX config ynh_add_nginx_config - if [ "$path_url" != "/" ]; then - ynh_replace_string --match_string="^#sub_path_only" --replace_string="" --target_file="$old_nginx_conf" - fi - # Store file checksum for the new config file location - ynh_store_file_checksum --file="$old_nginx_conf" fi -# Change the domain for nginx -if [ $change_domain -eq 1 ]; then +# 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="$old_nginx_conf" - mv "$old_nginx_conf" "$new_nginx_conf" + 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="$new_nginx_conf" + ynh_store_file_checksum --file="/etc/nginx/conf.d/$new_domain.d/$app.conf" fi - #================================================= # GENERIC FINALISATION #================================================= # RELOAD NGINX #================================================= -ynh_script_progression --message="Reloading nginx web server..." --time --weight=1 +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" --time --last + +ynh_script_progression --message="Change of URL completed for $app" --last diff --git a/scripts/install b/scripts/install index 94a2981..ab80173 100644 --- a/scripts/install +++ b/scripts/install @@ -18,27 +18,28 @@ ynh_abort_if_errors #================================================= # RETRIEVE ARGUMENTS FROM THE MANIFEST #================================================= -app=$YNH_APP_INSTANCE_NAME + domain=$YNH_APP_ARG_DOMAIN path_url=$YNH_APP_ARG_PATH is_public=$YNH_APP_ARG_IS_PUBLIC admin=$YNH_APP_ARG_ADMIN password=$YNH_APP_ARG_PASSWORD -backup_core_only=$YNH_APP_ARG_BACKUP_CORE_ONLY -# definie useful vars -final_path="/var/www/$app" -data_path="/home/yunohost.app/$app" -path_url=$(ynh_normalize_url_path --path_url="$path_url") +app=$YNH_APP_INSTANCE_NAME #================================================= # CHECK IF THE APP CAN BE INSTALLED WITH THESE ARGS #================================================= ynh_script_progression --message="Validating installation parameters..." -## check domain/path availability + +final_path=/var/www/$app +datadir="/home/yunohost.app/$app" +path_url=$(ynh_normalize_url_path --path_url="$path_url") 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" + +# Register (book) web path +ynh_webpath_register --app=$app --domain=$domain --path_url=$path_url + ## check that admin user is an existing account ynh_user_exists --username="$admin" @@ -46,12 +47,12 @@ ynh_user_exists --username="$admin" # STORE SETTINGS FROM MANIFEST #================================================= ynh_script_progression --message="Storing installation settings..." -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=admin_user --value="$admin" -ynh_app_setting_set --app="$app" --key=backup_core_only --value=$backup_core_only -ynh_app_setting_set --app="$app" --key=final_path --value="$final_path" -ynh_app_setting_set --app="$app" --key=data_path --value="$data_path" + +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=admin_user --value=$admin +ynh_app_setting_set --app=$app --key=final_path --value="$final_path" +ynh_app_setting_set --app=$app --key=datadir --value="$datadir" #================================================= # STANDARD MODIFICATIONS @@ -59,59 +60,91 @@ ynh_app_setting_set --app="$app" --key=data_path --value="$data_path" # INSTALL DEPENDENCIES #================================================= ynh_script_progression --message="Installing dependencies..." --weight=3 -ynh_install_app_dependencies "$pkg_dependencies" + +ynh_install_app_dependencies $pkg_dependencies #================================================= # CREATE DEDICATED USER #================================================= ynh_script_progression --message="Configuring system user..." -ynh_system_user_create --username="$app" + +# 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=3 + ## download source tmpdir=$(mktemp -d) ynh_setup_source --dest_dir="$tmpdir" ## clean & copy files needed to final folder myynh_clean_source mv "$tmpdir" "$final_path" -## create private & data folders -myynh_create_dir "$final_path/private" -myynh_create_dir "$data_path/uploads" -myynh_create_dir "$data_path/thumbs" -ln -s "$data_path/uploads" "$final_path/uploads" -ln -s "$data_path/thumbs" "$final_path/thumbs" -## set permissions -myynh_set_permissions + +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..." + +# Create a dedicated PHP-FPM config +ynh_add_fpm_config #================================================= # NGINX CONFIGURATION #================================================= -ynh_script_progression --message="Configuring nginx web server..." +ynh_script_progression --message="Configuring NGINX web server..." + if [ "$path_url" != "/" ]; then ynh_replace_string --match_string="^#sub_path_only" --replace_string="" --target_file="../conf/nginx.conf" fi ynh_add_nginx_config #================================================= -# PHP-FPM CONFIGURATION +# SPECIFIC SETUP #================================================= -ynh_script_progression --message="Configuring php-fpm..." -ynh_add_fpm_config +# CREATE DATA DIRECTORY +#================================================= +ynh_script_progression --message="Creating a data directory..." + +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" + +#================================================= +# ADD A CONFIGURATION +#================================================= +ynh_script_progression --message="Adding a configuration file..." + +## create private & data folders +myynh_create_dir "$final_path/private" +myynh_create_dir "$datadir/uploads" +myynh_create_dir "$datadir/thumbs" +ln -s "$datadir/uploads" "$final_path/uploads" +ln -s "$datadir/thumbs" "$final_path/thumbs" +## set permissions +myynh_set_permissions #================================================= # SETUP APPLICATION WITH CURL #================================================= -# create admin user in bozon ynh_script_progression --message="Configuring admin user in BoZon..." --weight=2 -## set the app as temporarily public for curl call -## reload SSOwat config -yunohost app ssowatconf -## reload Nginx -ynh_systemd_action --service_name=nginx --action=reload +# Set the app as temporarily public for curl call +ynh_script_progression --message="Configuring SSOwat..." +# Making the app public for curl +ynh_permission_update --permission="main" --add="visitors" + ## fill the superadmin creation form (helper ynh_local_curl doesn't work due to --data vs --data-urlencode ?) admin_url="/index.php?p=login" admin=$(myynh_urlencode $admin) @@ -126,21 +159,23 @@ ynh_print_ON # SETUP SSOWAT #================================================= ynh_script_progression --message="Configuring SSOwat..." + if [ $is_public -eq 0 ]; then # escape magic chars in vars (lua magic chars are ().%+-*?[^$ according to https://www.lua.org/pil/20.2.html) domainluaregex=$(echo "$domain" | sed -e 's/[]().%+*?[^$[]/\%&/g' | sed -e 's/\-/\%&/g') pathluaregex=$([ "$path_url" == "/" ] || echo "$path_url" | sed -e 's/[]().%+*?[^$[]/\%&/g' | sed -e 's/\-/\%&/g') regexList="${domainluaregex}${pathluaregex}/index%.php$","${domainluaregex}${pathluaregex}/index%.php%?p=.*$" - fi #================================================= # RELOAD NGINX #================================================= -ynh_script_progression --message="Reloading nginx web server..." +ynh_script_progression --message="Reloading NGINX web server..." + 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 index f78ae0a..f524320 100644 --- a/scripts/remove +++ b/scripts/remove @@ -1,12 +1,11 @@ #!/bin/bash -# to test the functionnality : -# yunohost app remove bozon #================================================= # GENERIC START #================================================= # IMPORT GENERIC HELPERS #================================================= + source _common.sh source /usr/share/yunohost/helpers @@ -14,41 +13,57 @@ 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) -data_path=$(ynh_app_setting_get --app="$app" --key=data_path) + +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) #================================================= # STANDARD REMOVE -#================================================= -# REMOVE DEPENDENCIES -#================================================= -ynh_script_progression --message="Removing dependencies..." --weight=1 -ynh_remove_app_dependencies - #================================================= # 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..." + ynh_secure_remove --file="$datadir" +fi + #================================================= # REMOVE NGINX CONFIGURATION #================================================= -ynh_script_progression --message="Removing nginx web server configuration..." --weight=1 +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 +ynh_script_progression --message="Removing PHP-FPM configuration..." --weight=1 + +# Remove the dedicated PHP-FPM config ynh_remove_fpm_config #================================================= -# SPECIFIC REMOVE +# REMOVE DEPENDENCIES #================================================= -ynh_secure_remove --file="$data_path" +ynh_script_progression --message="Removing dependencies..." --weight=1 + +# Remove metapackage and its dependencies +ynh_remove_app_dependencies #================================================= # GENERIC FINALIZATION @@ -56,9 +71,12 @@ ynh_secure_remove --file="$data_path" # REMOVE DEDICATED USER #================================================= ynh_script_progression --message="Removing the dedicated system user..." --weight=1 -ynh_system_user_delete --username="$app" + +# 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 index b053215..a2a1869 100644 --- a/scripts/restore +++ b/scripts/restore @@ -1,15 +1,12 @@ #!/bin/bash -# to test the functionnality : -# yunohost backup create -n "bozon-test" --apps bozon -# yunohost app remove bozon -# yunohost backup restore "bozon-test" #================================================= # GENERIC START #================================================= # IMPORT GENERIC HELPERS #================================================= -#Keep this path for calling _common.sh inside the execution's context of backup and restore scripts + +# 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 @@ -23,43 +20,55 @@ 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) -backup_core_only=$(ynh_app_setting_get --app="$app" --key=backup_core_only) -final_path=$(ynh_app_setting_get --app="$app" --key=final_path) -data_path=$(ynh_app_setting_get --app="$app" --key=data_path) + +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) +datadir=$(ynh_app_setting_get --app=$app --key=datadir) #================================================= # CHECK IF THE APP CAN BE RESTORED #================================================= ynh_script_progression --message="Validating restoration parameters..." --weight=1 -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" + +test ! -d $final_path \ + || ynh_die --message="There is already a directory: $final_path " #================================================= # STANDARD RESTORATION STEPS #================================================= -# RESTORE THE NGINX CONFIGURATION +# RECREATE THE DEDICATED USER #================================================= -ynh_restore_file --origin_path="/etc/nginx/conf.d/$domain.d/$app.conf" +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" -#================================================= -# RECREATE THE DEDICATED USER -#================================================= -ynh_script_progression --message="Recreating the dedicated system user..." --weight=1 -ynh_system_user_create --username="$app" +chmod 750 "$final_path" +chmod -R o-rwx "$final_path" +chown -R $app:www-data "$final_path" #================================================= -# RESTORE THE PHP-FPM CONFIGURATION +# RESTORE THE DATA DIRECTORY #================================================= -ynh_restore_file --origin_path="/etc/php/7.0/fpm/pool.d/$app.conf" +ynh_script_progression --message="Restoring the data directory..." + +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 @@ -67,22 +76,23 @@ ynh_restore_file --origin_path="/etc/php/7.0/fpm/pool.d/$app.conf" # REINSTALL DEPENDENCIES #================================================= ynh_script_progression --message="Reinstalling dependencies..." --weight=1 + +# Define and install dependencies ynh_install_app_dependencies $pkg_dependencies #================================================= -# RESTORE THE DATA DIR +# RESTORE THE PHP-FPM CONFIGURATION #================================================= -ynh_script_progression --message="Restoring the data directory..." --weight=2 -if [ ! -d "$data_path" ]; then - if [ $backup_core_only -eq 0 ]; then - ynh_restore_file --origin_path="$data_path" - else - myynh_create_dir "$data_path/uploads" - myynh_create_dir "$data_path/thumbs" - fi -else - echo "$data_path already exists and will not be overwritten" >&2 -fi +ynh_script_progression --message="Restoring the PHP-FPM configuration..." + +ynh_restore_file --origin_path="/etc/php/$phpversion/fpm/pool.d/$app.conf" + +#================================================= +# RESTORE THE NGINX CONFIGURATION +#================================================= +ynh_script_progression --message="Restoring the NGINX web server configuration..." + +ynh_restore_file --origin_path="/etc/nginx/conf.d/$domain.d/$app.conf" #================================================= # RESTORE USER RIGHTS @@ -94,12 +104,13 @@ myynh_set_permissions #================================================= # RELOAD NGINX AND PHP-FPM #================================================= -ynh_script_progression --message="Reloading nginx web server and php-fpm..." --weight=1 -ynh_systemd_action --service_name=php7.0-fpm --action=reload +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 +ynh_script_progression --message="Restoration completed for $app" --last diff --git a/scripts/upgrade b/scripts/upgrade index e637872..9a70d7e 100644 --- a/scripts/upgrade +++ b/scripts/upgrade @@ -1,11 +1,11 @@ #!/bin/bash #================================================= -# GENERIC STARTING +# GENERIC START #================================================= # IMPORT GENERIC HELPERS #================================================= -set -eu + source _common.sh source /usr/share/yunohost/helpers @@ -13,29 +13,15 @@ source /usr/share/yunohost/helpers # LOAD SETTINGS #================================================= ynh_script_progression --message="Loading installation settings..." -app=$YNH_APP_INSTANCE_NAME -domain=$(ynh_app_setting_get --app="$app" --key=domain) -path_url=$(ynh_app_setting_get --app="$app" --key=path) -is_public=$(ynh_app_setting_get --app="$app" --key=is_public) -admin_user=$(ynh_app_setting_get --app="$app" --key=admin_user) -backup_core_only=$(ynh_app_setting_get --app="$app" --key=backup_core_only) -final_path=$(ynh_app_setting_get --app="$app" --key=final_path) -data_path=$(ynh_app_setting_get --app="$app" --key=data_path) -#================================================= -# ENSURE DOWNWARD COMPATIBILITY -#================================================= -ynh_script_progression --message="Ensuring downward compatibility..." --weight=1 -# 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 data_path doesn't exist, create it -if [ -z "$data_path" ]; then - data_path="/home/yunohost.app/$app" - ynh_app_setting_set --app="$app" --key=data_path --value="$data_path" -fi +app=$YNH_APP_INSTANCE_NAME + +domain=$(ynh_app_setting_get --app=$app --key=domain) +path_url=$(ynh_app_setting_get --app=$app --key=path) +is_public=$(ynh_app_setting_get --app=$app --key=is_public) +admin_user=$(ynh_app_setting_get --app=$app --key=admin_user) +final_path=$(ynh_app_setting_get --app=$app --key=final_path) +datadir=$(ynh_app_setting_get --app=$app --key=datadir) #================================================= # CHECK VERSION @@ -46,31 +32,56 @@ 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=3 -if [ -f "/etc/yunohost/apps/$app/scripts/backup" ]; then - ynh_backup_before_upgrade # Backup the current version of the app - ynh_clean_setup () { - ynh_restore_upgradebackup - } -fi + +# Backup the current version of the app +ynh_backup_before_upgrade +ynh_clean_setup () { + ynh_clean_check_starting + # Restore it if the upgrade fails + ynh_restore_upgradebackup +} # Exit if an error occurs during the execution of the script ynh_abort_if_errors #================================================= -# Migrate legacy permissions to new system +# STANDARD UPGRADE STEPS #================================================= -if ynh_legacy_permissions_exists -then +# ENSURE DOWNWARD COMPATIBILITY +#================================================= +ynh_script_progression --message="Ensuring downward compatibility..." --weight=1 + +# 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 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 datadir doesn't exist, create it +if [ -z "$datadir" ]; then + datadir="/home/yunohost.app/$app" + ynh_app_setting_set --app="$app" --key=datadir --value="$datadir" +fi + #================================================= -# STANDARD UPGRADE STEPS +# CREATE DEDICATED USER +#================================================= +ynh_script_progression --message="Making sure dedicated system user exists..." + +# 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 + +if [ "$upgrade_type" == "UPGRADE_APP" ] +then # download & unpack bozon ynh_script_progression --message="Setting up source files..." --weight=2 ## download source @@ -81,68 +92,60 @@ if [ "$upgrade_type" == "UPGRADE_APP" ]; then [ -e "$tmpdir/config.php" ] && ynh_secure_remove "$tmpdir/config.php" cp -a "$tmpdir/." "$final_path" ynh_secure_remove "$tmpdir" - ## set permissions - myynh_set_permissions fi +## set permissions +myynh_set_permissions + +#================================================= +# 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..." + +# Create a dedicated PHP-FPM config +ynh_add_fpm_config + #================================================= # NGINX CONFIGURATION #================================================= ynh_script_progression --message="Upgrading nginx web server configuration..." + if [ "$path_url" != "/" ]; then ynh_replace_string --match_string="^#sub_path_only" --replace_string="" --target_file="../conf/nginx.conf" fi ynh_add_nginx_config #================================================= -# UPGRADE DEPENDENCIES -#================================================= -ynh_script_progression --message="Upgrading dependencies..." --weight=1 -ynh_install_app_dependencies $pkg_dependencies - -#================================================= -# CREATE DEDICATED USER -#================================================= -ynh_script_progression --message="Making sure dedicated system user exists..." -ynh_system_user_create --username="$app" - -#================================================= -# PHP-FPM CONFIGURATION -#================================================= -ynh_script_progression --message="Upgrading php-fpm configuration..." -ynh_add_fpm_config - -#================================================= -# SETUP SSOWAT -#================================================= -ynh_script_progression --message="Upgrading SSOwat configuration..." -if [ $is_public -eq 0 ]; then - # escape magic chars in vars (lua magic chars are ().%+-*?[^$ according to https://www.lua.org/pil/20.2.html) - domainluaregex=$(echo "$domain" | sed -e 's/[]().%+*?[^$[]/\%&/g' | sed -e 's/\-/\%&/g') - pathluaregex=$([ "$path_url" == "/" ] || echo "$path_url" | sed -e 's/[]().%+*?[^$[]/\%&/g' | sed -e 's/\-/\%&/g') - regexList="${domainluaregex}${pathluaregex}/index%.php$","${domainluaregex}${pathluaregex}/index%.php%?p=.*$" - ynh_app_setting_set --app="$app" --key=protected_regex --value="$regexList" -else - ynh_app_setting_set --app="$app" --key=unprotected_uris --value="/" -fi - +# SPECIFIC UPGRADE #================================================= # CLEAN PHP SESSIONS STORED IN /var/lib/phpx/sessions #================================================= ynh_script_progression --message="Cleaning php sessions stored..." + if [ -d "/usr/lib/php5" ]; then [ -x /usr/lib/php5/sessionclean ] && /usr/lib/php5/sessionclean elif [ -d "/usr/lib/php" ]; then [ -x /usr/lib/php/sessionclean ] && /usr/lib/php/sessionclean fi +#================================================= +# GENERIC FINALIZATION #================================================= # RELOAD NGINX #================================================= -ynh_script_progression --message="Reloading nginx web server..." +ynh_script_progression --message="Reloading NGINX web server..." + ynh_systemd_action --service_name=nginx --action=reload #================================================= # END OF SCRIPT #================================================= + ynh_script_progression --message="Upgrade of $app completed" --last From 53b9b54a67de1aaeb9f7ce1b0522977896cb2a49 Mon Sep 17 00:00:00 2001 From: yunohost-bot Date: Thu, 28 Jul 2022 01:40:03 +0000 Subject: [PATCH 3/7] Auto-update README --- README.md | 63 ++++++++++++++++++---------------------------------- README_fr.md | 45 +++++++++++++++++++++++++++++++++++++ 2 files changed, 67 insertions(+), 41 deletions(-) create mode 100644 README_fr.md diff --git a/README.md b/README.md index be43b34..01becc5 100644 --- a/README.md +++ b/README.md @@ -1,64 +1,45 @@ + + # BoZoN for YunoHost -[![Integration level](https://dash.yunohost.org/integration/bozon.svg)](https://dash.yunohost.org/appci/app/bozon) ![](https://ci-apps.yunohost.org/ci/badges/bozon.status.svg) ![](https://ci-apps.yunohost.org/ci/badges/bozon.maintain.svg) -[![Install BoZoN with YunoHost](https://install-app.yunohost.org/install-with-yunohost.png)](https://install-app.yunohost.org/?app=bozon) +[![Integration level](https://dash.yunohost.org/integration/bozon.svg)](https://dash.yunohost.org/appci/app/bozon) ![Working status](https://ci-apps.yunohost.org/ci/badges/bozon.status.svg) ![Maintenance status](https://ci-apps.yunohost.org/ci/badges/bozon.maintain.svg) +[![Install BoZoN with YunoHost](https://install-app.yunohost.org/install-with-yunohost.svg)](https://install-app.yunohost.org/?app=bozon) -> *This package allows you to install BoZoN quickly and simply on a YunoHost server. +*[Lire ce readme en français.](./README_fr.md)* + +> *This package allows you to install BoZoN 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.* ## Overview + BoZoN is a minimalist Drag & drop file sharing app. -**Shipped version:** 2.4.18 + +**Shipped version:** 2.4.18~ynh1 ## Screenshots -![](sources/bozon_screenshot.png) +![Screenshot of BoZoN](./doc/screenshots/bozon_screenshot.png) -## Configuration +## Documentation and resources -How to configure this app: From an admin panel, a plain file with SSH, or any other way. - -## Documentation - - * Official documentation: Link to the official documentation of this app - * YunoHost documentation: If specific documentation is needed, feel free to contribute. - -## YunoHost specific features - -#### Multi-user support - -* Are LDAP and HTTP auth supported? -* Can the app be used by multiple users? - -#### Supported architectures - -* x86-64 - [![Build Status](https://ci-apps.yunohost.org/ci/logs/bozon%20%28Apps%29.svg)](https://ci-apps.yunohost.org/ci/apps/bozon/) -* ARMv8-A - [![Build Status](https://ci-apps-arm.yunohost.org/ci/logs/bozon%20%28Apps%29.svg)](https://ci-apps-arm.yunohost.org/ci/apps/bozon/) - -## 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/bozon_ynh/issues - * Upstream app repository: https://github.com/broncowdd/BoZoN - * YunoHost website: https://yunohost.org/ - ---- +* Upstream app code repository: +* YunoHost documentation for this app: +* Report a bug: ## Developer info Please send your pull request to the [testing branch](https://github.com/YunoHost-Apps/bozon_ynh/tree/testing). To try the testing branch, please proceed like that. -``` + +``` bash sudo yunohost app install https://github.com/YunoHost-Apps/bozon_ynh/tree/testing --debug or sudo yunohost app upgrade bozon -u https://github.com/YunoHost-Apps/bozon_ynh/tree/testing --debug ``` + +**More info regarding app packaging:** diff --git a/README_fr.md b/README_fr.md new file mode 100644 index 0000000..8889bd2 --- /dev/null +++ b/README_fr.md @@ -0,0 +1,45 @@ + + +# BoZoN pour YunoHost + +[![Niveau d'intégration](https://dash.yunohost.org/integration/bozon.svg)](https://dash.yunohost.org/appci/app/bozon) ![Statut du fonctionnement](https://ci-apps.yunohost.org/ci/badges/bozon.status.svg) ![Statut de maintenance](https://ci-apps.yunohost.org/ci/badges/bozon.maintain.svg) +[![Installer BoZoN avec YunoHost](https://install-app.yunohost.org/install-with-yunohost.svg)](https://install-app.yunohost.org/?app=bozon) + +*[Read this readme in english.](./README.md)* + +> *Ce package vous permet d'installer BoZoN rapidement et simplement sur un serveur YunoHost. +Si vous n'avez pas YunoHost, regardez [ici](https://yunohost.org/#/install) pour savoir comment l'installer et en profiter.* + +## Vue d'ensemble + +BoZoN is a minimalist Drag & drop file sharing app. + + +**Version incluse :** 2.4.18~ynh1 + +## Captures d'écran + +![Capture d'écran de BoZoN](./doc/screenshots/bozon_screenshot.png) + +## Documentations et ressources + +* Dépôt de code officiel de l'app : +* Documentation YunoHost pour cette app : +* Signaler un bug : + +## Informations pour les développeurs + +Merci de faire vos pull request sur la [branche testing](https://github.com/YunoHost-Apps/bozon_ynh/tree/testing). + +Pour essayer la branche testing, procédez comme suit. + +``` bash +sudo yunohost app install https://github.com/YunoHost-Apps/bozon_ynh/tree/testing --debug +ou +sudo yunohost app upgrade bozon -u https://github.com/YunoHost-Apps/bozon_ynh/tree/testing --debug +``` + +**Plus d'infos sur le packaging d'applications :** From 5692ff34e2fc474ab3ea84000b472174ee0b1db3 Mon Sep 17 00:00:00 2001 From: yalh76 Date: Thu, 28 Jul 2022 03:41:02 +0200 Subject: [PATCH 4/7] Update manifest.json --- manifest.json | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/manifest.json b/manifest.json index 29e5640..19e0756 100644 --- a/manifest.json +++ b/manifest.json @@ -6,7 +6,7 @@ "en": "Minimalist Drag & drop file sharing app", "fr": "Application minimaliste de partage de fichiers" }, - "version": "2.4.18~ynh1", + "version": "2.4.18~ynh2", "url": "https://github.com/broncowdd/BoZoN", "upstream": { "license": "AGPL-3.0", From e86e6a1eab22fcea18d5c78c8bb6bf61ae167fca Mon Sep 17 00:00:00 2001 From: yunohost-bot Date: Thu, 28 Jul 2022 01:41:11 +0000 Subject: [PATCH 5/7] Auto-update README --- README.md | 2 +- README_fr.md | 2 +- 2 files changed, 2 insertions(+), 2 deletions(-) diff --git a/README.md b/README.md index 01becc5..5c75096 100644 --- a/README.md +++ b/README.md @@ -18,7 +18,7 @@ If you don't have YunoHost, please consult [the guide](https://yunohost.org/#/in BoZoN is a minimalist Drag & drop file sharing app. -**Shipped version:** 2.4.18~ynh1 +**Shipped version:** 2.4.18~ynh2 ## Screenshots diff --git a/README_fr.md b/README_fr.md index 8889bd2..a2a1054 100644 --- a/README_fr.md +++ b/README_fr.md @@ -18,7 +18,7 @@ Si vous n'avez pas YunoHost, regardez [ici](https://yunohost.org/#/install) pour BoZoN is a minimalist Drag & drop file sharing app. -**Version incluse :** 2.4.18~ynh1 +**Version incluse :** 2.4.18~ynh2 ## Captures d'écran From 38f2e8507c18b8cf37517399f926e953d7e08a6b Mon Sep 17 00:00:00 2001 From: yalh76 Date: Thu, 28 Jul 2022 15:28:59 +0200 Subject: [PATCH 6/7] More example_ynh --- scripts/_common.sh | 2 ++ scripts/restore | 1 + scripts/upgrade | 3 ++- 3 files changed, 5 insertions(+), 1 deletion(-) diff --git a/scripts/_common.sh b/scripts/_common.sh index ef1c9b8..9a4df38 100644 --- a/scripts/_common.sh +++ b/scripts/_common.sh @@ -38,6 +38,8 @@ myynh_set_permissions () { chown -R "$app": "$final_path/private" chown -R "$app": "$datadir" chown root: "$datadir" + chmod -R o-rwx "$final_path" + chmod -R o-rwx "$datadir" } #Convert --data to --data-urlencode before ynh_local_curl diff --git a/scripts/restore b/scripts/restore index a2a1869..bfcc2ec 100644 --- a/scripts/restore +++ b/scripts/restore @@ -26,6 +26,7 @@ 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) #================================================= diff --git a/scripts/upgrade b/scripts/upgrade index 9a70d7e..303c64d 100644 --- a/scripts/upgrade +++ b/scripts/upgrade @@ -18,7 +18,6 @@ app=$YNH_APP_INSTANCE_NAME domain=$(ynh_app_setting_get --app=$app --key=domain) path_url=$(ynh_app_setting_get --app=$app --key=path) -is_public=$(ynh_app_setting_get --app=$app --key=is_public) admin_user=$(ynh_app_setting_get --app=$app --key=admin_user) final_path=$(ynh_app_setting_get --app=$app --key=final_path) datadir=$(ynh_app_setting_get --app=$app --key=datadir) @@ -26,6 +25,8 @@ datadir=$(ynh_app_setting_get --app=$app --key=datadir) #================================================= # CHECK VERSION #================================================= +ynh_script_progression --message="Checking version..." + upgrade_type=$(ynh_check_app_version_changed) #================================================= From e09e17d33dad1fe4765f185df49e45127dc42fdc Mon Sep 17 00:00:00 2001 From: yalh76 Date: Thu, 28 Jul 2022 20:26:29 +0200 Subject: [PATCH 7/7] Fix rights --- scripts/_common.sh | 6 ++---- scripts/install | 8 -------- scripts/restore | 9 +-------- 3 files changed, 3 insertions(+), 20 deletions(-) diff --git a/scripts/_common.sh b/scripts/_common.sh index 9a4df38..660f7d8 100644 --- a/scripts/_common.sh +++ b/scripts/_common.sh @@ -34,12 +34,10 @@ myynh_set_permissions () { [ $(find "$final_path" -type d | wc -l) -gt 0 ] && find "$final_path" -type d | xargs chmod 0755 [ $(find "$datadir" -type f | wc -l) -gt 0 ] && find "$datadir" -type f | xargs chmod 0644 [ $(find "$datadir" -type d | wc -l) -gt 0 ] && find "$datadir" -type d | xargs chmod 0755 - chown -R root:"$app" "$final_path" - chown -R "$app": "$final_path/private" - chown -R "$app": "$datadir" - chown root: "$datadir" chmod -R o-rwx "$final_path" + chown -R $app:www-data "$final_path" chmod -R o-rwx "$datadir" + chown -R $app:www-data "$datadir" } #Convert --data to --data-urlencode before ynh_local_curl diff --git a/scripts/install b/scripts/install index ab80173..6fd5462 100644 --- a/scripts/install +++ b/scripts/install @@ -83,10 +83,6 @@ ynh_setup_source --dest_dir="$tmpdir" myynh_clean_source mv "$tmpdir" "$final_path" -chmod 750 "$final_path" -chmod -R o-rwx "$final_path" -chown -R $app:www-data "$final_path" - #================================================= # PHP-FPM CONFIGURATION #================================================= @@ -117,10 +113,6 @@ 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" - #================================================= # ADD A CONFIGURATION #================================================= diff --git a/scripts/restore b/scripts/restore index bfcc2ec..9f44279 100644 --- a/scripts/restore +++ b/scripts/restore @@ -54,10 +54,6 @@ ynh_script_progression --message="Restoring the app main directory..." --weight= 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 #================================================= @@ -67,10 +63,6 @@ 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 #================================================= @@ -98,6 +90,7 @@ ynh_restore_file --origin_path="/etc/nginx/conf.d/$domain.d/$app.conf" #================================================= # RESTORE USER RIGHTS #================================================= + myynh_set_permissions #=================================================