Skip to content

Commit

Permalink
helpers: rewrite ynh_add_swap: rename files swap_file->swap_yunohost,…
Browse files Browse the repository at this point in the history
… sysctl 999-yunohost-swap.conf
  • Loading branch information
Salamandar committed May 31, 2024
1 parent 658f7a3 commit 5c40016
Showing 1 changed file with 3 additions and 4 deletions.
7 changes: 3 additions & 4 deletions helpers/helpers.v1.d/hardware
Original file line number Diff line number Diff line change
Expand Up @@ -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
Expand Down Expand Up @@ -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
Expand Down Expand Up @@ -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
Expand Down

0 comments on commit 5c40016

Please sign in to comment.