1
0
Fork 0
mirror of https://github.com/YunoHost-Apps/transmission_ynh.git synced 2024-09-04 01:46:12 +02:00

Store file to settings file in a common variable

This commit is contained in:
Félix Piédallu 2023-12-06 11:24:08 +01:00 committed by Salamandar
parent 1ef72c9f73
commit c0fe08ddbc
6 changed files with 14 additions and 12 deletions

View file

@ -4,6 +4,8 @@
# COMMON VARIABLES
#=================================================
SETTINGS_FILE="/etc/transmission-daemon/settings.json"
#=================================================
# PERSONAL HELPERS
#=================================================

View file

@ -33,7 +33,7 @@ ynh_backup --src_path="/etc/nginx/conf.d/$domain.d/$app.conf"
# BACKUP VARIOUS FILES
#=================================================
ynh_backup --src_path="/etc/transmission-daemon/settings.json"
ynh_backup --src_path="$SETTINGS_FILE"
if [ -e /proc/sys/net/core/rmem_max ]
then
ynh_backup --src_path="/etc/sysctl.d/90-transmission.conf"

View file

@ -31,11 +31,11 @@ ynh_change_url_nginx_config
# UPDATE TRANSMISSION CONFIGURATION
#=================================================
ynh_backup_if_checksum_is_different --file="/etc/transmission-daemon/settings.json"
ynh_backup_if_checksum_is_different --file="$SETTINGS_FILE"
ynh_replace_string --match_string="rpc-url\": \"${old_path%/}/transmission/" --replace_string="rpc-url\": \"${new_path%/}/transmission/" --target_file="/etc/transmission-daemon/settings.json"
ynh_replace_string --match_string="rpc-url\": \"${old_path%/}/transmission/" --replace_string="rpc-url\": \"${new_path%/}/transmission/" --target_file="$SETTINGS_FILE"
ynh_store_file_checksum --file="/etc/transmission-daemon/settings.json"
ynh_store_file_checksum --file="$SETTINGS_FILE"
#=================================================
# GENERIC FINALISATION

View file

@ -51,10 +51,10 @@ else
path_less="$path"
fi
ynh_add_config --template="../conf/settings.json" --destination="/etc/transmission-daemon/settings.json"
ynh_add_config --template="../conf/settings.json" --destination="$SETTINGS_FILE"
chmod 400 "/etc/transmission-daemon/settings.json"
chown debian-transmission:debian-transmission "/etc/transmission-daemon/settings.json"
chmod 400 "$SETTINGS_FILE"
chown debian-transmission:debian-transmission "$SETTINGS_FILE"
if [ -e /proc/sys/net/core/rmem_max ]
then

View file

@ -37,8 +37,8 @@ ynh_script_progression --message="Restoring various files..." --weight=2
# Transmission has to be stopped before modifying its config
ynh_systemd_action --service_name=transmission-daemon --action=stop
ynh_secure_remove --file=/etc/transmission-daemon/settings.json
ynh_restore_file --origin_path=/etc/transmission-daemon/settings.json
ynh_secure_remove --file="$SETTINGS_FILE"
ynh_restore_file --origin_path="$SETTINGS_FILE"
if [ -e /proc/sys/net/core/rmem_max ]
then

View file

@ -44,10 +44,10 @@ else
path_less="$path"
fi
ynh_add_config --template="../conf/settings.json" --destination="/etc/transmission-daemon/settings.json"
ynh_add_config --template="../conf/settings.json" --destination="$SETTINGS_FILE"
chmod 400 "/etc/transmission-daemon/settings.json"
chown debian-transmission:debian-transmission "/etc/transmission-daemon/settings.json"
chmod 400 "$SETTINGS_FILE"
chown debian-transmission:debian-transmission "$SETTINGS_FILE"
if [ -e /proc/sys/net/core/rmem_max ]
then