diff --git a/roles/copr/backend/files/provision/files/enable-swap.sh b/roles/copr/backend/files/provision/files/enable-swap.sh index 5ab15b481c..48e771cab8 100644 --- a/roles/copr/backend/files/provision/files/enable-swap.sh +++ b/roles/copr/backend/files/provision/files/enable-swap.sh @@ -1,3 +1,15 @@ #!/usr/bin/bash -mkswap /dev/nvme0n1 -swapon /dev/nvme0n1 + +set -e + +swap_device= +if test -e /dev/xvda1 -a test -e /dev/nvme0n1; then + swap_device=/dev/nvme0n1 +elif test -e /dev/nvme1n1; then + swap_device=/dev/nvme1n1 +else + +test -n "$swap_device" + +mkswap "$swap_device" +swapon "$swap_device"