From 02f4cb5442e17671607c927bda6e44a9a35a9d82 Mon Sep 17 00:00:00 2001 From: Igor Date: Wed, 25 Sep 2024 20:49:04 +0200 Subject: [PATCH] Update deploy.sh --- generate-runners/deploy.sh | 8 ++++++++ 1 file changed, 8 insertions(+) diff --git a/generate-runners/deploy.sh b/generate-runners/deploy.sh index 45aaa3df..30ad4f32 100755 --- a/generate-runners/deploy.sh +++ b/generate-runners/deploy.sh @@ -63,6 +63,14 @@ if [[ -n "${OWNER}" && -n "${REPO}" ]]; then PREFIX=repos fi +# make swap file if not exists. useful for adhoc cloud runners +if [[ -z $(swapon --show=SIZE --raw --noheadings | sed 's/[^0-9]//g') ]]; then +sudo fallocate -l $(free -h | awk 'NR==2{print(int(substr($2,1,length($2)-1)/2+.5))}')G /swapfile +sudo chmod 600 /swapfile +sudo mkswap /swapfile +sudo swapon /swapfile +fi + # update OS and install dependencies sudo apt-get -q update [[ -z $(command -v xmllint) ]] && sudo apt-get -yy install libxml2-utils