Skip to content

HTTPS clone URL

Subversion checkout URL

You can clone with HTTPS or Subversion.

Download ZIP
Browse files

Merge pull request #64 from jblaine/master

Support for RHEL
  • Loading branch information...
commit ee0b8aea3ec684c734d222e8de4f63bff5446d8b 2 parents 7c0745e + 4eb2044
@rtyler authored
Showing with 46 additions and 23 deletions.
  1. +46 −23 scripts/puppet.sh
View
69 scripts/puppet.sh
@@ -1,18 +1,26 @@
#!/bin/sh -x
OSNAME=`uname`
+LINUXFLAVOR=`lsb_release -is`
+PROG=`basename $0`
-if [ "${OSNAME}" = "FreeBSD" ]; then
+Info () {
+ echo "$PROG : $*"
+}
- which pkg > /dev/null
+Fatal () {
+ echo "$PROG : FATAL: $*"
+ exit 1
+}
+Info "Begin"
+if [ "${OSNAME}" = "FreeBSD" ]; then
+ which pkg > /dev/null 2>&1
if [ $? -ne 0 ]; then
- echo "pkgng is not installed!"
+ Info "pkgng is not installed!"
ftp -V ftp://anonymous:ec2@ftp.freebsd.org/pub/FreeBSD/ports/amd64/packages-9-stable/Latest/pkg.tbz
pkg_add ./pkg.tbz
-
echo "PACKAGESITE : http://pkgbeta.freebsd.org/freebsd-9-amd64/latest/" > /usr/local/etc/pkg.conf
-
pkg update -q
# Update pkgng itself
pkg install -y pkg
@@ -20,23 +28,38 @@ if [ "${OSNAME}" = "FreeBSD" ]; then
pkg install -y rsync
# Install puppet so we can get that up and running
pkg install -y puppet
- fi;
-
-else
-
- export PATH=/var/lib/gems/1.8/bin:/usr/local/bin:$PATH
-
- which puppet
-
- if [ $? -ne 0 ]; then
- apt-get update
-
- apt-get install -y ruby1.8 \
- ruby1.8-dev \
- libopenssl-ruby1.8 \
- rubygems
-
- gem install puppet --version "~> 2.7" --no-ri --no-rdoc
fi
-
+else
+ case "$LINUXFLAVOR" in
+ RedHat*) # Extract the major version number
+ VERSION=`lsb_release -ids | sed 's/.*release \([0-9]\).*/\1/'`
+ if [ $VERSION -eq 5 ]; then
+ rpm -ivh http://yum.puppetlabs.com/el/5/products/i386/puppetlabs-release-5-6.noarch.rpm
+ elif [ $VERSION -eq 6 ]; then
+ rpm -ivh http://yum.puppetlabs.com/el/6/products/i386/puppetlabs-release-6-6.noarch.rpm
+ else
+ Fatal "Unsupported Red Hat release: $VERSION"
+ fi
+ # Disable EPEL if for some reason it is configured on this host
+ # as we don't want to get some old Puppet from there.
+ if [ -f /etc/yum.repos.d/epel.repo ]; then
+ yum install -y puppet --disablerepo=epel
+ else
+ yum install -y puppet
+ fi
+ ;;
+ Ubuntu) export PATH=/var/lib/gems/1.8/bin:/usr/local/bin:$PATH
+ which puppet > /dev/null 2>&1
+ if [ $? -ne 0 ]; then
+ apt-get update
+ apt-get install -y ruby1.8 \
+ ruby1.8-dev \
+ libopenssl-ruby1.8 \
+ rubygems
+ gem install puppet --version "~> 2.7" --no-ri --no-rdoc
+ fi
+ ;;
+ *) Fatal "Unsupported Linux flavor: $LINUXFLAVOR"
+ ;;
+ esac
fi
Please sign in to comment.
Something went wrong with that request. Please try again.