1
0
Fork 0
mirror of https://github.com/YunoHost-Apps/gitlab_ynh.git synced 2024-09-03 18:36:35 +02:00

Fix fallocate can't be used

This commit is contained in:
Kayou 2019-05-12 18:59:07 +02:00 committed by GitHub
parent 0e1bc68586
commit 951a1bbf9c
No known key found for this signature in database
GPG key ID: 4AEE18F83AFDEB23

View file

@ -76,8 +76,11 @@ ynh_add_swap () {
# If there's enough space for a swap, and no existing swap here
if [ $swap_size -ne 0 ] && [ ! -e /swap_$app ]
then
# Preallocate space for the swap file
fallocate -l ${swap_size}K /swap_$app
# 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
then
dd if=/dev/zero of=/swap_$app bs=1024 count=${swap_size}
fi
chmod 0600 /swap_$app
# Create the swap
mkswap /swap_$app