diff --git a/conf/90-transmission.conf b/conf/90-transmission.conf new file mode 100644 index 0000000..718730e --- /dev/null +++ b/conf/90-transmission.conf @@ -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 diff --git a/scripts/backup b/scripts/backup index 1de0df9..a20a6a9 100644 --- a/scripts/backup +++ b/scripts/backup @@ -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 diff --git a/scripts/install b/scripts/install index 743f9d9..d2a7009 100644 --- a/scripts/install +++ b/scripts/install @@ -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 diff --git a/scripts/remove b/scripts/remove index 230f7bd..5fc03e2 100644 --- a/scripts/remove +++ b/scripts/remove @@ -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 diff --git a/scripts/restore b/scripts/restore index 4dfeaeb..a7b7a12 100644 --- a/scripts/restore +++ b/scripts/restore @@ -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 #================================================= diff --git a/scripts/upgrade b/scripts/upgrade index 2c4ca9e..9ad3d67 100644 --- a/scripts/upgrade +++ b/scripts/upgrade @@ -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