1
0
Fork 0
mirror of https://github.com/YunoHost-Apps/mastodon_ynh.git synced 2024-09-03 19:46:02 +02:00

Merge pull request #411 from YunoHost-Apps/dontswapwheninsidelxd

Prevent swap from being created when running inside a LXC
This commit is contained in:
Tagada 2023-09-26 15:45:33 +02:00 committed by GitHub
commit 564b5a82be
No known key found for this signature in database
GPG key ID: 4AEE18F83AFDEB23

View file

@ -19,6 +19,13 @@ ynh_add_swap () {
SD_CARD_CAN_SWAP=${SD_CARD_CAN_SWAP:-0} SD_CARD_CAN_SWAP=${SD_CARD_CAN_SWAP:-0}
# Can't swap inside an LXD
if [ "$(systemd-detect-virt)" == "lxc" ]
then
ynh_print_warn --message="You are inside a LXC container, swap will not be added, but that can cause troubles for the app $app. Please make sure you have more than 2.5G available RAM."
return
fi
# Swap on SD card only if it's is specified # Swap on SD card only if it's is specified
if ynh_is_main_device_a_sd_card && [ "$SD_CARD_CAN_SWAP" == "0" ] if ynh_is_main_device_a_sd_card && [ "$SD_CARD_CAN_SWAP" == "0" ]
then then