system-config/install_jenkins_slave.sh
Sunil Thaha 2c6a5f3e8e Exit cleanly if run as a non-root user
Exits with a message if the efficitive-uid (EUID) is not 0

Change-Id: If36a9ede5f8bfc763d86870e6f630bafee605476
Reviewed-on: https://review.openstack.org/19453
Reviewed-by: Dan Prince <dprince@redhat.com>
Reviewed-by: Clark Boylan <clark.boylan@gmail.com>
Approved: Monty Taylor <mordred@inaugust.com>
Reviewed-by: Monty Taylor <mordred@inaugust.com>
Tested-by: Jenkins
2013-01-14 11:43:07 +00:00

26 lines
715 B
Bash
Executable File

#!/bin/bash
if [[ $EUID -ne 0 ]]; then
echo "This script must be run as root" 1>&2
exit 1
fi
cat > /etc/apt/preferences.d/00-puppet.pref <<EOF
Package: puppet puppet-common puppetmaster puppetmaster-common
Pin: version 2.7*
Pin-Priority: 501
EOF
lsbdistcodename=`lsb_release -c -s`
puppet_deb=puppetlabs-release-${lsbdistcodename}.deb
wget http://apt.puppetlabs.com/$puppet_deb -O $puppet_deb
dpkg -i $puppet_deb
apt-get update
apt-get install -y puppet git rubygems
git clone https://github.com/openstack-infra/config
bash config/install_modules.sh
puppet apply --modulepath=`pwd`/config/modules:/etc/puppet/modules -e 'node default {class { "openstack_project::bare_slave": install_users => false }}'