From 5c400169aff9bd430ddc9aff9108e61f3986b55e Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?F=C3=A9lix=20Pi=C3=A9dallu?= Date: Fri, 31 May 2024 16:32:46 +0200 Subject: [PATCH] helpers: rewrite ynh_add_swap: rename files swap_file->swap_yunohost, sysctl 999-yunohost-swap.conf --- helpers/helpers.v1.d/hardware | 7 +++---- 1 file changed, 3 insertions(+), 4 deletions(-) diff --git a/helpers/helpers.v1.d/hardware b/helpers/helpers.v1.d/hardware index 025da62d87..1f047ded1e 100644 --- a/helpers/helpers.v1.d/hardware +++ b/helpers/helpers.v1.d/hardware @@ -121,7 +121,7 @@ ynh_add_swap () { # Could be moved to an argument swapfile_dir="$(realpath /)" - swapfile_path="$(realpath "$swapfile_dir/swap_file")" + swapfile_path="$(realpath "$swapfile_dir/swap_yunohost")" # Early warning exit: Can't swap inside LXD if [[ "$(systemd-detect-virt)" == "lxc" ]]; then @@ -161,8 +161,7 @@ ynh_add_swap () { swap_size_kb=$(( swap_max_size_kb / size_space_ratio )) # Configure swappiness - if [ ! -e /etc/sysctl.d/999-ynhswap.conf ] - then + if [ ! -f /etc/sysctl.d/999-yunohost-swap.conf ]; then echo "vm.swappiness=10" > /etc/sysctl.d/999-ynhswap.conf sysctl --quiet --system fi @@ -191,7 +190,7 @@ ynh_add_swap () { ynh_del_swap () { # Could be moved to an argument swapfile_dir="$(realpath /)" - swapfile_path="$(realpath "$swapfile_dir/swap_file")" + swapfile_path="$(realpath "$swapfile_dir/swap_yunohost")" if [ ! -f "$swapfile_path" ]; then return