Commits

Johan Bakker committed 1c02014

added extra option to forge installaing a particular puppet version instead of the lastest

  • Participants
  • Parent commits dddda54

Comments (0)

Files changed (1)

File bootstrap-puppet.sh

 # script : bootstrap-puppet.sh
 # Usage  : bootstrapping puppet
 # Author : Johan Bakker (jbakker@atlassian.com)
-VER=0.0.5
+VER=0.0.6
 
 usage() {
   echo "
      -P: Puppet installation folder (default set to SOFTWARE_ROOT/lib/puppet)
      -S: Set software root folder (defaults to /sw)
      -W: Location to install the wrapper scripts to (default set to SOFTWARE_ROOT/bin)
+     -V: Puppet version (defaults to latest)
   "
 }
 
 	#install puppet
 	if [ ! -x $PUP_DIR/bin/puppet ]; then
   	echo "Installing puppet..."
-  	$PUP_DIR/bin/gem install puppet --no-rdoc --no-ri
+  	$PUP_DIR/bin/gem install puppet $PUPPETVERSION --no-rdoc --no-ri
 	fi
 
 	#Create wrapper scripts
 
 	#Create puppet config file
 	if [ ! -f $CONF_DIR/puppet.conf ]; then
-  	echo "[user]
+  	echo "[main]
 report = false
 reports = none
 vardir = $DATA_DIR/puppet/var
 }
 
 #Main
-while getopts :hyP:W:C:S:G: OPTIONS
+while getopts :hyP:W:C:S:G:V: OPTIONS
 do
   case ${OPTIONS} in
     h) usage
        ;;
     G) RUBYGEMS=$OPTARG
        ;;
+    V) PUPPETVERSION=" --version $OPTARG"
+       ;;
     *) echo "Unknown option"
        usage
        exit 1
 CONF_DIR=${CONF_DIR:-"$SW_DIR/etc"}
 DATA_DIR=${DATA_DIR:-"/data"}
 RUBYGEMS=${RUBYGEMS:-"1.3.5"}
+PUPPETVERSION=${PUPPETVERSION:-""}
 #set packagelist list command
 which 'rpm' &> /dev/null && pkgadd='yum -y install'
 which 'dpkg' &> /dev/null && pkgadd='apt-get -y install'