F #260: Add IGNORE_SWAP context param

Signed-off-by: Petr Ospalý <pospaly@opennebula.io>
pull/262/head
Thomas Lejeune 3 years ago committed by Petr Ospalý
parent 439b4af8b9
commit 0831bdf59d
No known key found for this signature in database
GPG Key ID: 96B7C54C30DA9F72

@ -21,15 +21,34 @@ if [ "$1" != 'local' ] ; then
exit 0
fi
# arg: <true|yes|false|no>
is_true()
(
_value=$(echo "$1" | \
sed -e 's/^[[:space:]]*//' -e 's/[[:space:]]*$//' | \
tr '[:upper:]' '[:lower:]')
case "$_value" in
1|true|yes|y)
return 0
;;
esac
return 1
)
activate_swaps_linux() {
SWAP_DRIVES=$(blkid -t TYPE="swap" -o device)
for SWAP in $SWAP_DRIVES ; do
if [ -z "$(swapon -s | grep $SWAP)" ]; then
swapon $SWAP
swapon "$SWAP"
fi
done
}
if [ "$(uname -s)" = 'Linux' ] && [ "${DISABLE_SWAP}" != "true" ]; then
if is_true "${IGNORE_SWAP}" ; then
exit 0
fi
if [ "$(uname -s)" = 'Linux' ]; then
activate_swaps_linux
fi

Loading…
Cancel
Save