From df75c8fb5ac46351a528bf6f5484367fc55d6955 Mon Sep 17 00:00:00 2001 From: yalh76 Date: Fri, 9 Apr 2021 21:58:27 +0200 Subject: [PATCH 01/11] Apply example_ynh --- README.md | 4 +- check_process | 5 -- manifest.json | 28 +++------- scripts/backup | 2 +- scripts/change_url | 20 +++---- scripts/install | 49 ++++++++--------- scripts/remove | 6 +-- scripts/restore | 36 ++++++------- scripts/upgrade | 60 ++++++++++----------- scripts/{detect_arch => ynh_detect_arch__2} | 0 10 files changed, 93 insertions(+), 117 deletions(-) rename scripts/{detect_arch => ynh_detect_arch__2} (100%) diff --git a/README.md b/README.md index 33ff707..a3a3f58 100644 --- a/README.md +++ b/README.md @@ -23,8 +23,8 @@ Syncthing replaces proprietary sync and cloud services with something open, trus #### Supported architectures -* x86-64 - [![Build Status](https://ci-apps.yunohost.org/ci/logs/syncthing%20%28Apps%29.svg)](https://ci-apps.yunohost.org/ci/apps/syncthing/) -* ARMv8-A - [![Build Status](https://ci-apps-arm.yunohost.org/ci/logs/syncthing%20%28Apps%29.svg)](https://ci-apps-arm.yunohost.org/ci/apps/syncthing/) +* x86-64 - [![Build Status](https://ci-apps.yunohost.org/ci/logs/syncthing.svg)](https://ci-apps.yunohost.org/ci/apps/syncthing/) +* ARMv8-A - [![Build Status](https://ci-apps-arm.yunohost.org/ci/logs/syncthing.svg)](https://ci-apps-arm.yunohost.org/ci/apps/syncthing/) ## Links diff --git a/check_process b/check_process index 9bb6d63..60e3ab6 100644 --- a/check_process +++ b/check_process @@ -1,8 +1,3 @@ -# See here for more information -# https://github.com/YunoHost/package_check#syntax-check_process-file - -# Move this file from check_process.default to check_process when you have filled it. - ;; Test complet ; Manifest domain="domain.tld" (DOMAIN) diff --git a/manifest.json b/manifest.json index 6a978ad..1b23040 100644 --- a/manifest.json +++ b/manifest.json @@ -23,38 +23,26 @@ }, "multi_instance": false, "services": [ - "nginx" + "nginx" ], "arguments": { - "install": [ + "install" : [ { "name": "domain", "type": "domain", - "ask": { - "en": "Choose a domain for Syncthing", - "fr": "Choisissez un nom de domaine pour Syncthing" - }, "example": "example.com" }, { "name": "path", "type": "path", - "ask": { - "en": "Choose a path for Syncthing", - "fr": "Choisissez un chemin pour Syncthing" - }, "example": "/syncthing", "default": "/syncthing" - }, - { - "name": "admin", - "type": "user", - "ask": { - "en": "Choose an admin user", - "fr": "Choisissez l'administrateur" - }, - "example": "johndoe" - } + }, + { + "name": "admin", + "type": "user", + "example": "johndoe" + } ] } } diff --git a/scripts/backup b/scripts/backup index ccef97b..cb832ff 100644 --- a/scripts/backup +++ b/scripts/backup @@ -6,7 +6,7 @@ # 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 diff --git a/scripts/change_url b/scripts/change_url index 25019c7..caac7fc 100644 --- a/scripts/change_url +++ b/scripts/change_url @@ -36,9 +36,9 @@ final_path=$(ynh_app_setting_get --app=$app --key=final_path) gui_port=$(ynh_app_setting_get --app=$app --key=gui_port) #================================================= -# 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)..." +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 @@ -46,7 +46,7 @@ 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 + # Restore it if the upgrade fails ynh_restore_upgradebackup } # Exit if an error occurs during the execution of the script @@ -80,23 +80,23 @@ ynh_systemd_action --service_name=$app --action="stop" --log_path=systemd #================================================= # MODIFY URL IN NGINX CONF #================================================= -ynh_script_progression --message="Updating nginx web server configuration..." +ynh_script_progression --message="Updating NGINX web server configuration..." nginx_conf_path=/etc/nginx/conf.d/$old_domain.d/$app.conf -# Change the path in the nginx config file +# 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 + # 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 + # 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 "gui_port" fi -# Change the domain for nginx +# Change the domain for NGINX if [ $change_domain -eq 1 ] then # Delete file checksum for the old conf file location @@ -119,7 +119,7 @@ ynh_systemd_action --service_name=$app --action="start" --log_path=systemd --lin #================================================= # 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 diff --git a/scripts/install b/scripts/install index 2eb1e14..0b9458d 100644 --- a/scripts/install +++ b/scripts/install @@ -7,7 +7,7 @@ #================================================= source _common.sh -source detect_arch +source ynh_detect_arch__2 source /usr/share/yunohost/helpers #================================================= @@ -72,6 +72,14 @@ ynh_app_setting_set --app=$app --key=sync_port --value=$sync_port ynh_script_progression --message="Configuring firewall..." ynh_exec_warn_less yunohost firewall allow TCP $sync_port +#================================================= +# CREATE DEDICATED USER +#================================================= +ynh_script_progression --message="Configuring system user..." + +# Create a system user +ynh_system_user_create --username=$app --home_dir="$final_path" + #================================================= # DOWNLOAD, CHECK AND UNPACK SOURCE #================================================= @@ -81,22 +89,18 @@ 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" --source_id=$architecture +chmod 750 "$final_path" +chmod -R o-rwx "$final_path" +chown -R root:$app "$final_path" + #================================================= # NGINX CONFIGURATION #================================================= -ynh_script_progression --message="Configuring nginx web server..." +ynh_script_progression --message="Configuring NGINX web server..." -# Create a dedicated nginx config +# Create a dedicated NGINX config ynh_add_nginx_config "gui_port" -#================================================= -# CREATE DEDICATED USER -#================================================= -ynh_script_progression --message="Configuring system user..." - -# Create a system user -ynh_system_user_create --username=$app --home_dir=$final_path - #================================================= # SPECIFIC SETUP #================================================= @@ -106,7 +110,9 @@ ynh_script_progression --message="Creating sync directory..." # Make directories and set rights mkdir -p "$sync_home" -chown -R "$app": "$sync_home" +chmod 750 "$sync_home" +chmod -R o-rwx "$sync_home" +chown -R root:$app "$sync_home" #================================================= # SETUP SYSTEMD @@ -117,14 +123,17 @@ ynh_script_progression --message="Configuring a systemd service..." ynh_add_systemd_config #================================================= -# MODIFY A CONFIG FILE +# ADD A CONFIGURATION #================================================= -ynh_script_progression --message="Modifying a config file..." +ynh_script_progression --message="Adding a config file..." mkdir -p "$final_path/.config/syncthing" config_file="$final_path/.config/syncthing/config.xml" ynh_add_config --template="../conf/config.xml" --destination="$config_file" +chmod 400 "$final_path/some_config_file" +chown $app:$app "$final_path/some_config_file" + #================================================= # FIX LISTENING SERVICE #================================================= @@ -148,20 +157,12 @@ ynh_store_file_checksum --file="$config_file" #================================================= # GENERIC FINALIZATION -#================================================= -# SECURE FILES AND DIRECTORIES -#================================================= -ynh_script_progression --message="Securing files and directories..." - -# Set permissions to app files -chown -R $app: $final_path - #================================================= # INTEGRATE SERVICE IN YUNOHOST #================================================= ynh_script_progression --message="Integrating service in YunoHost..." -yunohost service add $app --description "$app daemon for Syncthing" --needs_exposed_ports $sync_port +yunohost service add $app --description="$app daemon for Syncthing" --needs_exposed_ports=$sync_port #================================================= # START SYSTEMD SERVICE @@ -182,7 +183,7 @@ ynh_permission_update --permission="main" --add="visitors" #================================================= # 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 diff --git a/scripts/remove b/scripts/remove index 60b3656..455f8b1 100644 --- a/scripts/remove +++ b/scripts/remove @@ -27,7 +27,7 @@ sync_port=$(ynh_app_setting_get --app=$app --key=sync_port) # REMOVE SERVICE INTEGRATION IN YUNOHOST #================================================= -# Remove the service from the list of services known by Yunohost (added from `yunohost service add`) +# Remove the service from the list of services known by YunoHost (added from `yunohost service add`) if ynh_exec_warn_less yunohost service status $app >/dev/null then ynh_script_progression --message="Removing $app service integration..." @@ -53,9 +53,9 @@ ynh_secure_remove --file="$final_path" #================================================= # REMOVE NGINX CONFIGURATION #================================================= -ynh_script_progression --message="Removing nginx web server configuration..." +ynh_script_progression --message="Removing NGINX web server configuration..." -# Remove the dedicated nginx config +# Remove the dedicated NGINX config ynh_remove_nginx_config #================================================= diff --git a/scripts/restore b/scripts/restore index a1293f9..79a7139 100644 --- a/scripts/restore +++ b/scripts/restore @@ -6,7 +6,7 @@ # 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 @@ -56,10 +56,18 @@ ynh_exec_warn_less yunohost firewall allow TCP $sync_port #================================================= # RESTORE THE NGINX CONFIGURATION #================================================= -ynh_script_progression --message="Restoring 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" +#================================================= +# RECREATE THE DEDICATED USER +#================================================= +ynh_script_progression --message="Recreating the dedicated system user..." + +# Create the dedicated user (if not existing) +ynh_system_user_create --username=$app --home_dir="$final_path" + #================================================= # RESTORE THE APP MAIN DIR #================================================= @@ -67,21 +75,9 @@ ynh_script_progression --message="Restoring the app main directory..." ynh_restore_file --origin_path="$final_path" -#================================================= -# RECREATE THE DEDICATED USER -#================================================= -ynh_script_progression --message="Recreating the dedicated system user..." - -# Create the dedicated user (if not existing) -ynh_system_user_create --username=$app --home_dir=$final_path - -#================================================= -# RESTORE USER RIGHTS -#================================================= -ynh_script_progression --message="Restoring user rights..." - -# Restore permissions on app files -chown -R "$app": $final_path +chmod 750 "$final_path" +chmod -R o-rwx "$final_path" +chown -R root:$app "$final_path" #================================================= # SPECIFIC RESTORATION @@ -95,7 +91,9 @@ ynh_restore_file --origin_path="$sync_home" --not_mandatory # Make directories and set rights mkdir -p "$sync_home" -chown -R "$app": "$sync_home" +chmod 750 "$sync_home" +chmod -R o-rwx "$sync_home" +chown -R root:$app "$sync_home" #================================================= # RESTORE SYSTEMD @@ -110,7 +108,7 @@ systemctl enable $app.service --quiet #================================================= ynh_script_progression --message="Integrating service in YunoHost..." -yunohost service add $app --description "$app daemon for Syncthing" --needs_exposed_ports $sync_port +yunohost service add $app --description="$app daemon for Syncthing" --needs_exposed_ports=$sync_port #================================================= # START SYSTEMD SERVICE diff --git a/scripts/upgrade b/scripts/upgrade index ac47955..6e04295 100644 --- a/scripts/upgrade +++ b/scripts/upgrade @@ -7,7 +7,7 @@ #================================================= source _common.sh -source detect_arch +source ynh_detect_arch__2 source /usr/share/yunohost/helpers #================================================= @@ -121,6 +121,14 @@ else fi +#================================================= +# 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 #================================================= @@ -136,19 +144,11 @@ fi #================================================= # NGINX CONFIGURATION #================================================= -ynh_script_progression --message="Upgrading nginx web server configuration..." +ynh_script_progression --message="Upgrading NGINX web server configuration..." -# Create a dedicated nginx config +# Create a dedicated NGINX config ynh_add_nginx_config "gui_port" -#================================================= -# 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 - #================================================= # SPECIFIC UPGRADE #================================================= @@ -158,18 +158,9 @@ ynh_script_progression --message="Creating sync directory..." # Make directories and set rights mkdir -p "$sync_home" -chown -R "$app": "$sync_home" - -#================================================= -# STORE THE CONFIG FILE CHECKSUM -#================================================= -ynh_script_progression --message="Storing the config file checksum..." - -config_file="$final_path/.config/syncthing/config.xml" - -ynh_backup_if_checksum_is_different --file="$config_file" -# Recalculate and store the checksum of the file for the next upgrade. -ynh_store_file_checksum --file="$config_file" +chmod 750 "$sync_home" +chmod -R o-rwx "$sync_home" +chown -R root:$app "$sync_home" #================================================= # SETUP SYSTEMD @@ -179,22 +170,25 @@ ynh_script_progression --message="Upgrading systemd configuration..." # Create a dedicated systemd config ynh_add_systemd_config +#================================================= +# UPDATE A CONFIG FILE +#================================================= +ynh_script_progression --message="Updating a config file..." + +config_file="$final_path/.config/syncthing/config.xml" + +ynh_backup_if_checksum_is_different --file="$config_file" +# Recalculate and store the checksum of the file for the next upgrade. +ynh_store_file_checksum --file="$config_file" + #================================================= # GENERIC FINALIZATION -#================================================= -# SECURE FILES AND DIRECTORIES -#================================================= -ynh_script_progression --message="Securing files and directories..." - -# Set permissions on app files -chown -R $app: $final_path - #================================================= # INTEGRATE SERVICE IN YUNOHOST #================================================= ynh_script_progression --message="Integrating service in YunoHost..." -yunohost service add $app --description "$app daemon for Syncthing" --needs_exposed_ports $sync_port +yunohost service add $app --description="$app daemon for Syncthing" --needs_exposed_ports=$sync_port #================================================= # START SYSTEMD SERVICE @@ -206,7 +200,7 @@ ynh_systemd_action --service_name=$app --action="start" --log_path=systemd --lin #================================================= # 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 diff --git a/scripts/detect_arch b/scripts/ynh_detect_arch__2 similarity index 100% rename from scripts/detect_arch rename to scripts/ynh_detect_arch__2 From 379825362a1704b554833f17737c536052c18b4c Mon Sep 17 00:00:00 2001 From: yalh76 Date: Fri, 9 Apr 2021 23:07:53 +0200 Subject: [PATCH 02/11] Update upgrade --- scripts/upgrade | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/scripts/upgrade b/scripts/upgrade index 6e04295..6e6d945 100644 --- a/scripts/upgrade +++ b/scripts/upgrade @@ -88,7 +88,7 @@ if [ -z $gui_port ]; then else #================================================= - # BACKUP BEFORE UPGRADE THEN ACTIVE TRAP + # BACKUP BEFORE CHANGE URL THEN ACTIVE TRAP #================================================= ynh_script_progression --message="Backing up the app before upgrading (may take a while)..." @@ -104,7 +104,7 @@ else ynh_clean_setup () { ynh_clean_check_starting - # 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 From 9db09e3a80540c327e0f4d6a18911dfd4127802b Mon Sep 17 00:00:00 2001 From: yalh76 Date: Fri, 9 Apr 2021 23:33:52 +0200 Subject: [PATCH 03/11] Update restore --- scripts/restore | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/scripts/restore b/scripts/restore index 79a7139..e4dee15 100644 --- a/scripts/restore +++ b/scripts/restore @@ -23,7 +23,7 @@ ynh_abort_if_errors #================================================= # LOAD SETTINGS #================================================= -ynh_script_progression --message="Loading settings..." +ynh_script_progression --message="Loading installation settings..." app=$YNH_APP_INSTANCE_NAME From e86eaf1945319f9fd850685088c21fab0970bfa4 Mon Sep 17 00:00:00 2001 From: yalh76 Date: Sat, 10 Apr 2021 01:56:54 +0200 Subject: [PATCH 04/11] Update install --- scripts/install | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/scripts/install b/scripts/install index 0b9458d..aa511ac 100644 --- a/scripts/install +++ b/scripts/install @@ -131,8 +131,8 @@ mkdir -p "$final_path/.config/syncthing" config_file="$final_path/.config/syncthing/config.xml" ynh_add_config --template="../conf/config.xml" --destination="$config_file" -chmod 400 "$final_path/some_config_file" -chown $app:$app "$final_path/some_config_file" +chmod 400 "$config_file" +chown $app:$app "$config_file" #================================================= # FIX LISTENING SERVICE From 59ad7dd4dbd4a81d25db3174b996390e7518538e Mon Sep 17 00:00:00 2001 From: yalh76 Date: Sat, 10 Apr 2021 02:20:49 +0200 Subject: [PATCH 05/11] Update manifest.json --- manifest.json | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/manifest.json b/manifest.json index 1b23040..40acec7 100644 --- a/manifest.json +++ b/manifest.json @@ -6,7 +6,7 @@ "en": "Continuous file synchronization program.", "fr": "Programme de synchronisation de fichiers en continu." }, - "version": "1.15.1~ynh1", + "version": "1.15.1~ynh2", "url": "https://syncthing.net/", "license": "MPL-2.0", "maintainer": [ From 52d1015d2e30a9541c6d203a43cce554996745f4 Mon Sep 17 00:00:00 2001 From: yalh76 Date: Sat, 10 Apr 2021 16:56:02 +0200 Subject: [PATCH 06/11] Update check_process --- check_process | 6 +++++- 1 file changed, 5 insertions(+), 1 deletion(-) diff --git a/check_process b/check_process index 60e3ab6..85ef6e9 100644 --- a/check_process +++ b/check_process @@ -35,6 +35,8 @@ upgrade=1 from_commit=ae0a88df0bf4a3d684f95e21245ee1e0de4d54f4 # 1.14.0~ynh2 upgrade=1 from_commit=201eab3c30f6a72de8c704190e66e11baf517a8a + # 1.15.1~ynh1 + upgrade=1 from_commit=f373714a18c855c936c86b389d1ef0cf46da447b backup_restore=1 multi_instance=0 port_already_use=0 @@ -66,4 +68,6 @@ Notification=all ; commit=ae0a88df0bf4a3d684f95e21245ee1e0de4d54f4 name=1.14.0~ynh1 ; commit=201eab3c30f6a72de8c704190e66e11baf517a8a - name=1.14.0~ynh2 \ No newline at end of file + name=1.14.0~ynh2 + ; commit=f373714a18c855c936c86b389d1ef0cf46da447b + name=1.15.1~ynh1 \ No newline at end of file From e7a5ecf9395bc45b0b60ebfb203b8b394b81eb88 Mon Sep 17 00:00:00 2001 From: yalh76 Date: Sat, 10 Apr 2021 16:57:09 +0200 Subject: [PATCH 07/11] Update check_process --- check_process | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/check_process b/check_process index 85ef6e9..e25ccb5 100644 --- a/check_process +++ b/check_process @@ -70,4 +70,4 @@ Notification=all ; commit=201eab3c30f6a72de8c704190e66e11baf517a8a name=1.14.0~ynh2 ; commit=f373714a18c855c936c86b389d1ef0cf46da447b - name=1.15.1~ynh1 \ No newline at end of file + name=1.15.1~ynh1 From 5b79996c88c89c3ce3c6e464d1b3ce9efa04795c Mon Sep 17 00:00:00 2001 From: yalh76 Date: Sat, 10 Apr 2021 18:58:35 +0200 Subject: [PATCH 08/11] Update upgrade --- scripts/upgrade | 4 ++++ 1 file changed, 4 insertions(+) diff --git a/scripts/upgrade b/scripts/upgrade index 6e6d945..8f93da0 100644 --- a/scripts/upgrade +++ b/scripts/upgrade @@ -141,6 +141,10 @@ then ynh_setup_source --dest_dir="$final_path" --source_id=$architecture fi +chmod 750 "$final_path" +chmod -R o-rwx "$final_path" +chown -R root:$app "$final_path" + #================================================= # NGINX CONFIGURATION #================================================= From 72127a93bc9bd4e13b67aa6447e0dd149b9e9030 Mon Sep 17 00:00:00 2001 From: yalh76 Date: Sun, 11 Apr 2021 21:04:07 +0200 Subject: [PATCH 09/11] Fix rights --- scripts/install | 20 ++++++++++---------- scripts/restore | 4 ++-- scripts/upgrade | 23 +++++++++++++---------- 3 files changed, 25 insertions(+), 22 deletions(-) diff --git a/scripts/install b/scripts/install index aa511ac..7a559d6 100644 --- a/scripts/install +++ b/scripts/install @@ -91,7 +91,7 @@ ynh_setup_source --dest_dir="$final_path" --source_id=$architecture chmod 750 "$final_path" chmod -R o-rwx "$final_path" -chown -R root:$app "$final_path" +chown -R $app:$app "$final_path" #================================================= # NGINX CONFIGURATION @@ -112,15 +112,7 @@ ynh_script_progression --message="Creating sync directory..." mkdir -p "$sync_home" chmod 750 "$sync_home" chmod -R o-rwx "$sync_home" -chown -R root:$app "$sync_home" - -#================================================= -# SETUP SYSTEMD -#================================================= -ynh_script_progression --message="Configuring a systemd service..." - -# Create a dedicated systemd config -ynh_add_systemd_config +chown -R $app:$app "$sync_home" #================================================= # ADD A CONFIGURATION @@ -134,6 +126,14 @@ ynh_add_config --template="../conf/config.xml" --destination="$config_file" chmod 400 "$config_file" chown $app:$app "$config_file" +#================================================= +# SETUP SYSTEMD +#================================================= +ynh_script_progression --message="Configuring a systemd service..." + +# Create a dedicated systemd config +ynh_add_systemd_config + #================================================= # FIX LISTENING SERVICE #================================================= diff --git a/scripts/restore b/scripts/restore index e4dee15..f9eaca4 100644 --- a/scripts/restore +++ b/scripts/restore @@ -77,7 +77,7 @@ ynh_restore_file --origin_path="$final_path" chmod 750 "$final_path" chmod -R o-rwx "$final_path" -chown -R root:$app "$final_path" +chown -R $app:$app "$final_path" #================================================= # SPECIFIC RESTORATION @@ -93,7 +93,7 @@ ynh_restore_file --origin_path="$sync_home" --not_mandatory mkdir -p "$sync_home" chmod 750 "$sync_home" chmod -R o-rwx "$sync_home" -chown -R root:$app "$sync_home" +chown -R $app:$app "$sync_home" #================================================= # RESTORE SYSTEMD diff --git a/scripts/upgrade b/scripts/upgrade index 8f93da0..d38071a 100644 --- a/scripts/upgrade +++ b/scripts/upgrade @@ -143,7 +143,7 @@ fi chmod 750 "$final_path" chmod -R o-rwx "$final_path" -chown -R root:$app "$final_path" +chown -R $app:$app "$final_path" #================================================= # NGINX CONFIGURATION @@ -164,15 +164,7 @@ ynh_script_progression --message="Creating sync directory..." mkdir -p "$sync_home" chmod 750 "$sync_home" chmod -R o-rwx "$sync_home" -chown -R root:$app "$sync_home" - -#================================================= -# SETUP SYSTEMD -#================================================= -ynh_script_progression --message="Upgrading systemd configuration..." - -# Create a dedicated systemd config -ynh_add_systemd_config +chown -R $app:$app "$sync_home" #================================================= # UPDATE A CONFIG FILE @@ -185,6 +177,17 @@ ynh_backup_if_checksum_is_different --file="$config_file" # Recalculate and store the checksum of the file for the next upgrade. ynh_store_file_checksum --file="$config_file" +chmod 400 "$config_file" +chown $app:$app "$config_file" + +#================================================= +# SETUP SYSTEMD +#================================================= +ynh_script_progression --message="Upgrading systemd configuration..." + +# Create a dedicated systemd config +ynh_add_systemd_config + #================================================= # GENERIC FINALIZATION #================================================= From dd38151dd5cd3103879d601dab8c6bb9830560cc Mon Sep 17 00:00:00 2001 From: yalh76 Date: Thu, 15 Apr 2021 20:29:55 +0200 Subject: [PATCH 10/11] Fix chmod --- scripts/install | 4 ++-- scripts/restore | 4 ++-- scripts/upgrade | 4 ++-- 3 files changed, 6 insertions(+), 6 deletions(-) diff --git a/scripts/install b/scripts/install index 7a559d6..a040695 100644 --- a/scripts/install +++ b/scripts/install @@ -89,7 +89,7 @@ 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" --source_id=$architecture -chmod 750 "$final_path" +chmod -R 750 "$final_path" chmod -R o-rwx "$final_path" chown -R $app:$app "$final_path" @@ -110,7 +110,7 @@ ynh_script_progression --message="Creating sync directory..." # Make directories and set rights mkdir -p "$sync_home" -chmod 750 "$sync_home" +chmod -R 750 "$sync_home" chmod -R o-rwx "$sync_home" chown -R $app:$app "$sync_home" diff --git a/scripts/restore b/scripts/restore index f9eaca4..0284710 100644 --- a/scripts/restore +++ b/scripts/restore @@ -75,7 +75,7 @@ ynh_script_progression --message="Restoring the app main directory..." ynh_restore_file --origin_path="$final_path" -chmod 750 "$final_path" +chmod -R 750 "$final_path" chmod -R o-rwx "$final_path" chown -R $app:$app "$final_path" @@ -91,7 +91,7 @@ ynh_restore_file --origin_path="$sync_home" --not_mandatory # Make directories and set rights mkdir -p "$sync_home" -chmod 750 "$sync_home" +chmod -R 750 "$sync_home" chmod -R o-rwx "$sync_home" chown -R $app:$app "$sync_home" diff --git a/scripts/upgrade b/scripts/upgrade index d38071a..513ff2b 100644 --- a/scripts/upgrade +++ b/scripts/upgrade @@ -141,7 +141,7 @@ then ynh_setup_source --dest_dir="$final_path" --source_id=$architecture fi -chmod 750 "$final_path" +chmod -R 750 "$final_path" chmod -R o-rwx "$final_path" chown -R $app:$app "$final_path" @@ -162,7 +162,7 @@ ynh_script_progression --message="Creating sync directory..." # Make directories and set rights mkdir -p "$sync_home" -chmod 750 "$sync_home" +chmod -R 750 "$sync_home" chmod -R o-rwx "$sync_home" chown -R $app:$app "$sync_home" From 11e658cad5da4fbba61db9c9f2c3e689fc28e09f Mon Sep 17 00:00:00 2001 From: yalh76 Date: Sat, 17 Apr 2021 18:32:25 +0200 Subject: [PATCH 11/11] Fix recursive chmod --- scripts/install | 4 ++-- scripts/restore | 4 ++-- scripts/upgrade | 4 ++-- 3 files changed, 6 insertions(+), 6 deletions(-) diff --git a/scripts/install b/scripts/install index a040695..7a559d6 100644 --- a/scripts/install +++ b/scripts/install @@ -89,7 +89,7 @@ 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" --source_id=$architecture -chmod -R 750 "$final_path" +chmod 750 "$final_path" chmod -R o-rwx "$final_path" chown -R $app:$app "$final_path" @@ -110,7 +110,7 @@ ynh_script_progression --message="Creating sync directory..." # Make directories and set rights mkdir -p "$sync_home" -chmod -R 750 "$sync_home" +chmod 750 "$sync_home" chmod -R o-rwx "$sync_home" chown -R $app:$app "$sync_home" diff --git a/scripts/restore b/scripts/restore index 0284710..f9eaca4 100644 --- a/scripts/restore +++ b/scripts/restore @@ -75,7 +75,7 @@ ynh_script_progression --message="Restoring the app main directory..." ynh_restore_file --origin_path="$final_path" -chmod -R 750 "$final_path" +chmod 750 "$final_path" chmod -R o-rwx "$final_path" chown -R $app:$app "$final_path" @@ -91,7 +91,7 @@ ynh_restore_file --origin_path="$sync_home" --not_mandatory # Make directories and set rights mkdir -p "$sync_home" -chmod -R 750 "$sync_home" +chmod 750 "$sync_home" chmod -R o-rwx "$sync_home" chown -R $app:$app "$sync_home" diff --git a/scripts/upgrade b/scripts/upgrade index 513ff2b..d38071a 100644 --- a/scripts/upgrade +++ b/scripts/upgrade @@ -141,7 +141,7 @@ then ynh_setup_source --dest_dir="$final_path" --source_id=$architecture fi -chmod -R 750 "$final_path" +chmod 750 "$final_path" chmod -R o-rwx "$final_path" chown -R $app:$app "$final_path" @@ -162,7 +162,7 @@ ynh_script_progression --message="Creating sync directory..." # Make directories and set rights mkdir -p "$sync_home" -chmod -R 750 "$sync_home" +chmod 750 "$sync_home" chmod -R o-rwx "$sync_home" chown -R $app:$app "$sync_home"