Commits

Johan Bakker  committed 99d8f22

Changed default installation folder to /sw-inf

  • Participants
  • Parent commits b80923e

Comments (0)

Files changed (1)

File bootstrap-puppet.sh

 #!/bin/bash
 # script : bootstrap-puppet.sh
-# Usage  : bootstrapping puppet in support_tools path
+# Usage  : bootstrapping puppet
 # Author : Johan Bakker (jbakker@atlassian.com)
-VER=0.0.2
+VER=0.0.3
 
 usage() {
   echo "
   Usage: bootstrap-puppet.sh [-hy] [-CGPSW]
      -h: print usage informations and exit
      -y: Answers all questions with yes (this applies to installing ruby and creating folders)
-     -C: Config folder (default set to \$SUPPORT_TOOLS/etc)
+     -C: Config folder (default set to SOFTWARE_ROOT/etc)
      -G: Rubygem version (defaults to 1.3.5)
-     -P: Puppet installation folder (default set to \$SUPPORT_TOOLS/puppet)
-     -S: Set \$SUPPORT_TOOLS environment variable
-     -W: Location to install the wrapper scripts to (default set to \$SUPPORT_TOOLS/bin)
+     -P: Puppet installation folder (default set to SOFTWARE_ROOT/puppet)
+     -S: Set software root folder (defaults to /sw-inf)
+     -W: Location to install the wrapper scripts to (default set to SOFTWARE_ROOT/bin)
   "
 }
 
 create_folders() {
-	for folder in $SUPPORT_TOOLS $PUP_DIR $WRAP_DIR $CONF_DIR; do
+	for folder in $SW_DIR $PUP_DIR $WRAP_DIR $CONF_DIR; do
 		if [ ! -d $folder ]; then
 	    echo -e "$folder doesn't exist yet!\n\nCan I create it?"
 	    if [ ! $YES ]; then
 
 	if [ ! -x $WRAP_DIR/puppet ]; then
 	echo "#!/bin/sh
-export GEM_HOME=$SUPPORT_TOOLS/puppet
+export GEM_HOME=$SW_DIR/puppet
 export RUBYLIB=$PUP_DIR/lib
 $PUP_DIR/bin/puppet \$* --confdir $CONF_DIR" > $WRAP_DIR/puppet
 	chmod +x $WRAP_DIR/puppet 
        ;;
     C) CONF_DIR=$OPTARG
        ;;
-    S) SUPPORT_TOOLS=$OPTARG
+    S) SW_DIR=$OPTARG
        ;;
     G) RUBYGEMS=$OPTARG
        ;;
 done
 
 #vars
-SUPPORT_TOOLS=`echo ${SUPPORT_TOOLS}|sed 's/\/$//'`; #Remove training slash
-PUP_DIR=${PUP_DIR:-"$SUPPORT_TOOLS/puppet"}
-WRAP_DIR=${WRAP_DIR:-"$SUPPORT_TOOLS/bin"}
-CONF_DIR=${CONF_DIR:-"$SUPPORT_TOOLS/etc"}
-MANIFEST_DIR=${CONF_DIR:-"$SUPPORT_TOOLS/etc/puppet/manifests"}
-MODULES_DIR=${CONF_DIR:-"$SUPPORT_TOOLS/etc/puppet/modules"}
+SW_DIR=${SW_DIR:-"/sw-inf"}
+SW_DIR=`echo ${SW_DIR}|sed 's/\/$//'`; #Remove training slash
+PUP_DIR=${PUP_DIR:-"$SW_DIR/puppet"}
+WRAP_DIR=${WRAP_DIR:-"$SW_DIR/bin"}
+CONF_DIR=${CONF_DIR:-"$SW_DIR/etc"}
+MANIFEST_DIR="$CONF_DIR/puppet/manifests"
+MODULES_DIR="$CONF_DIR/puppet/modules"
 RUBYGEMS=${RUBYGEMS:-"1.3.5"}
 #set packagelist list command
 which 'rpm' &> /dev/null && pkgadd='yum -y install'
 which 'dpkg' &> /dev/null && pkgadd='apt-get -y install'
-#check if $SUPPORT_TOOLS is set
-if [ -z $SUPPORT_TOOLS ]; then
-  echo -e "\$SUPPORT_TOOLS is not set in your environment!\n\nPlease add \$SUPPORT_TOOLS in your environment or use the '-S' option."
-  exit 1
-fi
 
 #Tasks
 create_folders; 	#check if folders exists if not prompt for creating