mirror of
https://github.com/YunoHost-Apps/libreerp_ynh.git
synced 2024-09-03 19:36:13 +02:00
Merge 3c6ada4635
into 02d0fc4e2e
This commit is contained in:
commit
e1a5266dcb
1 changed files with 11 additions and 0 deletions
|
@ -190,6 +190,17 @@ 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
|
||||||
|
# Check if / is mounted on btrfs
|
||||||
|
if [ "$(awk '$2 == "/" {print $3}' /proc/mounts)" = "btrfs" ]
|
||||||
|
then
|
||||||
|
if [ "$(uname -r | awk -F. '{print $1}')" -lt 5 ]
|
||||||
|
then
|
||||||
|
ynh_print_warn --message="The main mountpoint of your system '/' is on an BTRFS filesystem, but current kernel does not support swap files on BTRFS. Swap file will not be added to prevent file system corruption. If you still want to activate the swap, please update your kernel to at least version 5."
|
||||||
|
return
|
||||||
|
fi
|
||||||
|
truncate -s 0 /swap_$app
|
||||||
|
chattr +C /swap_$app
|
||||||
|
fi
|
||||||
# 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
|
||||||
|
|
Loading…
Add table
Reference in a new issue