mirror of
https://github.com/YunoHost-Apps/transmission_ynh.git
synced 2024-09-04 01:46:12 +02:00
commit
cf164c6c32
6 changed files with 31 additions and 1 deletions
5
conf/90-transmission.conf
Normal file
5
conf/90-transmission.conf
Normal file
|
@ -0,0 +1,5 @@
|
|||
# These settings affect the size of the buffers for send and receive sockets.
|
||||
# Size of receive socket buffer
|
||||
net.core.rmem_max = 4194304
|
||||
# Size of send socket buffer
|
||||
net.core.wmem_max = 1048576
|
|
@ -42,6 +42,7 @@ ynh_backup --src_path="/etc/nginx/conf.d/$domain.d/$app.conf"
|
|||
ynh_script_progression --message="Backing up transmission configuration..."
|
||||
|
||||
ynh_backup --src_path="/etc/transmission-daemon/settings.json"
|
||||
ynh_backup --src_path="/etc/sysctl.d/90-transmission.conf"
|
||||
|
||||
#=================================================
|
||||
# BACKUP DATA
|
||||
|
|
|
@ -118,7 +118,6 @@ ynh_systemd_action --service_name=transmission-daemon --action=stop
|
|||
rpcpassword=$(ynh_string_random)
|
||||
ynh_app_setting_set --app=$app --key=rpcpassword --value="$rpcpassword"
|
||||
|
||||
|
||||
ynh_replace_string --match_string="__RPC_PASSWORD_TO_CHANGE__" --replace_string="$rpcpassword" --target_file=../conf/settings.json
|
||||
if [ "$path_url" != "/" ]
|
||||
then
|
||||
|
@ -130,11 +129,17 @@ ynh_replace_string --match_string="__PEER_PORT__" --replace_string="$peer_port"
|
|||
ynh_replace_string --match_string="__PORT__" --replace_string="$port" --target_file=../conf/settings.json
|
||||
cp ../conf/settings.json /etc/transmission-daemon/settings.json
|
||||
|
||||
cp ../conf/90-transmission.conf /etc/sysctl.d/90-transmission.conf
|
||||
if [ ${PACKAGE_CHECK_EXEC:-0} -eq 0 ]; then
|
||||
sysctl --load=/etc/sysctl.d/90-transmission.conf
|
||||
fi
|
||||
|
||||
#=================================================
|
||||
# STORE THE CHECKSUM OF THE CONFIG FILE
|
||||
#=================================================
|
||||
|
||||
ynh_store_file_checksum --file=/etc/transmission-daemon/settings.json
|
||||
ynh_store_file_checksum --file=/etc/sysctl.d/90-transmission.conf
|
||||
|
||||
#=================================================
|
||||
# YUNOHOST MULTIMEDIA INTEGRATION
|
||||
|
|
|
@ -75,6 +75,11 @@ ynh_script_progression --message="Removing transmission data..."
|
|||
ynh_secure_remove --file=/usr/share/transmission
|
||||
# And data
|
||||
ynh_secure_remove --file=/var/lib/transmission-daemon
|
||||
# Kernel parameters
|
||||
ynh_secure_remove --file=/etc/sysctl.d/90-transmission.conf
|
||||
if [ ${PACKAGE_CHECK_EXEC:-0} -eq 0 ]; then
|
||||
sysctl --load=/etc/sysctl.d/90-transmission.conf
|
||||
fi
|
||||
|
||||
#=================================================
|
||||
# GENERIC FINALISATION
|
||||
|
|
|
@ -73,6 +73,11 @@ 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_restore_file --origin_path="/etc/sysctl.d/90-transmission.conf"
|
||||
if [ ${PACKAGE_CHECK_EXEC:-0} -eq 0 ]; then
|
||||
sysctl --load=/etc/sysctl.d/90-transmission.conf
|
||||
fi
|
||||
|
||||
#=================================================
|
||||
# RESTORE DATA
|
||||
#=================================================
|
||||
|
|
|
@ -134,12 +134,21 @@ ynh_replace_string --match_string="__PEER_PORT__" --replace_string="$peer_port"
|
|||
ynh_replace_string --match_string="__PORT__" --replace_string="$port" --target_file=../conf/settings.json
|
||||
cp ../conf/settings.json /etc/transmission-daemon/settings.json
|
||||
|
||||
# Verify the checksum and backup the file if it's different
|
||||
ynh_backup_if_checksum_is_different --file=/etc/sysctl.d/90-transmission.conf
|
||||
|
||||
cp ../conf/90-transmission.conf /etc/sysctl.d/90-transmission.conf
|
||||
if [ ${PACKAGE_CHECK_EXEC:-0} -eq 0 ]; then
|
||||
sysctl --load=/etc/sysctl.d/90-transmission.conf
|
||||
fi
|
||||
|
||||
#=================================================
|
||||
# STORE THE CHECKSUM OF THE CONFIG FILE
|
||||
#=================================================
|
||||
|
||||
# Recalculate and store the config file checksum into the app settings
|
||||
ynh_store_file_checksum --file=/etc/transmission-daemon/settings.json
|
||||
ynh_store_file_checksum --file=/etc/sysctl.d/90-transmission.conf
|
||||
|
||||
#=================================================
|
||||
# YUNOHOST MULTIMEDIA INTEGRATION
|
||||
|
|
Loading…
Add table
Reference in a new issue