diff --git a/scripts/backup b/scripts/backup index a20a6a9..8a89d8b 100644 --- a/scripts/backup +++ b/scripts/backup @@ -42,7 +42,10 @@ 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" +if [ -e /proc/sys/net/core/rmem_max ] +then + ynh_backup --src_path="/etc/sysctl.d/90-transmission.conf" +fi #================================================= # BACKUP DATA diff --git a/scripts/install b/scripts/install index 12c341d..29b606e 100644 --- a/scripts/install +++ b/scripts/install @@ -129,8 +129,9 @@ 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 [ -e /proc/sys/net/core/rmem_max ]; then +if [ -e /proc/sys/net/core/rmem_max ] +then + cp ../conf/90-transmission.conf /etc/sysctl.d/90-transmission.conf sysctl --load=/etc/sysctl.d/90-transmission.conf fi @@ -139,7 +140,10 @@ fi #================================================= ynh_store_file_checksum --file=/etc/transmission-daemon/settings.json -ynh_store_file_checksum --file=/etc/sysctl.d/90-transmission.conf +if [ -e /proc/sys/net/core/rmem_max ] +then + ynh_store_file_checksum --file=/etc/sysctl.d/90-transmission.conf +fi #================================================= # YUNOHOST MULTIMEDIA INTEGRATION diff --git a/scripts/remove b/scripts/remove index 76b964c..f7d53f8 100644 --- a/scripts/remove +++ b/scripts/remove @@ -76,8 +76,9 @@ 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 +if [ ${PACKAGE_CHECK_EXEC:-0} -eq 0 ] +then + ynh_secure_remove --file=/etc/sysctl.d/90-transmission.conf sysctl --load=/etc/sysctl.d/90-transmission.conf fi diff --git a/scripts/restore b/scripts/restore index aa7f7b9..fedbbae 100644 --- a/scripts/restore +++ b/scripts/restore @@ -73,8 +73,9 @@ 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 [ -e /proc/sys/net/core/rmem_max ]; then +if [ -e /proc/sys/net/core/rmem_max ] +then + ynh_restore_file --origin_path="/etc/sysctl.d/90-transmission.conf" sysctl --load=/etc/sysctl.d/90-transmission.conf fi diff --git a/scripts/upgrade b/scripts/upgrade index 0062157..7a220d1 100644 --- a/scripts/upgrade +++ b/scripts/upgrade @@ -134,11 +134,12 @@ 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 +if [ -e /proc/sys/net/core/rmem_max ] +then + # 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 [ -e /proc/sys/net/core/rmem_max ]; then + cp ../conf/90-transmission.conf /etc/sysctl.d/90-transmission.conf sysctl --load=/etc/sysctl.d/90-transmission.conf fi @@ -148,7 +149,10 @@ fi # 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 +if [ -e /proc/sys/net/core/rmem_max ] +then + ynh_store_file_checksum --file=/etc/sysctl.d/90-transmission.conf +fi #================================================= # YUNOHOST MULTIMEDIA INTEGRATION