Skip to content

Instantly share code, notes, and snippets.

@peterdemin
Forked from ianbattersby/gist:4641450
Last active December 22, 2015 15:59
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save peterdemin/6496127 to your computer and use it in GitHub Desktop.
Save peterdemin/6496127 to your computer and use it in GitHub Desktop.
Script meant to be used as vagrant shell provisioner. It doesn't use /vagrant shared folder though. That means it can be launched from any remote debian machine.
#!/bin/bash
# Replace this with actual server address
serverUrl="10.1.136.242:80"
if [ -e "/etc/init.d/teamcity" ]
then
echo "TeamCity allready installed"
exit 0
fi
# # Install prerequisties
sudo apt-get update
sudo apt-get install -y wget unzip openjdk-7-jre-headless dos2unix
# Download agent
cd ~/
wget http://10.1.136.242:80/update/buildAgent.zip
mkdir ~/TeamCity
unzip buildAgent.zip -d ~/TeamCity
# Configure for using serverUrl
sed "s|localhost:8111|${serverUrl}|g" ~/TeamCity/conf/buildAgent.dist.properties | dos2unix > ~/TeamCity/conf/buildAgent.properties
# Copy build agent to /var/
sudo cp -r ~/TeamCity /var/
# Add executable permission
sudo chmod +x /var/TeamCity/bin/agent.sh
# Start build-agent at boot
echo "#!/bin/bash" > ~/teamcity
echo "/var/TeamCity/bin/agent.sh start" >> ~/teamcity
sudo cp ~/teamcity /etc/init.d/teamcity
sudo chmod +x /etc/init.d/teamcity
sudo update-rc.d teamcity defaults
# Launch build agent
sudo /var/TeamCity/bin/agent.sh start
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment