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