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 #=================================================