| #!/bin/bash |
| |
| # Found as /opt/start_swarming. Called by /etc/init.d/start-swarming so it can be run |
| # as user chrome-bot (swarming doesn't like being run as root). |
| # Logs will be found in /var/log/startup.(log|err) |
| |
| # Wait 20s to make sure ssl is fully booted. Otherwise, we may get an error |
| # when trying to download the bootstrap code. |
| sleep 20s |
| |
| # Copy authentication to home directory |
| cp /opt/.gitconfig /home/chrome-bot/.gitconfig |
| cp /opt/.netrc /home/chrome-bot/.netrc |
| |
| host="$(hostname)" |
| swarming="https://chromium-swarm.appspot.com" |
| if [[ "$host" = skia-i-* ]]; then |
| swarming="https://chrome-swarming.appspot.com" |
| fi |
| |
| if [ ! -d "/b/s" ]; then |
| cd /b |
| echo "Bootstrapping $swarming, expect a reboot" |
| python -c "import urllib; exec urllib.urlopen('$swarming/bootstrap').read()" |
| else |
| echo "Starting swarming" |
| /usr/bin/python /b/s/swarming_bot.zip start_bot & |
| fi |