mirror of
https://github.com/YunoHost/yunohost.git
synced 2024-09-03 20:06:10 +02:00
helpers: rewrite ynh_add_swap: rename files swap_file->swap_yunohost, sysctl 999-yunohost-swap.conf
This commit is contained in:
parent
03837bd9b8
commit
e039d2e195
1 changed files with 3 additions and 4 deletions
|
@ -121,7 +121,7 @@ ynh_add_swap () {
|
||||||
|
|
||||||
# Could be moved to an argument
|
# Could be moved to an argument
|
||||||
swapfile_dir="$(realpath /)"
|
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
|
# Early warning exit: Can't swap inside LXD
|
||||||
if [[ "$(systemd-detect-virt)" == "lxc" ]]; then
|
if [[ "$(systemd-detect-virt)" == "lxc" ]]; then
|
||||||
|
@ -161,8 +161,7 @@ ynh_add_swap () {
|
||||||
swap_size_kb=$(( swap_max_size_kb / size_space_ratio ))
|
swap_size_kb=$(( swap_max_size_kb / size_space_ratio ))
|
||||||
|
|
||||||
# Configure swappiness
|
# Configure swappiness
|
||||||
if [ ! -e /etc/sysctl.d/999-ynhswap.conf ]
|
if [ ! -f /etc/sysctl.d/999-yunohost-swap.conf ]; then
|
||||||
then
|
|
||||||
echo "vm.swappiness=10" > /etc/sysctl.d/999-ynhswap.conf
|
echo "vm.swappiness=10" > /etc/sysctl.d/999-ynhswap.conf
|
||||||
sysctl --quiet --system
|
sysctl --quiet --system
|
||||||
fi
|
fi
|
||||||
|
@ -191,7 +190,7 @@ ynh_add_swap () {
|
||||||
ynh_del_swap () {
|
ynh_del_swap () {
|
||||||
# Could be moved to an argument
|
# Could be moved to an argument
|
||||||
swapfile_dir="$(realpath /)"
|
swapfile_dir="$(realpath /)"
|
||||||
swapfile_path="$(realpath "$swapfile_dir/swap_file")"
|
swapfile_path="$(realpath "$swapfile_dir/swap_yunohost")"
|
||||||
|
|
||||||
if [ ! -f "$swapfile_path" ]; then
|
if [ ! -f "$swapfile_path" ]; then
|
||||||
return
|
return
|
||||||
|
|
Loading…
Add table
Reference in a new issue