Clean up indentations.
authorAndy Witter <awitter@georgialibraries.org>
Fri, 26 Jul 2019 20:46:59 +0000 (16:46 -0400)
committerAndy Witter <awitter@georgialibraries.org>
Fri, 26 Jul 2019 20:46:59 +0000 (16:46 -0400)
templates/setup-head.sh
templates/setup.sh

index add6ace..1369446 100755 (executable)
@@ -8,47 +8,48 @@ TARCHIVE="head_file.tar.gz"
 . "$WD/setup-functions"
 
 if [ ! -e head_file.tar.gz ] ### Check if config files exist.
-        then
-        echo "FATAL! head_file.tar.gz is missing or "
-        echo " is not in this directory"
-        echo "cannot continue without it"
-        echo " exiting..."
-        echo
-        exit 2
+then
+    echo "FATAL! head_file.tar.gz is missing or "
+    echo " is not in this directory"
+    echo "cannot continue without it"
+    echo " exiting..."
+    echo
+    exit 2
 fi
 
+#TODO add logic here to wrap/exclude this if installing master from git
 if [ ! -d debs ] ### Check if debs exist.
-       then
-       echo "FATAL! debs folder is missing or "
-        echo " is not in this directory"
-        echo "cannot continue without it"
-        echo " exiting..."
-        echo
-        exit 3
+then
+    echo "FATAL! debs folder is missing or "
+    echo " is not in this directory"
+    echo "cannot continue without it"
+    echo " exiting..."
+    echo
+    exit 3
 fi
 
 if [ -e $INSTALL_LOG ]
+then
+    echo
+    echo "This program has been previously"
+    echo "executed on this system"  
+    if [ -e .osrf_node ]
+    then
+        if [ ! -e debconf-settings ]
         then
-        echo
-        echo "This program has been previously"
-        echo "executed on this system"  
-        if [ -e .osrf_node ]
-                then
-                if [ ! -e debconf-settings ]
-                        then
-                        echo
-                        echo "The credentials file has been deleted"
-                        echo "on the previous run extracting credentials file."
-                        echo "Please wait re-extracting the credentials file"
-                        if ! tar zxvf ../setup_head_file.tar.gz -C . setup_head_file/debconf-settings
-                                then
-                                echo
-                                echo "failed to re-extract credentials file"
-                                echo "cannot continue without it."
-                                exit 4
-                        fi
-                fi
+            echo
+            echo "The credentials file has been deleted"
+            echo "on the previous run extracting credentials file."
+            echo "Please wait re-extracting the credentials file"
+            if ! tar zxvf ../setup_head_file.tar.gz -C . setup_head_file/debconf-settings
+            then
+                echo
+                echo "failed to re-extract credentials file"
+                echo "cannot continue without it."
+                exit 4
+            fi
         fi
+    fi
 fi
 
 echo "Evergreen Head Configurator"
@@ -77,12 +78,12 @@ Prep_DB_9_X () { #Prepare the database schema
 
 THISHOST="head_file"
 if echo "$THISHOST" | grep -q "brick01-head" 
-       then
-       echo
-       echo "WARNING ** You are setting up the first brick head of the cluster"
-       echo "The network connection will be severed while setting up this host"
-       echo "Please make sure you are running this locally at a console."
-       read -p "Press [Enter] to coninue or [Ctrl]-[c] to quit"
+then
+    echo
+    echo "WARNING ** You are setting up the first brick head of the cluster"
+    echo "The network connection will be severed while setting up this host"
+    echo "Please make sure you are running this locally at a console."
+    read -p "Press [Enter] to coninue or [Ctrl]-[c] to quit"
 fi
 
 ## Due to bug in apparmor profile for ejabberd we disable apparmor for installation
@@ -93,23 +94,23 @@ sleep 3
 echo;echo "stopping apparmor"
 if ! service apparmor stop
 then
-        echo;echo;echo "Failed to stop apparmor"
-        echo "please run: service apparmor stop"
-        read -p "then press [Enter] to continue: " ENTER
+    echo;echo;echo "Failed to stop apparmor"
+    echo "please run: service apparmor stop"
+    read -p "then press [Enter] to continue: " ENTER
 else
-        echo done.
-        sleep 1
+    echo done.
+    sleep 1
 fi
 
 echo;echo "tearing down apparmor"
 if ! service apparmor teardown
 then
-        echo;echo;echo "Failed to teardown apparmor"
-        echo "Please run: service apparmor teardown"
-        read -p "then press [Enter] to continue: " ENTER
+    echo;echo;echo "Failed to teardown apparmor"
+    echo "Please run: service apparmor teardown"
+    read -p "then press [Enter] to continue: " ENTER
 else
-        echo done.
-        sleep 1
+    echo done.
+    sleep 1
 fi
 
 
@@ -139,8 +140,8 @@ fi
 systemctl add-wants nfs-mountd.service rpcbind.service
 if [ -e "/etc/netconfig" ] #Disable IPV6/ipv6
 then
-       sed -i 's/^tcp6/#tcp6/g' /etc/netconfig
-       sed -i 's/^udp6/#udp6/g' /etc/netconfig
+    sed -i 's/^tcp6/#tcp6/g' /etc/netconfig
+    sed -i 's/^udp6/#udp6/g' /etc/netconfig
 fi
 
 ### Fix ejabberd/apparmor bug - commented out because it's not working
@@ -158,22 +159,23 @@ fi
 ip a add Priv_IP/My_CIDR dev $PRIMARY_INTERFACE label ${PRIMARY_INTERFACE}:0 #TODO update Variable to $3PRIMARY_INTERFACE - done
 ip link set $PRIMARY_INTERFACE up
 
+#TODO add logic here to wrap/exclude this if installing master from git.
 ### Install Opensrf and Evergreen debs.
 if [ -e debconf-settings ]
+then
+    echo "Installing OpenSRF and Evergreen"
+    sleep 2
+    if ! dpkg -l | grep -q evergreen-ils
+    then
+        InstallDebs
+    else
+        echo  "Evergreen debs are already installed." 
+        read -n 1 -p "Re-install? [y/n]" RE_INSTALL_DEBS
+        if [ "$RE_INSTALL_DEBS" == "y" ] || [ "$RE_INSTALL_DEBS" == "Y" ]
         then
-       echo "Installing OpenSRF and Evergreen"
-       sleep 2
-        if ! dpkg -l | grep -q evergreen-ils
-                then
-                InstallDebs
-                        else
-                        echo  "Evergreen debs are already installed." 
-                        read -n 1 -p "Re-install? [y/n]" RE_INSTALL_DEBS
-                        if [ "$RE_INSTALL_DEBS" == "y" ] || [ "$RE_INSTALL_DEBS" == "Y" ]
-                                then
-                                InstallDebs
-                        fi
+            InstallDebs
         fi
+    fi
 fi
 
 ### Extract config files from package
@@ -206,34 +208,34 @@ LOCALE_DIR="/openils/var/data/locale/opac"
 
 if ls $LOCALE_DIR/*.po > /dev/null 2>&1
 then
-        echo
-        echo "Custom locales found!!"
-        echo "Setting up custom locales..."
-        for LOCALE_FILE in $LOCALE_DIR/*
-        do
-               LOCALE="$(echo $LOCALE_FILE | awk -F"/" '{ print $7 }' | awk -F"." '{ print $1 }' | tr '[:upper:]' '[:lower:]' | tr '-' '_')"
-                if grep "$LOCALE_FILE" $EG_VHOST | grep -qv '#'
-                then
-                        sleep 1
-                        echo
-                        echo "Locale $LOCALE already configured in $EG_VHOST"
-                        echo "not adding it again."
-                else
-                        #LOCALE="$(cat $LOCALE_FILE | awk -F'"' '{ print $2 }')"
-                        sleep 1
-                        echo
-                        echo "Found $LOCALE_FILE Locale for this file is: $LOCALE"
-                        sed -i "/#PerlAddVar OILSWebLocale \"\/openils\/var\/data\/locale\/opac\/fr-CA.po\"/a \     \PerlAddVar OILSWebLocale \"${LOCALE_FILE}\"" "$EG_VHOST"
-                        sed -i "/#PerlAddVar OILSWebLocale \"\/openils\/var\/data\/locale\/opac\/fr-CA.po\"/a \     \PerlAddVar OILSWebLocale \"${LOCALE}\"" "$EG_VHOST"
-                       sed -i 's^# PerlSetVar OILSWebInternalHTTPPort "7080"^PerlSetVar OILSWebInternalHTTPPort "7080"^g' "$EG_VHOST"
-                fi
-        done
-        echo
-        echo "done!!!"
-        echo
+    echo
+    echo "Custom locales found!!"
+    echo "Setting up custom locales..."
+    for LOCALE_FILE in $LOCALE_DIR/*
+    do
+       LOCALE="$(echo $LOCALE_FILE | awk -F"/" '{ print $7 }' | awk -F"." '{ print $1 }' | tr '[:upper:]' '[:lower:]' | tr '-' '_')"
+        if grep "$LOCALE_FILE" $EG_VHOST | grep -qv '#'
+        then
+            sleep 1
+            echo
+            echo "Locale $LOCALE already configured in $EG_VHOST"
+            echo "not adding it again."
+        else
+            #LOCALE="$(cat $LOCALE_FILE | awk -F'"' '{ print $2 }')"
+            sleep 1
+            echo
+            echo "Found $LOCALE_FILE Locale for this file is: $LOCALE"
+            sed -i "/#PerlAddVar OILSWebLocale \"\/openils\/var\/data\/locale\/opac\/fr-CA.po\"/a \     \PerlAddVar OILSWebLocale \"${LOCALE_FILE}\"" "$EG_VHOST"
+            sed -i "/#PerlAddVar OILSWebLocale \"\/openils\/var\/data\/locale\/opac\/fr-CA.po\"/a \     \PerlAddVar OILSWebLocale \"${LOCALE}\"" "$EG_VHOST"
+            sed -i 's^# PerlSetVar OILSWebInternalHTTPPort "7080"^PerlSetVar OILSWebInternalHTTPPort "7080"^g' "$EG_VHOST"
+         fi
+    done
+    echo
+    echo "done!!!"
+    echo
 else
-        echo
-        echo "no custom locale files found in $LOCALE_DIR"
+    echo
+    echo "no custom locale files found in $LOCALE_DIR"
 fi
 
 ### Move ports to avoid conflict with Nginx
@@ -258,10 +260,10 @@ ps -ef | grep apache2 | grep -v grep | awk '{print $2}' | xargs kill
 echo "waiting 10 seconds...."
 sleep 10
 if ps -ef | grep apache2 | grep -vq grep
-then
-       echo;echo
-       echo "apache2 processes are still running please kill them manually"
-       read -p "Press [Enter] to continue after you have killed the processes" ENTER 
+    then
+    echo;echo
+    echo "apache2 processes are still running please kill them manually"
+    read -p "Press [Enter] to continue after you have killed the processes" ENTER 
 fi
 ### Install nginx
 $APT_TOOL install -y nginx
@@ -276,8 +278,9 @@ echo;echo "Starting apache2 after setting up nginx...";sleep 3
 service apache2 start
 ### Setup database schema... We do this from the head of the first brick.
 if cat /etc/hostname|grep -q brick01-head
-        then
-       while true; do
+then
+    while true 
+    do
        echo
        echo "If this is a new installation the database"
        echo "needs to be prepared for Evergreen from this host."
@@ -288,34 +291,34 @@ if cat /etc/hostname|grep -q brick01-head
                [Nn]* ) break;;
                * ) echo "Please answer yes or no.";;
                esac
-       done    
+    done       
        if [ "$POPULATE_DATABASE" == "y" ] || [ "$POPULATE_DATABASE" == "Y" ]
-               then
-               echo
-               echo "Populating the database"
-               ifconfig eth0 Brick01_Head_IP netmask 255.255.255.0
-               echo
-               echo "Configuring database for Evergreen"
-               echo
-               sleep 2
-                       if ! ping -c2 MASTER_DB.CLUSTER_DOMAINNAME
-                               then
-                               echo
-                               echo "WARNING. Do not continue until db is up..."
-                               echo
-                               echo "Cannot ping MASTER_DB.CLUSTER_DOMAINNAME"
-                               echo "Is the database server running?"
-                               echo "Make sure the db server is configured with"
-                               echo "the db setup script, rebooted, and running"
-                               read -p "THEN come back and press [Enter] to continue"
-                               chown -R opensrf:opensrf /openils
-                               Prep_DB_9_X
-                                       else
-                                       echo
-                                       echo "Found db server MASTER_DB.CLUSTER_DOMAINNAME"
-                                       chown -R opensrf:opensrf /openils
-                                       Prep_DB_9_X
-                       fi
+       then
+            echo
+            echo "Populating the database"
+            ifconfig eth0 Brick01_Head_IP netmask 255.255.255.0
+            echo
+            echo "Configuring database for Evergreen"
+            echo
+            sleep 2
+            if ! ping -c2 MASTER_DB.CLUSTER_DOMAINNAME
+                       then
+               echo
+               echo "WARNING. Do not continue until db is up..."
+               echo
+                       echo "Cannot ping MASTER_DB.CLUSTER_DOMAINNAME"
+                       echo "Is the database server running?"
+                       echo "Make sure the db server is configured with"
+               echo "the db setup script, rebooted, and running"
+                       read -p "THEN come back and press [Enter] to continue"
+               chown -R opensrf:opensrf /openils
+                       Prep_DB_9_X
+            else
+               echo
+               echo "Found db server MASTER_DB.CLUSTER_DOMAINNAME"
+               chown -R opensrf:opensrf /openils
+                Prep_DB_9_X
+           fi
         fi
 fi
 
@@ -328,27 +331,29 @@ echo 'net.ipv6.conf.lo.disable_ipv6 = 1' >> /etc/sysctl.conf
 
 ### Setup NFS mounts for the brick heads
 if ! grep -q "NFS Mounts for Evergreen" /etc/fstab 
-       then
-       if [ -e /etc/eg_fstab_head ];then
-               cp -f /etc/fstab /etc/fstab-orig.genasys
-               cat /etc/eg_fstab_head >> /etc/fstab
-       fi
-               else 
-               if [ -e /etc/eg_fstab_head ];then
-                       cp -f /etc/fstab-orig.genasys /etc/fstab
-                       cat /etc/eg_fstab_head >> /etc/fstab
-               fi
+then
+    if [ -e /etc/eg_fstab_head ]
+    then
+        cp -f /etc/fstab /etc/fstab-orig.genasys
+       cat /etc/eg_fstab_head >> /etc/fstab
+    fi
+else 
+    if [ -e /etc/eg_fstab_head ]
+    then
+       cp -f /etc/fstab-orig.genasys /etc/fstab
+       cat /etc/eg_fstab_head >> /etc/fstab
+    fi
                
 fi
 
 ### Setup .oils_brick.cfg
 if [ -e /openils/conf/.oils_brick.cfg ] 
-       then
-       cp /openils/conf/.oils_brick.cfg /home/opensrf/.oils_brick.cfg
-               else
-               echo 
-               echo ".oils_brick.cfg not found. Please create manually"
-               sleep 5
+then
+    cp /openils/conf/.oils_brick.cfg /home/opensrf/.oils_brick.cfg
+    else
+    echo 
+    echo ".oils_brick.cfg not found. Please create manually"
+    sleep 5
 fi     
 
 ### create opensrf offline configuraton.
@@ -362,43 +367,43 @@ chown opensrf:opensrf /openils/var/web/ldirectorping.txt-
 ### Setup custom lib_ips.txt file.
 if [ -e lib_ips.txt ]
 then
-       echo
-       echo -e $COL_BR_CYAN"Enabling lib_ips.txt.."$COL_RESET
-       sleep 1
-       cp -f lib_ips.txt /openils/conf 
-       chown opensrf:opensrf /openils/conf/lib_ips.txt
-       sed -i 's^#OpenILS::WWW::Redirect^OpenILS::WWW::Redirect^g' /etc/apache2/eg_startup 
-       sed -i 's^#use OpenILS::WWW::Redirect^use OpenILS::WWW::Redirect^g' /etc/apache2/eg_startup
-       sed -i 's+RedirectMatch 301 ^/$ /eg/opac/home+#RedirectMatch 301 ^/$ /eg/opac/home+g' /etc/apache2/eg_vhost.conf        
-       sed -i 's+#<LocationMatch ^/$>+<LocationMatch ^/$>+g' /etc/apache2/eg_vhost.conf
-       sed -i 's^#    SetHandler perl-script^    SetHandler perl-script^g' /etc/apache2/eg_vhost.conf
-       sed -i 's^#    PerlHandler OpenILS::WWW::Redirect^    PerlHandler OpenILS::WWW::Redirect^g' /etc/apache2/eg_vhost.conf
-       sed -i 's^#    Options +ExecCGI^    Options +ExecCGI^g' /etc/apache2/eg_vhost.conf
-       sed -i 's^#    PerlSendHeader On^    PerlSendHeader On^g' /etc/apache2/eg_vhost.conf
-       sed -i 's^#    allow from all^    allow from all^g' /etc/apache2/eg_vhost.conf
-       sed -i 's^#</LocationMatch>^</LocationMatch>^g' /etc/apache2/eg_vhost.conf
+    echo
+    echo -e $COL_BR_CYAN"Enabling lib_ips.txt.."$COL_RESET
+    sleep 1
+    cp -f lib_ips.txt /openils/conf 
+    chown opensrf:opensrf /openils/conf/lib_ips.txt
+    sed -i 's^#OpenILS::WWW::Redirect^OpenILS::WWW::Redirect^g' /etc/apache2/eg_startup 
+    sed -i 's^#use OpenILS::WWW::Redirect^use OpenILS::WWW::Redirect^g' /etc/apache2/eg_startup
+    sed -i 's+RedirectMatch 301 ^/$ /eg/opac/home+#RedirectMatch 301 ^/$ /eg/opac/home+g' /etc/apache2/eg_vhost.conf   
+    sed -i 's+#<LocationMatch ^/$>+<LocationMatch ^/$>+g' /etc/apache2/eg_vhost.conf
+    sed -i 's^#    SetHandler perl-script^    SetHandler perl-script^g' /etc/apache2/eg_vhost.conf
+    sed -i 's^#    PerlHandler OpenILS::WWW::Redirect^    PerlHandler OpenILS::WWW::Redirect^g' /etc/apache2/eg_vhost.conf
+    sed -i 's^#    Options +ExecCGI^    Options +ExecCGI^g' /etc/apache2/eg_vhost.conf
+    sed -i 's^#    PerlSendHeader On^    PerlSendHeader On^g' /etc/apache2/eg_vhost.conf
+    sed -i 's^#    allow from all^    allow from all^g' /etc/apache2/eg_vhost.conf
+    sed -i 's^#</LocationMatch>^</LocationMatch>^g' /etc/apache2/eg_vhost.conf
 fi
 
 ### Setup Novelist
 if [ -e .Novelist.txt ]
 then
-       echo;echo "Configuring Evergreen for Novelist"
-       sleep 2
-       . .Novelist.txt
-       sed -i 's^#SetEnv OILS_NOVELIST_URL^SetEnv OILS_NOVELIST_URL https://imageserver.ebscohost.com/novelistselect/ns2init.js^g' /etc/apache2/eg_vhost.conf
-       sed -i "/SetEnv OILS_NOVELIST_URL/aSetEnv OILS_NOVELIST_PROFILE $NOVELIST_PROFILE" /etc/apache2/eg_vhost.conf
-       sed -i "/SetEnv OILS_NOVELIST_PROFILE/aSetEnv OILS_NOVELIST_PASSWORD $NOVELIST_PASSWORD" /etc/apache2/eg_vhost.conf
+    echo;echo "Configuring Evergreen for Novelist"
+    sleep 2
+    . .Novelist.txt
+    sed -i 's^#SetEnv OILS_NOVELIST_URL^SetEnv OILS_NOVELIST_URL https://imageserver.ebscohost.com/novelistselect/ns2init.js^g' /etc/apache2/eg_vhost.conf
+    sed -i "/SetEnv OILS_NOVELIST_URL/aSetEnv OILS_NOVELIST_PROFILE $NOVELIST_PROFILE" /etc/apache2/eg_vhost.conf
+    sed -i "/SetEnv OILS_NOVELIST_PROFILE/aSetEnv OILS_NOVELIST_PASSWORD $NOVELIST_PASSWORD" /etc/apache2/eg_vhost.conf
 fi
 
 ### Setup custom KPAC
 if [ -e kpac.xml ]
 then
-       echo
-       echo -e $COL_BR_CYAN"Enabling Custom KPAC....."$COL_RESET
-       sleep 1
-       cp -f kpac.xml /openils/conf
-       chown opensrf:opensrf /openils/conf/kpac.xml
-       sed -i 's^kpac.xml.example^kpac.xml^g' /etc/apache2/eg_vhost.conf
+    echo
+    echo -e $COL_BR_CYAN"Enabling Custom KPAC....."$COL_RESET
+    sleep 1
+    cp -f kpac.xml /openils/conf
+    chown opensrf:opensrf /openils/conf/kpac.xml
+    sed -i 's^kpac.xml.example^kpac.xml^g' /etc/apache2/eg_vhost.conf
 fi
 
 ### configure apache module for memcache01 IP
@@ -443,11 +448,11 @@ alias l='ls $LS_OPTIONS -lA'
 EOF
 
 if ! grep -q "Evergreen Modifications" /root/.bashrc
-        then
-        if [ "$OSDISTRO" == "Debian" ]
-                then
-                cat bashrc-options.txt >> /root/.bashrc
-        fi
+then
+    if [ "$OSDISTRO" == "Debian" ]
+    then
+        cat bashrc-options.txt >> /root/.bashrc
+    fi
 fi
 
 
index 6c2a2c1..6a673b7 100755 (executable)
@@ -10,40 +10,40 @@ TARCHIVE="tar_file.tar.gz"
 . "$WD/setup-functions"
 
 if [ ! -e tar_file.tar.gz ] ### Check if config files exist.
-        then
-        echo "FATAL! tar_file.tar.gz is missing or "
-        echo " is not in this directory"
-        echo "cannot continue without it"
-        echo " exiting..."
-        echo
-        exit 2
+    then
+    echo "FATAL! tar_file.tar.gz is missing or "
+    echo " is not in this directory"
+    echo "cannot continue without it"
+    echo " exiting..."
+    echo
+    exit 2
 fi
 
 ### Check if install log exists.
 
 if [ -e $INSTALL_LOG ]
-       then
-       echo
-       echo "This program has been previously"
-       echo "executed on this system"  
-       sleep 1
-       if [ -e .osrf_node ]
-               then
-               if [ ! -e debconf-settings ] ### Check if the file debconf-settings exits and warn if not
-                       then
-                       echo
-                       echo "The credentials file has been deleted"
-                       echo "on the previous run extracting credentials file."
-                       echo "Re-extracting the credentials file"
-                       if ! tar zxvf ../setup_tar_file.tar.gz -C . setup_tar_file/debconf-settings
-                               then
-                               echo
-                               echo "failed to re-extract credentials file"
-                               echo "cannot continue without it."
-                               exit 3
-                       fi
-               fi
-       fi
+    then
+    echo
+    echo "This program has been previously"
+    echo "executed on this system"     
+    sleep 1
+    if [ -e .osrf_node ]
+    then
+       if [ ! -e debconf-settings ] ### Check if the file debconf-settings exits and warn if not
+       then
+           echo
+           echo "The credentials file has been deleted"
+           echo "on the previous run extracting credentials file."
+           echo "Re-extracting the credentials file"
+           if ! tar zxvf ../setup_tar_file.tar.gz -C . setup_tar_file/debconf-settings
+           then
+               echo
+               echo "failed to re-extract credentials file"
+               echo "cannot continue without it."
+               exit 3
+           fi
+       fi
+    fi
 fi
 
 echo
@@ -70,23 +70,23 @@ sleep 3
 echo;echo "stopping apparmor"
 if ! service apparmor stop 
 then
-        echo;echo;echo "Failed to stop apparmor"
-        echo "please run: service apparmor stop"
-        read -p "then press [Enter] to continue: " ENTER
+    echo;echo;echo "Failed to stop apparmor"
+    echo "please run: service apparmor stop"
+    read -p "then press [Enter] to continue: " ENTER
 else
-        echo done.
-        sleep 1
+    echo done.
+    sleep 1
 fi
 
 echo;echo "tearing down apparmor"
 if ! service apparmor teardown
 then
-        echo;echo;echo "Failed to teardown apparmor"
-        echo "Please run: service apparmor teardown"
-        read -p "then press [Enter] to continue: " ENTER
+    echo;echo;echo "Failed to teardown apparmor"
+    echo "Please run: service apparmor teardown"
+    read -p "then press [Enter] to continue: " ENTER
 else
-        echo done.
-        sleep 1
+    echo done.
+    sleep 1
 fi
 
 ### Set hostname.
@@ -112,33 +112,34 @@ sed -i 's/^domain.*/domain CLUSTER_DOMAINNAME/g' /etc/resolv.conf
 sed -i 's/^search.*/search CLUSTER_DOMAINNAME/g' /etc/resolv.conf
 
 
+#TODO add logic here to wrap/exclude this if installing master from git.
 if cat /etc/hostname | grep "sip\|utility" ### Check if this is a non-brick OpenSRF node.
-        then
-        if [ ! -d debs ] ### Check if debs exist.
-                then
-               OSRF_NODE="1"
-                echo "FATAL! debs folder is missing or "
-                echo " is not in this directory"
-                echo "cannot continue without it"
-                echo "exiting..."
-                echo
-                exit 4
-        fi
+    then
+    if [ ! -d debs ] ### Check if debs exist.
+    then
+       OSRF_NODE="1"
+        echo "FATAL! debs folder is missing or "
+        echo " is not in this directory"
+        echo "cannot continue without it"
+        echo "exiting..."
+        echo
+        exit 4
+    fi
 fi
 
 
 Install_DB_Deps() { ### Install Additional Database dependencies.
 if [ "$OSDISTRO" == "Ubuntu" ]
-        then
-       $APT_TOOL -y install gcc libxml-libxml-perl libxml-libxslt-perl libjson-xs-perl libmarc-record-perl libmarc-xml-perl libuuid-tiny-perl libbusiness-isbn-perl liblibrary-callnumber-lc-perl
+    then
+    $APT_TOOL -y install gcc libxml-libxml-perl libxml-libxslt-perl libjson-xs-perl libmarc-record-perl libmarc-xml-perl libuuid-tiny-perl libbusiness-isbn-perl liblibrary-callnumber-lc-perl
 else
-       $APT_TOOL -y install gcc libxml-libxml-perl libxml-libxslt-perl
-       PERL_MM_USE_DEFAULT=1 cpan Business::ISBN && \
-       PERL_MM_USE_DEFAULT=1 cpan JSON::XS && \
-        PERL_MM_USE_DEFAULT=1 cpan Library::CallNumber::LC && \
-       PERL_MM_USE_DEFAULT=1 cpan MARC::Record && \
-       PERL_MM_USE_DEFAULT=1 cpan UUID::Tiny && \
-       PERL_MM_USE_DEFAULT=1 cpan MARC::File::XML 
+    $APT_TOOL -y install gcc libxml-libxml-perl libxml-libxslt-perl
+    PERL_MM_USE_DEFAULT=1 cpan Business::ISBN && \
+    PERL_MM_USE_DEFAULT=1 cpan JSON::XS && \
+    PERL_MM_USE_DEFAULT=1 cpan Library::CallNumber::LC && \
+    PERL_MM_USE_DEFAULT=1 cpan MARC::Record && \
+    PERL_MM_USE_DEFAULT=1 cpan UUID::Tiny && \
+    PERL_MM_USE_DEFAULT=1 cpan MARC::File::XML 
 fi
 }
 
@@ -146,42 +147,41 @@ fi
 Init_DB_8_4() { ### Initialize the database
 ### Check if database exists.
 if su - postgres -c "createdb -T template0 --lc-ctype=C --lc-collate=C -E UNICODE evergreen" > /dev/null 2>&1
-        then
-                echo "Setting up the evergreen database"
-                su - postgres -c "createlang plperl evergreen"
-                su - postgres -c "createlang plperlu evergreen"
-                su - postgres -c "createlang plpgsql evergreen"
-                su - postgres -c "psql -f /usr/share/postgresql/8.4/contrib/tablefunc.sql evergreen"
-                su - postgres -c "psql -f /usr/share/postgresql/8.4/contrib/tsearch2.sql evergreen"
-                su - postgres -c "psql -f /usr/share/postgresql/8.4/contrib/pgxml.sql evergreen"
-        else
-                echo "evergreen database already exists! not doing anything."
+then
+    echo "Setting up the evergreen database"
+    su - postgres -c "createlang plperl evergreen"
+    su - postgres -c "createlang plperlu evergreen"
+    su - postgres -c "createlang plpgsql evergreen"
+    su - postgres -c "psql -f /usr/share/postgresql/8.4/contrib/tablefunc.sql evergreen"
+    su - postgres -c "psql -f /usr/share/postgresql/8.4/contrib/tsearch2.sql evergreen"
+    su - postgres -c "psql -f /usr/share/postgresql/8.4/contrib/pgxml.sql evergreen"
+else
+    echo "evergreen database already exists! not doing anything."
 fi
 }
 
 Init_DB_9() { ### Initialize the database.
 ### Check if database exists.
 if su - postgres -c "createdb -T template0 --lc-ctype=C --lc-collate=C -E UNICODE evergreen" > /dev/null 2>&1
-        then
-                echo "Setting up the evergreen database"
-               chown postgres:postgres create_database.sql
-               su postgres -c "psql -vdb_name=evergreen -vcontrib_dir=`pg_config --sharedir`/contrib -f create_database.sql"
-        else
-                echo "evergreen database already exists! not doing anything."
+then
+    echo "Setting up the evergreen database"
+    chown postgres:postgres create_database.sql
+    su postgres -c "psql -vdb_name=evergreen -vcontrib_dir=`pg_config --sharedir`/contrib -f create_database.sql"
+else
+    echo "evergreen database already exists! not doing anything."
 fi
 }
 
 
 Add_EG_DB_User() { ### Add the database user for Evergreen.
 if [ `su - postgres -c "psql -A -t -c \"select count(*) from pg_roles where rolname='evergreen'\""` = "0" ]
-        then
-               echo "Database user evergreen doesn't exist! Creating..."
-               echo "current directory is $(pwd)"
-                chown postgres.postgres create_db_user.sql 2>&1 | tee -a "$INSTALL_LOG";echo "chown status: $?"
-                su postgres -c "psql -f create_db_user.sql" 2>&1 | tee -a "$INSTALL_LOG";echo "pgcreatuserstatus: $?"
-                #rm create_db_user.sql
-                echo "Set db user's password"
-
+then
+    echo "Database user evergreen doesn't exist! Creating..."
+    echo "current directory is $(pwd)"
+    chown postgres.postgres create_db_user.sql 2>&1 | tee -a "$INSTALL_LOG";echo "chown status: $?"
+    su postgres -c "psql -f create_db_user.sql" 2>&1 | tee -a "$INSTALL_LOG";echo "pgcreatuserstatus: $?"
+    #rm create_db_user.sql
+    echo "Set db user's password"
 fi
 }
 
@@ -194,29 +194,29 @@ echo "GenaSYS: $VERSION" >> "$INSTALL_LOG"
 ### If this node gets postfix then preconfigure Postfix.
 if [ -e "$WD/postfix.debconf" ]
 then
-        "$WD/postfix.debconf"
+    "$WD/postfix.debconf"
 fi
 
 ### If this is a monitor server preload debconf
 if [ -e "$WD/.icinga.debconf" ]
 then
-       "$WD/.icinga.debconf"
+    "$WD/.icinga.debconf"
 fi
 
 ### Install dependencies
 if [ -e tar_file_apt.list ]
-       then
-       echo "Installing Dependencies"
-       sleep 2
-       if cat /etc/hostname|grep -q db0
-       then
-               if ! getent passwd postgres > /dev/null; then
-                       adduser --system --quiet --home /var/lib/postgresql --no-create-home \
-                       --shell /bin/bash --group --gecos "PostgreSQL administrator" --uid "$PG_UID" postgres
-               fi
-       fi
-       $APT_TOOL update 2>&1 | tee -a $INSTALL_LOG
-       $APT_TOOL -y install $(cat tar_file_apt.list) 2>&1 | tee -a "$INSTALL_LOG"
+    then
+    echo "Installing Dependencies"
+    sleep 2
+    if cat /etc/hostname|grep -q db0
+    then
+       if ! getent passwd postgres > /dev/null; then
+               adduser --system --quiet --home /var/lib/postgresql --no-create-home \
+                       --shell /bin/bash --group --gecos "PostgreSQL administrator" --uid "$PG_UID" postgres
+       fi
+    fi
+    $APT_TOOL update 2>&1 | tee -a $INSTALL_LOG
+    $APT_TOOL -y install $(cat tar_file_apt.list) 2>&1 | tee -a "$INSTALL_LOG"
 fi
 
 ### Temporary create and alias interface for installation on non-lvs and non-brick nodes
@@ -225,7 +225,7 @@ then
     GetNics
     if [ ! -z "${SECOND_PHYSICAL_INTERFACE}" ]
     then
-        PRIMARY_INTERFACE="${SECOND_PHYSICAL_INTERFACE}"
+    PRIMARY_INTERFACE="${SECOND_PHYSICAL_INTERFACE}"
     fi
     ip a add Priv_IP/My_CIDR dev $PRIMARY_INTERFACE label ${PRIMARY_INTERFACE}:0 #TODO update Variable to $3PRIMARY_INTERFACE - done
     ip link set $PRIMARY_INTERFACE up
@@ -234,12 +234,12 @@ fi
 ### Fix bug in NFS that caused failure to start at boot time
 if cat tar_file_apt.list | grep -q nfs
 then
-       systemctl add-wants nfs-mountd.service rpcbind.service
+    systemctl add-wants nfs-mountd.service rpcbind.service
 fi
 if [ -e "/etc/netconfig" ] #Disable IPV6/ipv6
 then
-        sed -i 's/^tcp6/#tcp6/g' /etc/netconfig
-        sed -i 's/^udp6/#udp6/g' /etc/netconfig
+    sed -i 's/^tcp6/#tcp6/g' /etc/netconfig
+    sed -i 's/^udp6/#udp6/g' /etc/netconfig
 fi
 
 ### Fix ejabberd/apparmor bug - commented out because it didn't work
@@ -253,34 +253,36 @@ echo "*********"
 sleep 5
 }
 
+
+#TODO ADD logic here to exclude if installing master from git.
 ### Install Opensrf and Evergreen debs
 if [ -e debconf-settings ]
+then
+    echo "Installing OpenSRF and Evergreen"
+    echo
+    sleep 2
+    if ! dpkg -l | grep -q evergreen-ils
+    then
+        $APT_TOOL update
+        if [ "$PKG_SET" = "0" ]
         then
-       echo "Installing OpenSRF and Evergreen"
-       echo
-        sleep 2
-       if ! dpkg -l | grep -q evergreen-ils
-               then
-               $APT_TOOL update
-               if [ "$PKG_SET" = "0" ]
-                       then
-                        $APT_TOOL -yq install libpq5 libpq-dev postgresql-client-${PG_VER} || PG_Deps_Warning
-               fi
-               InstallDebs
-                       else
-                       echo  "Evergreen debs are already installed." 
-                       read -n 1 -p "Re-install? [y/n]" RE_INSTALL_DEBS
-                       if [ "$RE_INSTALL_DEBS" == "y" ] || [ "$RE_INSTALL_DEBS" == "Y" ]
-                               then 
-                               InstallDebs
-                       fi
-       fi
+            $APT_TOOL -yq install libpq5 libpq-dev postgresql-client-${PG_VER} || PG_Deps_Warning
+        fi
+        InstallDebs
+    else
+        echo  "Evergreen debs are already installed." 
+        read -n 1 -p "Re-install? [y/n]" RE_INSTALL_DEBS
+        if [ "$RE_INSTALL_DEBS" == "y" ] || [ "$RE_INSTALL_DEBS" == "Y" ]
+        then 
+            InstallDebs
+        fi
+    fi
 fi
 
 ### If this node gets postfix then preconfigure Postfix.
 if [ -e "$WD/postfix.debconf" ]
 then
-       "$WD/postfix.debconf"
+    "$WD/postfix.debconf"
 fi
 
 ### Setup LVS servers
@@ -289,19 +291,19 @@ echo "Setting up lvs servers"
 
 ### Install the custom ldirector package that works around broken SSL
 LDIRECTOR_CUSTOM_DEB="ldirectord-ssl-noverify_3.9.2-5ubuntu4_all.deb"
-       if [ -e ldirectord*.deb ]
-       then
-               echo
-               echo "Installing  ldirectord-ssl-noverify....."
-               sleep 2
-               gdebi --n ldirectord*.deb
-       else
-               echo
-               echo "ldirector-ssl-no-verify not found"
-               echo "installing standard ldirector from repos..."
-               read -p "Press [Enter] to continue" CONT
-               $APT_TOOL install ldirectord
-       fi
+if [ -e ldirectord*.deb ]
+then
+    echo
+    echo "Installing  ldirectord-ssl-noverify....."
+    sleep 2
+    gdebi --n ldirectord*.deb
+else
+    echo
+    echo "ldirector-ssl-no-verify not found"
+    echo "installing standard ldirector from repos..."
+    read -p "Press [Enter] to continue" CONT
+    $APT_TOOL install ldirectord
+fi
 
 echo "CONFIG_FILE=/etc/ha.d/ldirectord.cf" >> /etc/default/ldirectord
 cat > named_options.txt << EOF
@@ -320,50 +322,50 @@ fi
 ConfigLogging () { ### Configure logging for the cluster.
 if ! cat /etc/hostname|grep -q logger ### non-logger boxes. logging clients
 then
-       if [ -e /etc/rsyslog.d ]
-       then
-               echo
-               echo "Setting up logging to the logger server"
-               sleep 2
-               if [ ! -e /etc/rsyslog.d/60-evergreen-ils.conf ]
-                       then
-                               echo >> /etc/rsyslog.conf
-                               echo "## Evergreen logger configuration" > /etc/rsyslog.d/60-evergreen-ils.conf
-                               echo "local0.*        @@logger01.CLUSTER_DOMAINNAME:514" >> /etc/rsyslog.d/60-evergreen-ils.conf
-                               echo "local1.*        @@logger01.CLUSTER_DOMAINNAME:514" >> /etc/rsyslog.d/60-evergreen-ils.conf
-                               echo "local2.*        @@logger01.CLUSTER_DOMAINNAME:514" >> /etc/rsyslog.d/60-evergreen-ils.conf
-                               echo "local3.*        @@logger01.CLUSTER_DOMAINNAME:514" >> /etc/rsyslog.d/60-evergreen-ils.conf
-                               echo "local6.*        @@logger01.CLUSTER_DOMAINNAME:514" >> /etc/rsyslog.d/60-evergreen-ils.conf
-                       echo "local7.*        @@logger01.CLUSTER_DOMAINNAME:514" >> /etc/rsyslog.d/60-evergreen-ils.conf
-                       echo "mail.*          @@logger01.CLUSTER_DOMAINNAME:514" >> /etc/rsyslog.d/60-evergreen-ils.conf
-               fi
-       fi
+    if [ -e /etc/rsyslog.d ]
+    then
+       echo
+       echo "Setting up logging to the logger server"
+       sleep 2
+       if [ ! -e /etc/rsyslog.d/60-evergreen-ils.conf ]
+               then
+                   echo >> /etc/rsyslog.conf
+                   echo "## Evergreen logger configuration" > /etc/rsyslog.d/60-evergreen-ils.conf
+                   echo "local0.*    @@logger01.CLUSTER_DOMAINNAME:514" >> /etc/rsyslog.d/60-evergreen-ils.conf
+                   echo "local1.*    @@logger01.CLUSTER_DOMAINNAME:514" >> /etc/rsyslog.d/60-evergreen-ils.conf
+                   echo "local2.*    @@logger01.CLUSTER_DOMAINNAME:514" >> /etc/rsyslog.d/60-evergreen-ils.conf
+                   echo "local3.*    @@logger01.CLUSTER_DOMAINNAME:514" >> /etc/rsyslog.d/60-evergreen-ils.conf
+                   echo "local6.*    @@logger01.CLUSTER_DOMAINNAME:514" >> /etc/rsyslog.d/60-evergreen-ils.conf
+           echo "local7.*    @@logger01.CLUSTER_DOMAINNAME:514" >> /etc/rsyslog.d/60-evergreen-ils.conf
+           echo "mail.*      @@logger01.CLUSTER_DOMAINNAME:514" >> /etc/rsyslog.d/60-evergreen-ils.conf
+       fi
+    fi
 else ### setup logging services on this host. 
-       echo
-       echo "Setting up logging for the cluster on this host"
-       sleep 2
-       mkdir -p /var/log/evergreen
-       sed -i 's/^#$ModLoad imudp/$ModLoad imudp/g' /etc/rsyslog.conf
-       sed -i 's/^#$InputUDPServerRun 514/$InputUDPServerRun 514/g' /etc/rsyslog.conf
-       sed -i 's/^#$ModLoad imtcp/$ModLoad imtcp/g' /etc/rsyslog.conf
-       sed -i 's/^#$InputTCPServerRun 514/$InputTCPServerRun 514/g' /etc/rsyslog.conf
-       sed -i 's/$PrivDropToUser/#$PrivDropToUser/g' /etc/rsyslog.conf
-       sed -i 's/$PrivDropToGroup/#$PrivDropToGroup/g' /etc/rsyslog.conf
-       echo "alias findlogs=\"cd /var/log/evergreen/\\\$(date +%Y/%m/%d) && pwd\"" >> /root/.bashrc
-       echo "alias osrfwarn=\"findlogs && tail -f osrfwarn.log | grep -v 'File does not exist' | grep -v 'config.hard_due_date'\"" >> /root/.bashrc
-       echo "alias osrferror=\"findlogs && tail -f osrferror.log | grep -v 'File does not exist'\"" >> /root/.bashrc
-       rm -f /etc/rsyslog.d/60-evergreen-ils.conf
-       if [ -e "/root/eg/logger-crontab" ]
-       then    
-               echo;echo "Installing new crontab"
-               sleep 2
-               crontab -u root /root/eg/logger-crontab
-       else
-               echo
-               echo -e $COL_RED "WARNING! /root/eg/logger-crontab is missing!!"
-               echo -e "NOT installing crontab" $COL_RESET
-               sleep 5
-       fi
+    echo
+    echo "Setting up logging for the cluster on this host"
+    sleep 2
+    mkdir -p /var/log/evergreen
+    sed -i 's/^#$ModLoad imudp/$ModLoad imudp/g' /etc/rsyslog.conf
+    sed -i 's/^#$InputUDPServerRun 514/$InputUDPServerRun 514/g' /etc/rsyslog.conf
+    sed -i 's/^#$ModLoad imtcp/$ModLoad imtcp/g' /etc/rsyslog.conf
+    sed -i 's/^#$InputTCPServerRun 514/$InputTCPServerRun 514/g' /etc/rsyslog.conf
+    sed -i 's/$PrivDropToUser/#$PrivDropToUser/g' /etc/rsyslog.conf
+    sed -i 's/$PrivDropToGroup/#$PrivDropToGroup/g' /etc/rsyslog.conf
+    echo "alias findlogs=\"cd /var/log/evergreen/\\\$(date +%Y/%m/%d) && pwd\"" >> /root/.bashrc
+    echo "alias osrfwarn=\"findlogs && tail -f osrfwarn.log | grep -v 'File does not exist' | grep -v 'config.hard_due_date'\"" >> /root/.bashrc
+    echo "alias osrferror=\"findlogs && tail -f osrferror.log | grep -v 'File does not exist'\"" >> /root/.bashrc
+    rm -f /etc/rsyslog.d/60-evergreen-ils.conf
+    if [ -e "/root/eg/logger-crontab" ]
+    then       
+       echo;echo "Installing new crontab"
+       sleep 2
+       crontab -u root /root/eg/logger-crontab
+    else
+       echo
+       echo -e $COL_RED "WARNING! /root/eg/logger-crontab is missing!!"
+       echo -e "NOT installing crontab" $COL_RESET
+       sleep 5
+    fi
 
 fi
 }
@@ -378,84 +380,85 @@ exit 5
 
 if cat /etc/hostname|grep -q db0 #|| cat /etc/hostname|grep -q reporter0
 then
-        if [ -e /etc/sysctl.d ]
-       then
-               echo
-               echo "Setting up database server"
-               sleep 2
-               if [ "$PKG_SET" = "0" ] 
-               then
-                       $APT_TOOL update
-                        $APT_TOOL -yq install postgresql-${PG_VER} postgresql-contrib-${PG_VER} postgresql-plperl-${PG_VER} postgresql-server-dev-${PG_VER} || DBInstallErr 
-               else
-                       echo
-                       echo "Failed to set the backports repository for installing Postgresql"
-                       echo "Cannot continue... Exiting"
-                       exit 6
-               fi
-                echo "## Evergreen database settings for postgresql" > /etc/sysctl.d/evergreen_db.conf #TODO disabled for now
-               #echo "kernel.shmmax=17179869184" >> /etc/sysctl.d/evergreen_db.conf #TODO disabled for now
-               #echo "kernel.shmall = 4194304" >> /etc/sysctl.d/evergreen_db.conf #TODO dislbed for now
-               Install_DB_Deps
-               sed -i "s^#listen_addresses = 'localhost'^listen_addresses = '*'^g" /etc/postgresql/${PG_VER}/main/postgresql.conf
-               sed -i "s^#log_destination = 'stderr'^log_destination = 'syslog'^g" /etc/postgresql/${PG_VER}/main/postgresql.conf
-               sed -i "s^#syslog_facility = 'LOCAL0'^syslog_facility = 'LOCAL3'^g" /etc/postgresql/${PG_VER}/main/postgresql.conf
-               sed -i "s^#syslog_ident = 'postgres'^syslog_ident = 'postgres'^g" /etc/postgresql/${PG_VER}/main/postgresql.conf
-               #Init_DB_9 #TODO disabled. Now done the new way from the 1st brick head.
-               Add_EG_DB_User #TODO disabled same as above
-               
-               #if grep -q postgres /etc/passwd
-               #then
-               #       if pgrep posgtres
-               #       then 
-               #               POSTGRES_STATE="1"
-               #       fi
-               #       echo 
-               #       echo "Updating user postgres permissions"
-               #       sleep 1
-               #       while pgrep "postgres"
-               #       do 
-               #               echo 
-               #               echo stopping postgres to updated permissions
-               #               /etc/init.d/postgres stop 
-               #       sleep 5
-               #       done
-               #       if usermod -u 499 postgres
-               #       then
-               #               chown -R postgres:postgres /var/lib/postgresql
-               #               [ "$POSTGRES_STATE" = "1" ] && /etc/init.d/postgres start
-               #       else
-               #               echo
-               #               echo "failed to update permissions."
-               #       fi
-               #fi
+    if [ -e /etc/sysctl.d ]
+    then
+       echo
+       echo "Setting up database server"
+       sleep 2
+       if [ "$PKG_SET" = "0" ] 
+       then
+           $APT_TOOL update
+           $APT_TOOL -yq install postgresql-${PG_VER} postgresql-contrib-${PG_VER} postgresql-plperl-${PG_VER} postgresql-server-dev-${PG_VER} || DBInstallErr 
+       else
+           echo
+           echo "Failed to set the backports repository for installing Postgresql"
+           echo "Cannot continue... Exiting"
+           exit 6
+       fi
+        echo "## Evergreen database settings for postgresql" > /etc/sysctl.d/evergreen_db.conf #TODO disabled for now
+       #echo "kernel.shmmax=17179869184" >> /etc/sysctl.d/evergreen_db.conf #TODO disabled for now
+       #echo "kernel.shmall = 4194304" >> /etc/sysctl.d/evergreen_db.conf #TODO dislbed for now
+       Install_DB_Deps
+       sed -i "s^#listen_addresses = 'localhost'^listen_addresses = '*'^g" /etc/postgresql/${PG_VER}/main/postgresql.conf
+       sed -i "s^#log_destination = 'stderr'^log_destination = 'syslog'^g" /etc/postgresql/${PG_VER}/main/postgresql.conf
+       sed -i "s^#syslog_facility = 'LOCAL0'^syslog_facility = 'LOCAL3'^g" /etc/postgresql/${PG_VER}/main/postgresql.conf
+       sed -i "s^#syslog_ident = 'postgres'^syslog_ident = 'postgres'^g" /etc/postgresql/${PG_VER}/main/postgresql.conf
+       #Init_DB_9 #TODO disabled. Now done the new way from the 1st brick head.
+       Add_EG_DB_User #TODO disabled same as above
+       
+       #if grep -q postgres /etc/passwd
+       #then
+       #       if pgrep posgtres
+       #       then 
+       #               POSTGRES_STATE="1"
+       #       fi
+       #       echo 
+       #       echo "Updating user postgres permissions"
+       #       sleep 1
+       #       while pgrep "postgres"
+       #       do 
+       #               echo 
+       #               echo stopping postgres to updated permissions
+       #               /etc/init.d/postgres stop 
+       #       sleep 5
+       #       done
+       #       if usermod -u 499 postgres
+       #       then
+       #               chown -R postgres:postgres /var/lib/postgresql
+       #               [ "$POSTGRES_STATE" = "1" ] && /etc/init.d/postgres start
+       #       else
+       #               echo
+       #               echo "failed to update permissions."
+       #       fi
+       #fi
 
-        fi
+    fi
 fi
 
 ### Setup Memcache to use 6GB or Memory.
 if cat /etc/hostname|grep -q memcache0
 then
-       echo
-       echo "Configuring memcached"
-       sleep 2
-       sed -i 's^-l^#-l^g' /etc/memcached.conf
-       sed -i 's^-m 64^-m 6144^g' /etc/memcached.conf
-       echo 
-       echo -e $COL_BRIGHT_RED"*** WARNING: "$COL_BRIGHT_CYAN "This Memcache server has been configured"
-       echo -e "for a MINimum of 8GB RAM.  If you do not have at least 8GB of ram in this server please reconfigure"
-       echo -e "/etc/memcached.conf for the amount of ram in this server and leave some overhead for"
-       echo -e "the operating system. " $COL_RESET
+    echo
+    echo "Configuring memcached"
+    sleep 2
+    sed -i 's^-l^#-l^g' /etc/memcached.conf
+    sed -i 's^-m 64^-m 6144^g' /etc/memcached.conf
+    echo 
+    echo -e $COL_BRIGHT_RED"*** WARNING: "$COL_BRIGHT_CYAN "This Memcache server has been configured"
+    echo -e "for a MINimum of 8GB RAM.  If you do not have at least 8GB of ram in this server please reconfigure"
+    echo -e "/etc/memcached.conf for the amount of ram in this server and leave some overhead for"
+    echo -e "the operating system. " $COL_RESET
 fi
 
 ### Setup Utility
-if cat /etc/hostname|grep -q utility0; then
-       if ! grep "Customizations For Evergreen" /etc/profile
-       then
-       echo
-       echo "Setting up Utility server tar_file"
-       sleep 2
-chown -R opensrf:opensrf /openils
+if cat /etc/hostname|grep -q utility0
+then
+    if ! grep "Customizations For Evergreen" /etc/profile
+    then
+    echo
+    echo "Setting up Utility server tar_file"
+    sleep 2
+    chown -R opensrf:opensrf /openils
 
 cat > utility_options.txt << EOF
 
@@ -468,42 +471,42 @@ export EDITOR="vim"
 alias ls="ls --color=auto"
 EOF
 
-       cat utility_options.txt >> /etc/profile
-       fi
-
-       if [ -e /home/opensrf ]
-       then
-               chown -R opensrf:opensrf /home/opensrf
-               echo
-               echo "setting crontab..."
-               echo "Please check the crontab for the user opensrf"
-               echo "to make sure it suits your environment."
-               sleep 2
-               if [ -e ./opensrf-crontab ]
-               then
-                       crontab -u opensrf opensrf-crontab 
-                       echo "Warning.. If using Pines, un-comment"
-                       echo "the Pines section in the crontab"
-                       echo "for the user opensrf"
-               else
-                       echo
-                       echo "Failed to install new crontab for tar_file"
-                       sleep 3
-               fi
-               if [ -e ./setup_sshkeys.sh ]
-               then
-                       echo;echo;echo "Setting up ssh keys"
-                       sleep 3
-                       ./setup_sshkeys.sh
-               else
-                       echo -e COL_BR_RED"***Warning.. setup_sshkeys.sh is missing"
-               fi
-               
-       else
-               echo;echo -e $COL_BR_RED"***Warning.. opensrf user does not exist"
-               echo -e "Not setting up crontab or ssh keys.."$COL_RESET
-               sleep 3
-       fi
+cat utility_options.txt >> /etc/profile
+    fi
+
+    if [ -e /home/opensrf ]
+    then
+        chown -R opensrf:opensrf /home/opensrf
+        echo
+        echo "setting crontab..."
+        echo "Please check the crontab for the user opensrf"
+        echo "to make sure it suits your environment."
+        sleep 2
+        if [ -e ./opensrf-crontab ]
+        then
+           crontab -u opensrf opensrf-crontab 
+           echo "Warning.. If using Pines, un-comment"
+           echo "the Pines section in the crontab"
+           echo "for the user opensrf"
+        else
+           echo
+           echo "Failed to install new crontab for tar_file"
+           sleep 3
+        fi
+        if [ -e ./setup_sshkeys.sh ]
+        then
+           echo;echo;echo "Setting up ssh keys"
+           sleep 3
+           ./setup_sshkeys.sh
+        else
+           echo -e COL_BR_RED"***Warning.. setup_sshkeys.sh is missing"
+        fi
+       
+    else
+        echo;echo -e $COL_BR_RED"***Warning.. opensrf user does not exist"
+        echo -e "Not setting up crontab or ssh keys.."$COL_RESET
+        sleep 3
+    fi
 ### Enable systemd autogen service for first boot
 systemctl enable autogen
 fi
@@ -511,18 +514,18 @@ fi
 AutoGen () { ### Run Autogen # this is currently defunct.
 if [ "$OSRF_NODE" = "1" ]
 then
-       echo "Restarting OpenSRF..."
-       echo
-       sleep 1
-       /etc/init.d/opensrf restart
-       echo "Running autogen..."
-       echo
-       sleep 1
-       /etc/init.d/opensrf autogen
-       echo "Restarting OpenSRF again..."
-       echo
-       sleep 1
-       /etc/init.d/opensrf restart 
+    echo "Restarting OpenSRF..."
+    echo
+    sleep 1
+    /etc/init.d/opensrf restart
+    echo "Running autogen..."
+    echo
+    sleep 1
+    /etc/init.d/opensrf autogen
+    echo "Restarting OpenSRF again..."
+    echo
+    sleep 1
+    /etc/init.d/opensrf restart 
 fi
 }
 
@@ -530,44 +533,44 @@ fi
 ## Monitor server
 if cat /etc/hostname | grep -q "monitor0"
 then
-       MONITOR_DIR="$WD/Icinga-Nagios"
-        ### Add PPA for lastest Icinga Monitoring Server.
-        if [ -e "$MONITOR_DIR/icinga_ppa.list" ]
+    MONITOR_DIR="$WD/Icinga-Nagios"
+    ### Add PPA for lastest Icinga Monitoring Server.
+    if [ -e "$MONITOR_DIR/icinga_ppa.list" ]
+    then
+       cp -f "$MONITOR_DIR/icinga_ppa.list" "/etc/apt/sources.list.d/icinga_ppa.list"
+        if apt-key adv --keyserver keyserver.ubuntu.com --recv-keys 36862847
         then
-               cp -f "$MONITOR_DIR/icinga_ppa.list" "/etc/apt/sources.list.d/icinga_ppa.list"
-                if apt-key adv --keyserver keyserver.ubuntu.com --recv-keys 36862847
-                then
-                       ### Install Icinga 
-                        echo;echo -e $COL_BR_GREEN "Installing latest Icinga for Monitoring"$COL_RESET;echo
-                        $APT_TOOL update && $APT_TOOL -y install icinga nagios-nrpe-plugin nagios-nrpe-server
-                       ### Configure Icinga/Nagios
-                       [ -e "/etc/icinga/commands.cfg" ] && mv /etc/icinga/commands.cfg /etc/icinga/commands.cfg-orig
-                       [ -e "/etc/icinga/objects/services.cfg" ] && mv /etc/icinga/objects/services.cfg /etc/icinga/objects/services.cfg-orig
-                       [ -e "/etc/icinga/objects/services_icinga.cfg" ] && mv /etc/icinga/objects/services_icinga.cfg /etc/icinga/objects/services_icinga.cfg-orig
-                       [ -e "/etc/icinga/objects/hostgroups_icinga.cfg" ] && mv /etc/icinga/objects/hostgroups_icinga.cfg /etc/icinga/objects/hostgroups_icinga.cfg-orig
-                       [ -e "/etc/icinga/objects/hostgroups.cfg" ] && mv /etc/icinga/objects/hostgroups.cfg /etc/icinga/objects/hostgroups.cfg-orig
-                       [ -e "/etc/icinga/objects/hosts.cfg" ] && cp /etc/icinga/objects/hosts.cfg /etc/icinga/objects/hosts.cfg-orig
-                       [ -e "/etc/icinga/objects/extinfo_icinga.cfg" ] && mv /etc/icinga/objects/extinfo_icinga.cfg /etc/icinga/objects/extinfo_icinga.cfg-orig
-                       cp -f "$MONITOR_DIR/commands.cfg" "/etc/icinga"
-                       cp -f "$MONITOR_DIR/services.cfg" "/etc/icinga/objects"
-                       cp -f "$MONITOR_DIR/hostgroups.cfg" "/etc/icinga/objects"
-                       cp -f "$MONITOR_DIR/hosts.cfg" "/etc/icinga/objects"
-                       cp -f "$MONITOR_DIR/check_hpacucli" "/usr/lib/nagios/plugins"
-                       cp -f "$MONITOR_DIR/check_hpasm" "/usr/lib/nagios/plugins"
-                       cp -f "$MONITOR_DIR/extinfo_icinga.cfg" "/etc/icinga/objects"
-                       ### Restart Icinga.
-                       /etc/init.d/icinga restart
-                else
-                        echo;echo -e $COL_BR_RED"Could not install signing key."
-                        echo -e "Not installing the monitoring server."
-                        echo -e "You will have to do this manually."$COL_RESET
-                fi
+               ### Install Icinga 
+            echo;echo -e $COL_BR_GREEN "Installing latest Icinga for Monitoring"$COL_RESET;echo
+            $APT_TOOL update && $APT_TOOL -y install icinga nagios-nrpe-plugin nagios-nrpe-server
+               ### Configure Icinga/Nagios
+               [ -e "/etc/icinga/commands.cfg" ] && mv /etc/icinga/commands.cfg /etc/icinga/commands.cfg-orig
+               [ -e "/etc/icinga/objects/services.cfg" ] && mv /etc/icinga/objects/services.cfg /etc/icinga/objects/services.cfg-orig
+               [ -e "/etc/icinga/objects/services_icinga.cfg" ] && mv /etc/icinga/objects/services_icinga.cfg /etc/icinga/objects/services_icinga.cfg-orig
+               [ -e "/etc/icinga/objects/hostgroups_icinga.cfg" ] && mv /etc/icinga/objects/hostgroups_icinga.cfg /etc/icinga/objects/hostgroups_icinga.cfg-orig
+               [ -e "/etc/icinga/objects/hostgroups.cfg" ] && mv /etc/icinga/objects/hostgroups.cfg /etc/icinga/objects/hostgroups.cfg-orig
+               [ -e "/etc/icinga/objects/hosts.cfg" ] && cp /etc/icinga/objects/hosts.cfg /etc/icinga/objects/hosts.cfg-orig
+               [ -e "/etc/icinga/objects/extinfo_icinga.cfg" ] && mv /etc/icinga/objects/extinfo_icinga.cfg /etc/icinga/objects/extinfo_icinga.cfg-orig
+               cp -f "$MONITOR_DIR/commands.cfg" "/etc/icinga"
+               cp -f "$MONITOR_DIR/services.cfg" "/etc/icinga/objects"
+               cp -f "$MONITOR_DIR/hostgroups.cfg" "/etc/icinga/objects"
+               cp -f "$MONITOR_DIR/hosts.cfg" "/etc/icinga/objects"
+               cp -f "$MONITOR_DIR/check_hpacucli" "/usr/lib/nagios/plugins"
+               cp -f "$MONITOR_DIR/check_hpasm" "/usr/lib/nagios/plugins"
+               cp -f "$MONITOR_DIR/extinfo_icinga.cfg" "/etc/icinga/objects"
+               ### Restart Icinga.
+               /etc/init.d/icinga restart
         else
-                echo 
-                echo -e $COL_BR_RED"Could not install icinga"
-                echo -e "Failed to add icinga PPA"
-                echo -e $COL_RED"$MONITOR_DIR/icinga_ppa.list not found."$COL_RESET
+            echo;echo -e $COL_BR_RED"Could not install signing key."
+            echo -e "Not installing the monitoring server."
+            echo -e "You will have to do this manually."$COL_RESET
         fi
+    else
+        echo 
+        echo -e $COL_BR_RED"Could not install icinga"
+        echo -e "Failed to add icinga PPA"
+        echo -e $COL_RED"$MONITOR_DIR/icinga_ppa.list not found."$COL_RESET
+    fi
 fi
 
 
@@ -585,47 +588,47 @@ ConfigNetwork
 ### Finish setting up the dbs
 if cat /etc/hostname|grep -q db0
 then
-       if [ -e /etc/eg_fstab_db ] ### update fstab for backup mounts
-       then
-               if ! grep -q -f /etc/eg_fstab_db /etc/fstab
-               then
-                       echo;echo -e $COL_BR_GREEN"Updating /etc/fstab"$COL_RESET
-                       cat /etc/eg_fstab_db >> /etc/fstab
-                       sleep 1
-               else
-                       echo;echo -e $COL_BR_GREEN"fstab already updated"$COL_RESET
-                       sleep 3
-               fi
-       else
-               echo
-               echo -e $COL_BR_RED"***WARNING eg_fstab_db not found"         
-               echo -e "Could not update /etc/fstab"$COL_RESET
-               sleep 3
-       fi
-       if [ -e ./eg_db_root.crontab ] && [ -e ./eg_db_postgres.crontab ] ### update crontab for archiving.
+    if [ -e /etc/eg_fstab_db ] ### update fstab for backup mounts
+    then
+       if ! grep -q -f /etc/eg_fstab_db /etc/fstab
+       then
+               echo;echo -e $COL_BR_GREEN"Updating /etc/fstab"$COL_RESET
+               cat /etc/eg_fstab_db >> /etc/fstab
+               sleep 1
+       else
+               echo;echo -e $COL_BR_GREEN"fstab already updated"$COL_RESET
+               sleep 3
+       fi
+    else
+       echo
+       echo -e $COL_BR_RED"***WARNING eg_fstab_db not found"     
+       echo -e "Could not update /etc/fstab"$COL_RESET
+       sleep 3
+    fi
+    if [ -e ./eg_db_root.crontab ] && [ -e ./eg_db_postgres.crontab ] ### update crontab for archiving.
        then
-               crontab -u root eg_db_root.crontab
-                                crontab -u postgres eg_db_postgres.crontab
-       else
-               echo
-               echo $COL_BR_RED"WARNING!! Failed to install new crontabs for tar_file"$COL_RESET
-               sleep 3
-       fi
-
-       if [ ! -e /var/backup ]
-       then
-               mkdir -p /var/backup
-       fi
-       
-       ## Add librose-uri-perl_1.00-1_all.deb from Ubuntu 14.04 to the db servers
-       ## this will be removed in GenaSYS-14.04
-       if [ -e ./librose-uri-perl_1.00-1_all.deb ]
-       then
-               echo
-               echo -e $COL_YELLOW"installing additional debs..."$COL_RESET
-               sleep 2
-               gdebi --n librose-uri-perl*.deb
-       fi
+       crontab -u root eg_db_root.crontab
+                crontab -u postgres eg_db_postgres.crontab
+    else
+       echo
+       echo $COL_BR_RED"WARNING!! Failed to install new crontabs for tar_file"$COL_RESET
+       sleep 3
+    fi
+
+    if [ ! -e /var/backup ]
+    then
+       mkdir -p /var/backup
+    fi
+    
+    ## Add librose-uri-perl_1.00-1_all.deb from Ubuntu 14.04 to the db servers
+    ## this will be removed in GenaSYS-14.04
+    if [ -e ./librose-uri-perl_1.00-1_all.deb ]
+    then
+       echo
+       echo -e $COL_YELLOW"installing additional debs..."$COL_RESET
+       sleep 2
+       gdebi --n librose-uri-perl*.deb
+    fi
 chown postgres:postgres /var/backup
 
 echo
@@ -638,92 +641,92 @@ fi
 ### Setup SIP
 if cat /etc/hostname | grep -q "sip0"
 then
-       if [ -e oils_sip.xml ]
-       then
-               echo
-               echo -e ${COL_BR_GREEN}"Found pre-configured oils_sip.xml"${COL_RESET}
-               echo -e ${COL_BR_CYAN}"Using custom oils_sip.xml"${COL_RESET}
-               cp -f oils_sip.xml /openils/conf
-       else
-               echo 
-               echo -e $COL_BR_YELLOW"IMPORTANT!! MANUAL STEPS REQUIRED**"$COL_GREEN
-               echo "To complete the setup of the SIP service"
-               echo "there are some manual steps that must be taken."
-               echo "First, reboot this host then login and continue the steps in the docs"
-               echo "See: http://docs.evergreen-ils.org/2.0/draft/html/sipserver.html"
-               echo -e "Continue the steps from the section labled" $COL_RESET$COL_BR_GREEN"\"Configuring the Server\"" $COL_RESET
-       fi
-               if [ -e /etc/init.d/oils_sip ]
-               then
-                       update-rc.d oils_sip defaults
-               else
-                       echo
-                       echo "/etc/init.d/oils_sip not found"
-                       echo "SIP Server will not start on boot"
-               fi
-       a2dissite 000-default && a2ensite eg.conf
-       if [ -e /root/eg/eg_sip_root.crontab ]
-                then
-                        crontab -u root /root/eg/eg_sip_root.crontab && \
-                       echo;echo "SIP Server is configured to restart nightly at midnight."
-                else
-                        echo
-                        echo "Failed to install new crontab for tar_file"
-                        sleep 3
-                fi
-       chown -R opensrf:opensrf /opt/SIPServer
-        chown -R opensrf:opensrf /openils
+    if [ -e oils_sip.xml ]
+    then
+       echo
+       echo -e ${COL_BR_GREEN}"Found pre-configured oils_sip.xml"${COL_RESET}
+       echo -e ${COL_BR_CYAN}"Using custom oils_sip.xml"${COL_RESET}
+       cp -f oils_sip.xml /openils/conf
+    else
+       echo 
+       echo -e $COL_BR_YELLOW"IMPORTANT!! MANUAL STEPS REQUIRED**"$COL_GREEN
+       echo "To complete the setup of the SIP service"
+       echo "there are some manual steps that must be taken."
+       echo "First, reboot this host then login and continue the steps in the docs"
+       echo "See: http://docs.evergreen-ils.org/2.0/draft/html/sipserver.html"
+       echo -e "Continue the steps from the section labled" $COL_RESET$COL_BR_GREEN"\"Configuring the Server\"" $COL_RESET
+    fi
+       if [ -e /etc/init.d/oils_sip ]
+       then
+               update-rc.d oils_sip defaults
+       else
+               echo
+               echo "/etc/init.d/oils_sip not found"
+               echo "SIP Server will not start on boot"
+       fi
+    a2dissite 000-default && a2ensite eg.conf
+    if [ -e /root/eg/eg_sip_root.crontab ]
+        then
+            crontab -u root /root/eg/eg_sip_root.crontab && \
+               echo;echo "SIP Server is configured to restart nightly at midnight."
+        else
+            echo
+            echo "Failed to install new crontab for tar_file"
+            sleep 3
+        fi
+    chown -R opensrf:opensrf /opt/SIPServer
+    chown -R opensrf:opensrf /openils
 fi
 
 ### Setup backup server.
 if cat /etc/hostname | grep -q "backup0"
 then
-       #echo "postgres:x:103:107:PostgreSQL administrator,,,:/var/lib/postgresql:/bin/bash" >> /etc/passwd
-       #echo -e $COL_BR_BLUE "NOTE ** Please verify that the user postgres"
-       #echo -e "has write permissions to the NFS share"
-       #echo -e "from all the DB servers." $COL_RESET
-       useradd -m -s /bin/bash -u "$PG_UID" -d /var/backup postgres
-       chown -R postgres:postgres /var/backup
+    #echo "postgres:x:103:107:PostgreSQL administrator,,,:/var/lib/postgresql:/bin/bash" >> /etc/passwd
+    #echo -e $COL_BR_BLUE "NOTE ** Please verify that the user postgres"
+    #echo -e "has write permissions to the NFS share"
+    #echo -e "from all the DB servers." $COL_RESET
+    useradd -m -s /bin/bash -u "$PG_UID" -d /var/backup postgres
+    chown -R postgres:postgres /var/backup
 fi
 
 ### Setup offline for all OpenSRF nodes.
 if [ "$OSRF_NODE" = "1" ]
 then 
-       su - opensrf -c eg_db_config --create-offline
+    su - opensrf -c eg_db_config --create-offline
 fi
 
 ### Display LVS Notes.
 if cat /etc/hostname | grep -q "lvs0"
 then
-       echo
-       echo -e $COL_BR_GREEN "NOTE ** ha.cf is configured to use broadcast"
-       echo -e "over ethernet between lvs01 and lvs02 for failover"
-       echo -e "to function correctly. Veryfiy that the bcast"
-       echo -e "directive has the correct ethernet inteface"
-       echo -e "for the *PRIVATE* network."  $COL_RESET
-       ### Configure apache for lvs servers.
-        if [ -e "/etc/apache2/sites-available/default-ssl.conf" ]
-        then
-                Config_Apache2_Default_SSL
-                a2ensite default-ssl.conf
-        else
-                echo;echo "Apache2 not installed yet"
-                echo "installing Apache2..."
-               sleep 1
-                $APT_TOOL install apache2 openssl
-                Config_Apache2_Default_SSL
-                a2ensite default-ssl.conf
-        fi
-       GetNics
-       sed -i "s/Primary_Interface/${PRIMARY_INTERFACE}/g" /etc/network/interfaces
-       sed -i "s/Private_Interface/${SECOND_PHYSICAL_INTERFACE}/g" /etc/network/interfaces
-       sed -i "s/Primary_Interface/${PRIMARY_INTERFACE}/g" /etc/ha.d/haresources
-        sed -i "s/Private_Interface/${SECOND_PHYSICAL_INTERFACE}/g" /etc/ha.d/haresources
-       # configure firewall for lvs servers
-       sed -i "s/XTRNL_IF/$PRIMARY_INTERFACE/g" "/etc/network/iptables-rules.fw" #TODO update variable and switch from hard coded interface name - done
-       # find secondary interface
-       # SECONDARY_IF=$(ls /sys/class/net |grep -v "lo" |grep -v "$PRIMARY_IF") #TODO remove this line completely as its deprecated by GetNics() - done
-       sed -i "s/INTRNL_IF/$SECOND_PHYSICAL_INTERFACE/g" "/etc/network/iptables-rules.fw" #TODO update variable and switch from hard coded interface name - done
+    echo
+    echo -e $COL_BR_GREEN "NOTE ** ha.cf is configured to use broadcast"
+    echo -e "over ethernet between lvs01 and lvs02 for failover"
+    echo -e "to function correctly. Veryfiy that the bcast"
+    echo -e "directive has the correct ethernet inteface"
+    echo -e "for the *PRIVATE* network."  $COL_RESET
+    ### Configure apache for lvs servers.
+    if [ -e "/etc/apache2/sites-available/default-ssl.conf" ]
+    then
+        Config_Apache2_Default_SSL
+        a2ensite default-ssl.conf
+    else
+        echo;echo "Apache2 not installed yet"
+        echo "installing Apache2..."
+       sleep 1
+        $APT_TOOL install apache2 openssl
+        Config_Apache2_Default_SSL
+        a2ensite default-ssl.conf
+    fi
+    GetNics
+    sed -i "s/Primary_Interface/${PRIMARY_INTERFACE}/g" /etc/network/interfaces
+    sed -i "s/Private_Interface/${SECOND_PHYSICAL_INTERFACE}/g" /etc/network/interfaces
+    sed -i "s/Primary_Interface/${PRIMARY_INTERFACE}/g" /etc/ha.d/haresources
+    sed -i "s/Private_Interface/${SECOND_PHYSICAL_INTERFACE}/g" /etc/ha.d/haresources
+    # configure firewall for lvs servers
+    sed -i "s/XTRNL_IF/$PRIMARY_INTERFACE/g" "/etc/network/iptables-rules.fw" #TODO update variable and switch from hard coded interface name - done
+    # find secondary interface
+    # SECONDARY_IF=$(ls /sys/class/net |grep -v "lo" |grep -v "$PRIMARY_IF") #TODO remove this line completely as its deprecated by GetNics() - done
+    sed -i "s/INTRNL_IF/$SECOND_PHYSICAL_INTERFACE/g" "/etc/network/iptables-rules.fw" #TODO update variable and switch from hard coded interface name - done
 
 fi
 
@@ -732,29 +735,29 @@ fi
 ### Setup reporter fstab if needed.
 if cat /etc/hostname | grep -q "reporter0"
 then
-       if [ -e /etc/eg_fstab_reporter ]
-       then
-               if ! grep -q -f /etc/eg_fstab_reporter /etc/fstab
-               then
-                       cat /etc/eg_fstab_reporter >> /etc/fstab
-               fi
-       fi
-       if rm -rf /openils/var/web/reporter
-       then
-               if ! ln -s /storage/reports-output /openils/var/web/reporter 
-               then
-                       echo
-                       echo "WARNING!!"
-                       echo "/openils/var/web/reporter was removed"
-                       echo "but failed to create new symbolic link to"
-                       echo "/openils/var/web/reporter /storage/reports-output"
-                       read -p "Press [Enter] to continue" CONTINUE
-               fi
-       else
-               echo
-               echo "WARNING!! failed to link /openils/var/web/reporter /storage/reports-output"
-               read -p "Press [Enter] to continue" CONTINUE
-       fi
+    if [ -e /etc/eg_fstab_reporter ]
+    then
+       if ! grep -q -f /etc/eg_fstab_reporter /etc/fstab
+       then
+               cat /etc/eg_fstab_reporter >> /etc/fstab
+       fi
+    fi
+    if rm -rf /openils/var/web/reporter
+    then
+       if ! ln -s /storage/reports-output /openils/var/web/reporter 
+       then
+               echo
+               echo "WARNING!!"
+               echo "/openils/var/web/reporter was removed"
+               echo "but failed to create new symbolic link to"
+               echo "/openils/var/web/reporter /storage/reports-output"
+               read -p "Press [Enter] to continue" CONTINUE
+       fi
+    else
+       echo
+       echo "WARNING!! failed to link /openils/var/web/reporter /storage/reports-output"
+       read -p "Press [Enter] to continue" CONTINUE
+    fi
 fi
 
 ## Monitored hosts
@@ -763,23 +766,23 @@ SetupMonitoring
 ## Setup Apache2 for Munin.
 if [ -e /etc/apache2/sites-available/munin-vhost.conf ]
 then
-       a2ensite munin-vhost.conf
+    a2ensite munin-vhost.conf
 fi
 
 ## Setup htpasswd for Munin.
 if [ -e ${WD}/.munin_admin_password ]
 then
-       MUNIN_PWD="$(cat ${WD}/.munin_admin_password)"
-       echo
-       echo "Generating password for muninadmin ..."
-       sleep 2
-       htpasswd -bc /var/cache/munin/www/.htpasswd muninadmin ${MUNIN_PWD} && rm -f ${WD}/.munin_admin_password
+    MUNIN_PWD="$(cat ${WD}/.munin_admin_password)"
+    echo
+    echo "Generating password for muninadmin ..."
+    sleep 2
+    htpasswd -bc /var/cache/munin/www/.htpasswd muninadmin ${MUNIN_PWD} && rm -f ${WD}/.munin_admin_password
 fi
 
 ## Setup Apache2 for Icinga
 if [ -e /etc/apache2/sites-available/icinga-vhost.conf ]
 then   
-        a2ensite icinga-vhost.conf
+    a2ensite icinga-vhost.conf
 fi
 
 ### Enhance bashrc for root.
@@ -804,34 +807,34 @@ alias l='ls $LS_OPTIONS -lA'
 EOF
 
 if ! grep -q "Evergreen Modifications" /root/.bashrc
-       then
-       if [ "$OSDISTRO" == "Debian" ]
-               then    
-               cat bashrc-options.txt >> /root/.bashrc
-       fi
+    then
+    if [ "$OSDISTRO" == "Debian" ]
+       then    
+       cat bashrc-options.txt >> /root/.bashrc
+    fi
 fi
 
 ### Check if this is hosting the reports output share
 ### and make sure user opensrf exits and perms correct.
 if [ -e /etc/eg_reports_output_host.txt ]
 then
-        if ! grep -q "^opensrf" /etc/passwd
-        then
-                useradd -m -u 2000 -s /bin/bash opensrf
-        fi
-        chown -R opensrf:opensrf /storage/reports-output
-       $APT_TOOL -y install nfs-kernel-server rpcbind
-       systemctl add-wants nfs-mountd.service rpcbind.service
+    if ! grep -q "^opensrf" /etc/passwd
+    then
+        useradd -m -u 2000 -s /bin/bash opensrf
+    fi
+    chown -R opensrf:opensrf /storage/reports-output
+    $APT_TOOL -y install nfs-kernel-server rpcbind
+    systemctl add-wants nfs-mountd.service rpcbind.service
 fi
 
 ### make sure the permissions are correct.
 if [ -e /openils ]
 then 
-       chown -R opensrf:opensrf /openils
+    chown -R opensrf:opensrf /openils
 fi
 if [ -e /home/opensrf ]
 then
-       chown -R opensrf:opensrf /home/opensrf
+    chown -R opensrf:opensrf /home/opensrf
 fi
 
 echo