mirror of
https://github.com/YunoHost-Apps/seafile_ynh.git
synced 2024-09-03 20:26:01 +02:00
fix swap
This commit is contained in:
parent
e0dd33676b
commit
cb4a6e0d02
1 changed files with 7 additions and 2 deletions
|
@ -72,6 +72,12 @@ ynh_add_swap () {
|
||||||
# If there's enough space for a swap, and no existing swap here
|
# If there's enough space for a swap, and no existing swap here
|
||||||
if [ $swap_size -ne 0 ] && [ ! -e /swap_$app ]
|
if [ $swap_size -ne 0 ] && [ ! -e /swap_$app ]
|
||||||
then
|
then
|
||||||
|
# Create file
|
||||||
|
truncate -s 0 /swap_$app
|
||||||
|
|
||||||
|
# set the No_COW attribute on the swapfile with chattr
|
||||||
|
chattr +C /swap_$app || true
|
||||||
|
|
||||||
# Preallocate space for the swap file, fallocate may sometime not be used, use dd instead in this case
|
# Preallocate space for the swap file, fallocate may sometime not be used, use dd instead in this case
|
||||||
if ! fallocate -l ${swap_size}K /swap_$app
|
if ! fallocate -l ${swap_size}K /swap_$app
|
||||||
then
|
then
|
||||||
|
@ -81,7 +87,7 @@ ynh_add_swap () {
|
||||||
# Create the swap
|
# Create the swap
|
||||||
mkswap /swap_$app
|
mkswap /swap_$app
|
||||||
# And activate it
|
# And activate it
|
||||||
swapon /swap_$app
|
swapon /swap_$app || true
|
||||||
# Then add an entry in fstab to load this swap at each boot.
|
# Then add an entry in fstab to load this swap at each boot.
|
||||||
echo -e "/swap_$app swap swap defaults 0 0 #Swap added by $app" >> /etc/fstab
|
echo -e "/swap_$app swap swap defaults 0 0 #Swap added by $app" >> /etc/fstab
|
||||||
fi
|
fi
|
||||||
|
@ -115,4 +121,3 @@ ynh_is_main_device_a_sd_card () {
|
||||||
return 1
|
return 1
|
||||||
fi
|
fi
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
Loading…
Reference in a new issue