Bug 23610 - Allaire ColdFusion won't install on RH7 "Web Server"
Allaire ColdFusion won't install on RH7 "Web Server"
Status: CLOSED NOTABUG
Product: Red Hat Linux
Classification: Retired
Component: libstdc++ (Show other bugs)
7.0
i386 Linux
medium Severity medium
: ---
: ---
Assigned To: Jakub Jelinek
:
Depends On:
Blocks:
  Show dependency treegraph
 
Reported: 2001-01-08 15:00 EST by Tim Denby
Modified: 2008-05-01 11:37 EDT (History)
0 users

See Also:
Fixed In Version:
Doc Type: Bug Fix
Doc Text:
Story Points: ---
Clone Of:
Environment:
Last Closed: 2001-01-08 15:00:57 EST
Type: ---
Regression: ---
Mount Type: ---
Documentation: ---
CRM:
Verified Versions:
Category: ---
oVirt Team: ---
RHEL 7.3 requirements from Atomic Host:
Cloudforms Team: ---


Attachments (Terms of Use)

  None (edit)
Description Tim Denby 2001-01-08 15:00:51 EST
When I install RedHat 7.0 with the option Custom -> Install 
Everything, I am able to successfully install and configure Allaire 
ColdFusion Professional Server 4.5.1.  However, if I choose "Server" and 
then "Web Server" during the RedHat Linux install, and then try to install 
CF Server, the server install crashes with the following messages:


Initializing ColdFusion Settings...
/opt/coldfusion/bin/cfexec: error while loading shared libraries: 
libstdc++-libc6.1-1.so.2: cannot open shared object file: No such file or 
directory
ERROR: Unable to initialize the Cold Fusion settings.
ERROR: Aborting installation.


     Appended to this bug report is the "cfinstall" script during which 
the crash occurs.

     I have tried using Allaire's service pack, 4.5.1 SP2, for their 
product, to no avail.  I have alse installed the RedHat Bugfixes:

http://www.redhat.com/support/errata/RHBA-2000-079.html
http://www.redhat.com/support/errata/RHBA-2000-112.html

which update libc and the webserver packages and I still get the same 
error.  I have reproduced this problem four or five times now.

     A gentleman on a discussion thread at the Allaire site:

http://forums.allaire.com/devconf/Thread.cfm?&Thread_ID=210372&mc=2

suggested that I should try to transplant this particular file from an 
older RedHat distribution with an older version of libstdc++.  I haven't 
tried this yet.

     As I mentioned, if I install all of the packages in the RH 7 distro, 
I do not experience this problem when installing CF.  But I have been 
unable to find the file mentioned in the error message by using the GNU 
find utility.



------------------------------cfinstall script---------------

#!/bin/sh
#
# Install script
#
# Linux
#

CFVERSION=4.5.1

#
# This is the version of Apache we pre-build mod_coldfusion.so using
# any any upward compatible released versions
#
CF_APACHE_VERS="1.3.6 1.3.9 1.3.11 1.3.12"

# Exit on interrupt
trap 'echo "";exit 3' 2 15

#####################################################################
# check_env() - Check environment 
#
# Variables:
#  UPDATE - set to 'y' if updating an existing installation
#####################################################################
check_env()
{
	# Verify that we're running as root.
	if [ `id -u` -ne 0 ]; then
        echo "ERROR: This install must be run as root."
		echo "ERROR: Aborting installation"
        exit 1
	fi

	# check that we have our data file
	if [ ! -f ./data.tar ]; then
		echo "ERROR: Unable to locate data file (data.tar) in 
current directory."
		echo "ERROR: Aborting installation"
		exit 1
	fi

	# Shut down ColdFusion
	if [ -x /opt/coldfusion/bin/stop ]; then
		echo "Shutting down ColdFusion..."
		/opt/coldfusion/bin/stop -force > /dev/null 2>&1
	fi

	# load previous environment
	UPDATE='n'
	if [ -f /opt/coldfusion/registry/.cfinstall.dat ]; then
		. /opt/coldfusion/registry/.cfinstall.dat
		UPDATE='y'
	fi

} # check_env


#
# 	ANSWER - valid ID
#         where return is the default
#         where return is the default

#####################################################################
# ask() - Prompt with string and no newline, read reply
#         where return is the default
#
# Arguments
#   $1 - prompt
#   $2 - default (can be nothing)
#
# Variables set: 
# 	ANSWER - valid ID
#
#####################################################################
ask()
{
	prompt="$1"
	default="$2"

	while [ 1 ]
	do
		if [ -z "$def" ]; then
			echo -n "$prompt :"
			read line
			if [ -z "$line" ]; then
				echo ""
				echo "Please enter a response."
				echo ""
			else
				ANSWER=$line
				break
			fi
		else
			echo -n "$prompt [$def]:"
			read line
			if [ -z "$line" ]; then
				ANSWER="$def"
			else
				ANSWER=$line
			fi
			break
		fi
	done
} # ask

#####################################################################
# ask_dir() - Get a valid directory name
#
# Arguments
#   $1 - prompt
#   $2 - default (can be nothing)
#
# Variables set: 
# 	DIR - A directory which exists and is writable
#
#####################################################################
ask_dir()
{
	prompt="$1"
	def="$2"

	while [ 1 ]
	do
		ask "$prompt" "$def"

		if [ -d $ANSWER -a -w $ANSWER ]; then
			DIR="$ANSWER"
			break
		else
			echo "This directory does not exist or is not 
writable"
		fi
	done

} # ask_dir 

#####################################################################
# ask_yorn() - Ask yes or no question
#
# Arguments
#   $1 - prompt
#   $2 - default (can be nothing)
#
# Variables set: 
# 	YORN - either 'y' or 'n'
#
#####################################################################
ask_yorn()
{
	prompt="$1"
	def="$2"

	while [ 1 ]
	do
		ask "$prompt" "$def"

		case "$ANSWER" in
			y*|Y*)
				YORN='y'
				break
				;;
			n*|N*)
				YORN='n'
				break
				;;
			*)
				echo "Please answer 'y or 'n'"
				;;
		esac
	done

} # ask_yorn 

#####################################################################
# ask_password() - Prompt twice for a password
#
# Variables set: 
# 	PASSWORD - verified password
#
#####################################################################
ask_password()
{
	while true
	do
		echo -n "Enter password:"
		stty -echo
		read p1
		echo -en "\nVerify password:"
		read p2
		stty echo
		echo ""
		if [ "$p1" = "$p2" ]; then
			break
		else
			echo -e "ERROR: Passwords did not match - try 
again\n"
		fi
	done
	PASSWORD="$p1"
} # ask_password

#####################################################################
# ask_user() - Prompt for a valid username
#
# Variables set: 
# 	THEUSER - verified userid
#
#####################################################################
ask_user()
{
	prompt="$1"
	def="$2"

  while [ 1 ]
  do
	ask "$prompt" "$def"

	id $ANSWER > /dev/null 2>&1
	if [ $? -ne 0 ]; then
		echo "Please enter the login name of an existing user."
	else
		THEUSER=$ANSWER
		break
	fi
  done

} # ask_user


#####################################################################
# get_regid() - Get registration ID
#
# Variables set: 
# 	REGID - valid ID
#
#####################################################################
get_regid()
{
	if [ ! -z "$REGID" -a "$REGID" != "Evaluation" ]; then
		def=$REGID
	else
		def=""
	fi

	# Do simple sanity checking here, it it really isn't valid
	# ColdFusion will throw an error
	while [ 1 ]
	do
		ask "Please enter your ColdFusion registration ID" $def

		regexp='CF45.LX-.\{2\}[0-9]\{4\}.\{4\}'
		x=`expr match "$ANSWER" "$regexp"`

		if [ "$x" -eq 18 ]; then
			REGID="$ANSWER"
			break
		else
			echo ""
			echo "This is not a valid registration ID" 
			echo ""
		fi
	done

	echo ""

} # get_regid


#####################################################################
# get_installdir() - Get installation directory
#
# Variables set: 
# 	INSTALLDIR - existing, writable directory
#
#####################################################################

get_installdir()
{
	if [ ! -z "$INSTALLDIR" ]; then
		def=$INSTALLDIR
	else
		def=/opt
	fi

    echo ""
    echo "Please enter the absolute path of the directory where you'ld 
like"
    echo "ColdFusion installed. ColdFusion will be installed into a 
subdirectory,"
    echo "named 'coldfusion', of the directory you specify here. You do 
not need"
    echo "to create the 'coldfusion' subdirectory (this install will 
create it"
    echo "for you), but the parent directory you specify here must already 
exist."
    echo ""

	ask_dir "Enter the installation directory for ColdFusion" $def
	INSTALLDIR="$DIR"

}

#####################################################################
# get_webserver() - Find out which webserver
#
# Variables set: 
# 	WEBSERVER - name of webserver
#   DOPLUGIN  - Auto-configure web server ('y' or 'n')
#   Netscape:
#     NETSCAPEDIR - Netscape install directory
#     NETSCAPECONFIG - Netscape config directory
#   Apache:
#     APACHEDIR - APACHE root directory
#
#####################################################################
get_webserver()
{
  echo ""
  echo "In order for ColdFusion to be able to receive requests your web 
server must be "
  echo "configured to recognize CFML files."
  echo ""
  echo "For Apache, a ColdFusion dynamically loaded module must be 
configured."
  echo "For a Netscape server, the installation can install a NSAPI plugin 
to do this."
  echo "If you are running another web server, you must configure a CGI 
program."
  echo ""
  if [ ! -z "$WEBSERVER" ]; then
  	def=$WEBSERVER
  else
  	def=apache
  fi

  while [ 1 ]
  do
  	ask "What type of web server are you running (apache netscape 
other)" $def

	if [ "$ANSWER" = "netscape" -o "$ANSWER" = "apache" -o "$ANSWER" 
= "other" ]; then
		WEBSERVER="$ANSWER"
		break
	else
		echo "Please enter one of: netscape, apache, other"
	fi
  done

  if [ $WEBSERVER = netscape ]; then

	# If Netscape, should we config, where is the installation

	ask_yorn "Automatically configure your Netscape server" "y"
	DOPLUGIN=$YORN
	if [ $DOPLUGIN = y ]; then
		if [ ! -z "$NETSCAPEDIR" ]; then
			def=$NETSCAPEDIR
		elif [ -d /usr/netscape/server4 -a -
w /usr/netscape/server4 ]; then 
			def=/usr/netscape/server4
		elif [ -d /usr/netscape/suitespot -a -
w /usr/netscape/suitespot ]; then
			def=/usr/netscape/suitespot
		elif [ -d /usr/ns-home -a -w /usr/ns-home ]; then
			def=/usr/ns-home
		else
			def=""
		fi
		ask_dir "Enter the Netscape installation directory" $def
		NETSCAPEDIR="$DIR"

		hostname=`hostname -s`
		fqdn=`hostname --fqdn`
		foundit=0
		# check for config directory now!
		NETSCAPECONFIG=$NETSCAPEDIR/https-$hostname/config
		if [ ! -d $NETSCAPECONFIG ]; then
			NETSCAPECONFIG=$NETSCAPEDIR/httpd-$hostname/config
			if [ ! -d $NETSCAPECONFIG ]; then
				NETSCAPECONFIG=$NETSCAPEDIR/https-
$fqdn/config
				if [ -d $NETSCAPECONFIG ]; then
					# Found it -- iPlanet (Netscape 
4.0)
					foundit=1
				fi
			else
				foundit=1
			fi
		else
			foundit=1
		fi
		
		#
		# If we couldn't locate the netscape config files, despite 
our
		# gallant efforts, we are going to have to ask the user
		#
		if [ $foundit -eq 0 ]; then
			echo ""
			echo "ERROR: Unable to find Netscape 'config' 
directory."
			echo "This is the directory which contains the 
files: obj.conf, magnus.conf"
			echo "and mime.types.  It is usually found in a 
directory such as "
			echo "/usr/netscape/suitespot/https-surf/config, 
where '/usr/netscape/suitespot' is"
			echo "the Netscape installation directory entered 
above and 'surf' is the hostname"
			echo "of the webserver."

			ask_dir "Enter the Netscape 'config' directory"
			NETSCAPECONFIG="$DIR"

			#
			# We need to update the NETSCAPEDIR variable, 
because
			# we have excepted manual entry for the 
NETSCAPECONFIG
			# directory
			#
			NETSCAPEDIR=`dirname ${NETSCAPECONFIG}`
			NETSCAPEDIR=`dirname ${NETSCAPEDIR}`

		fi

		# figure out what netscape version this is
		if [ -d $NETSCAPEDIR/bin/https ]; then
			curdir=`pwd`
			if [ -x $NETSCAPEDIR/bin/https/bin/ns-httpd ]; then
				# This is looking like 4.0
				#
				cd $NETSCAPEDIR/bin/https/bin
			else
				# This is probably 2.0 or 3.x
				cd $NETSCAPEDIR/bin/https
			fi
			VERSION=`./ns-httpd -v | tail -1`
			case $VERSION in
				*/2.0*) NETSCAPEVERSION=2 ;;
				*/3.0*) NETSCAPEVERSION=3 ;;
				*/3.*) NETSCAPEVERSION=35 ;;
				*/4.*) NETSCAPEVERSION=4 ;;
				*) NETSCAPEVERSION="" ;;
			esac
			cd ${curdir}
			if [ ! -z "$NETSCAPEVERSION" ]; then
				echo "You are running $VERSION"
			fi
		fi

		# if we can't figure it out, ask
		if [ -z "$NETSCAPEVERSION" ]; then
			def=4

			while [ 1 ]
			do
				ask "Which version of the Netscape server 
are you running (2, 3, 35, 36, or 4)" $def
				case $ANSWER in
					2)  break ;;
					3)  break ;;
					35) break ;;
					36) break ;;
					4) break ;;
				esac
				echo "Please enter one of the following: 
2, 3, 35, 36, 4"
				echo ""
			done
			NETSCAPEVERSION=$line
		fi
	fi

  elif [ $WEBSERVER = apache ]; then
  	# If Apache 1.3, should we config, where is the installation

	# first, check for Red Hat
	rebuild=y
	headers=n
	redhat=n
   if [ -x /bin/rpm ]; then
	rpm -q apache > /dev/null 2>&1
	if [ $? -eq 0 ]; then
			ver=`rpm -q --queryformat "%{VERSION}" apache`
			redhat=y
			set $CF_APACHE_VERS
			while [ -n "$1" ]; do
				if [ "$ver" = "$1" ]; then
					rebuild='n'
					break;
				fi
				shift
			done

		rpm -q apache-devel > /dev/null 2>&1
		if [ $? -eq 0 ]; then
			headerver=`rpm -q --queryformat "%{VERSION}" 
apache-devel`
			headers=y
		fi

		echo ""
		echo "It appears you have Apache $ver installed."
		echo ""

		# If we have the headers - we can always auto-config
		# OR if we dont have the headers, but the prebuilt version 
OK
		#    we can do autoconfig
		if [ $headers = y -o $rebuild = n ]; then
			ask_yorn "Automatically configure your Apache 
server" "y"
			DOPLUGIN=$YORN
			APACHEDIR=/etc/httpd
		else 
			DOPLUGIN=n
			echo "I can not automatically rebuild the Apache 
module for the installed version"
			echo "of Apache ($ver).  You must install the 
packge 'apache-devel'"
  			echo "and follow the instructions in "
			echo "
	$INSTALLDIR/coldfusion/webserver/apache/README"
			echo ""
		fi
	fi
   fi  # if /bin/rpm

   if [ $redhat = n ]; then
	# Not Red Hat, just ask where Apache is and proceed as 'normal'
  	echo ""
  	echo "If Apache is configured with 'mod_so' enabled the ColdFusion"
  	echo "installation can use the 'apxs' program provided with Apache 
to compile"
  	echo "mod_coldfusion.c for your version of Apache and configure 
the web server"
  	echo "server to load it.  You must have a C compiler (gcc) and "
  	echo "a perl interpreter (for apxs) available."
  	echo ""
  	echo "If you have Apache 1.2.x or have not configured Apache to 
dynamically load"
  	echo "modules, you should answer 'no' to the following question 
and read the README"
  	echo "file in $INSTALLDIR/coldfusion/webserver/apache for 
instructions on" 
  	echo "how to rebuild your server with ColdFusion support."
	echo ""
	ask_yorn "Automatically configure your Apache server" "y"
	DOPLUGIN=$YORN
  	if [ $DOPLUGIN = y ]; then
  		if [ ! -z "$APACHEDIR" ]; then
  			def=$APACHEDIR
  		elif [ -d /usr/local/apache -a -w /usr/local/apache ]; then
  			def=/usr/local/apache
  		else
  			def=""
  		fi
		echo ""
		ask_dir "Enter the Apache installation directory" $def
		APACHEDIR=$DIR
  
  		# check for apxs, indicates Apache 1.2 or 1.3
		type apxs > /dev/null 2>&1
  		if [ $? -ne 0 -a ! -x $APACHEDIR/bin/apxs ]; then
  			echo ""
  			echo "I can not find the 'apxs' program on your 
PATH or in $APACHEDIR/bin."
  			echo "You may be using Apache 1.2.x, or I am not 
looking in the right place."
  			echo "After the installation is complete, you 
should read the README"
  			echo "file in 
$INSTALLDIR/coldfusion/webserver/apachefor instructions on" 
  			echo "how to rebuild your server with ColdFusion 
support."
  			echo ""
  			DOPLUGIN="n"
  		fi
  	fi
   fi
  else
  	# If CGI, explain cfml, ask where to put it
  
  	echo ""
  	echo "In order for your web server to communicate with the"
  	echo "ColdFusion Application server, you must use the 'cfml'"
  	echo "CGI program.  Most web servers restrict CGI programs to"
  	echo "certain directories (such as cgi-bin)."
	ask_dir "Enter the CGI directory for your web server"
	CGIDIR=$DIR
  fi
} # get_webserver

#####################################################################
# get_docroot() - Get document root
#
# Variables set: 
# 	DOCROOT - Valid writable directory
#
#####################################################################
get_docroot()
{
  echo ""
  echo "In order to install the ColdFusion Administrator and the 
ColdFusion"
  echo "documentation, files must be copied in to the document directory"
  echo "(usually called the document root) of your web server."
  echo ""
  if [ ! -z "$DOCROOT" ]; then
  	def=$DOCROOT
  elif [ $WEBSERVER = netscape ]; then
  	def=$NETSCAPEDIR/docs
  elif [ $WEBSERVER = apache ]; then
	if [ "$redhat" = "y" ]; then
  		def=/home/httpd/html
	else
  		def=$APACHEDIR/htdocs
	fi
  fi
  if [ ! -d $def -o ! -w $def ]; then
  	def=""
  fi

  ask_dir "Enter your web server's document root directory" $def
  DOCROOT=$DIR

} # get_docroot

#####################################################################
# get_cfdocs() - Do they want docuemntation installed
#
# Variables set: 
# 	DOCFDOCS - y or n
# 	DOEXAMPLES - y or n
#
#####################################################################
get_cfdocs()
{
  # do they want the documentation installed?
  if [ ! -z "$DOCFDOCS" ]; then
	def=$DOCFDOCS
  else
	  def=y
  fi

  echo ""
  ask_yorn "Do you want the ColdFusion documentation (HTML files) 
installed?" $def
  echo ""
  DOCFDOCS=$YORN

  if [ "$DOCFDOCS" != "y" ]; then
	DOEXAMPLES=n
  else
    # do they want the examples installed?
    if [ ! -z "$DOEXAMPLES" ]; then
	def=$DOEXAMPLES
    else
	  def=n
    fi

    echo "It is not recommended that the ColdFusion example applications 
be installed"
    echo "on a production server due to potential security concerns."
    echo ""
    ask_yorn "Do you want the ColdFusion example applications installed?" 
$def
    echo ""
    DOEXAMPLES=$YORN
  fi

} # get_cfdocs

#####################################################################
# get_adminpw() - Get admin passwords
#
# Variables set: 
# 	ADMIN_PASSWORD - password for CF admin
# 	RDS_PASSWORD - password for CF RDS
#
#####################################################################
get_adminpw()
{
  # prompt for the admin passwords if not an update
  if [ "$UPDATE" != "y" ]; then
  	echo ""
  	echo "The ColdFusion Administrator requires a password to protect 
against"
  	echo "unauthorized access to the ColdFusion configuration."
  	echo ""
  	ask_password
  	ADMIN_PASSWORD="${PASSWORD}"
  	echo ""
  	echo "The ColdFusion Rapid Development System requires a password 
to protect "
  	echo "against unauthorized client access using ColdFusion Studio."
  	echo ""
  	ask_password
  	RDS_PASSWORD="${PASSWORD}"
  fi
} # get_adminpw

#####################################################################
# get_cfuser() - Get ColdFusion userid
#
# Variables set: 
# 	CFOWNER - valid userid
#
#####################################################################
get_cfuser()
{
  echo ""
  echo "Please enter the user name of the account under which you would"
  echo "like ColdFusion to run. This must be a valid, existing user"
  echo "account.  Is is a good idea to create an account specifically"
  echo "for ColdFusion."
  echo ""
  echo "It is not recommended the ColdFusion server run as root."
  echo ""
  if [ ! -z "$CFOWNER" ]; then
	  def=$CFOWNER
  else
	  def=nobody
  fi

  ask_user "Enter an existing login name" $def
  CFOWNER=$THEUSER

} # get_cfuser

#####################################################################
# get_cluster() - Prompt for BrightTiger cluster server
#
# Variables set: 
#     INSTDIR - The install directory for 'btcats'
#     DOCLUSTER - y or n should we invoke the cluster_install script
#
#####################################################################
get_cluster()
{
	if [ ! -x ./cluster_install ]; then
		DOCLUSTER=n
		return
	fi

	if [ ! -z "$DOCLUSTER" ]; then
		def=$DOCLUSTER
	else
		def=y
	fi
	echo ""
	echo "ClusterCATS for ColdFusion is software which will allow you 
to"
	echo "configure multiple server machines in to a cluster for load"
	echo "balancing and high-availability."
	echo ""
	ask_yorn "Do you want to install ClusterCATS for ColdFusion" $def
	DOCLUSTER=$YORN

	# export INSTDIR for cluster_install script
	if [ "$DOCLUSTER" = "y" ]; then
		export INSTDIR=$INSTALLDIR/coldfusion
	fi
} # get_cluster

#####################################################################
# do_preserve() - Save existing files
#
#####################################################################
do_preserve()
{
	start=${INSTALLDIR}/coldfusion/bin/start
	odbc=${INSTALLDIR}/coldfusion/odbc/odbc.ini

	if [ -d ${INSTALLDIR}/coldfusion -a \
		 -d ${INSTALLDIR}/coldfusion/bin -a \
		 -d ${INSTALLDIR}/coldfusion/registry ]; then

		echo ""
		echo "Preserving user-modified files from the existing 
installation..."

		# Save existing files
		if [ -f $start ]; then
			rm -f $start.SAVE
			cp -p $start $start.SAVE
		fi

		if [ -f $odbc ]; then
			rm -f $odbc.SAVE
			cp -p $odbc $odbc.SAVE
		fi
	fi

} # do_preserve

#####################################################################
# do_untar() - Copies files from the tar file
#
# Variables:
#  CFHOME - set to $INSTALLDIR/coldfusion
#####################################################################
do_untar()
{
	echo ""
	echo -n "Copying files"
	here=`pwd`
	oldum=`umask`
	umask 0

	# Main CF files into INSTALLDIR.
	cd ${INSTALLDIR}
	tar xpf $here/data.tar coldfusion
	echo -n "."

	chown -R root:bin ${INSTALLDIR}/coldfusion
	echo -n "."

	# Admin files into webserver's doc root.
	# Stored in tar file under cfadmin
	cd ${DOCROOT}
	tar xpf $here/data.tar cfadmin
	echo -n "."
	if [ -d ${DOCROOT}/CFIDE ]; then
		rm -rf CFIDE
	fi
	mv cfadmin/CFIDE .
	rmdir cfadmin
	echo -n "."

	# Change ownership of admin files
	chown -R root:bin ./CFIDE
	echo -n "."

	if [ "$DOCFDOCS" = "y" ]; then
		# CF doc files into webserver's doc root.
		tar xpf $here/data.tar cfdocs
		echo -n "."

		# set ownership
		chown -R root:bin ./cfdocs
		echo -n "."
	fi

	if [ "$DOEXAMPLES" = "y" ]; then
		# CF example files 
		if [ ! -d ./cfdocs ]; then
			mkdir -m 755 ./cfdocs
		fi
		cd ./cfdocs
		tar xpf $here/data.tar exampleapps snippets
		echo -n "."

		# set ownership
		chown -R root:bin ./exampleapps ./snippets
		echo -n "."
		cd ..
	fi

	echo ""
	cd $here
	umask $oldum
	CFHOME=${INSTALLDIR}/coldfusion
} # do_untar

#####################################################################
# do_perms() - Set up all permissions
#
#####################################################################
do_perms()
{
	# change owner on things the servers need to write
	chown -R $CFOWNER:bin $CFHOME/log
	if [ -f $CFHOME/log/webserver.log ]; then
		rm $CFHOME/log/webserver.log
	fi
	# Both cfserver and the webserver need to write this file
	touch $CFHOME/log/webserver.log
	chmod 666 $CFHOME/log/webserver.log

	chown -R $CFOWNER:bin $CFHOME/mail
	chown $CFOWNER:bin $CFHOME/odbc/odbc.ini
	chown -R $CFOWNER:bin $CFHOME/registry
	chmod 600 $CFHOME/registry/cf.registry.template

	# database directories
	chown -R $CFOWNER:bin $CFHOME/database

	# if/when we get verity
	if [ ! -d $CFHOME/verity/collections ]; then
		mkdir -p $CFHOME/verity/collections
	fi
	chown $CFOWNER:bin $CFHOME/verity/collections

	# create Studio directory for queries
	if [ ! -d $CFHOME/StudioQueries ]; then
		mkdir -m 755  $CFHOME/StudioQueries
	fi
	chown $CFOWNER:bin $CFHOME/StudioQueries

} # do_perms

#####################################################################
# do_symlinks() - Create ColdFusion symbolic links
#
#####################################################################
do_symlinks()
{

	# /opt/coldfusion 
	if [ -h /opt/coldfusion ]; then
    	# remove existing sym-link
		rm -f /opt/coldfusion
	fi
	if [ ! -d /opt ]; then
		mkdir /opt
	fi
	if [ ! -d /opt/coldfusion -a "$CFHOME" != "/opt/coldfusion" ]; then
		ln -s $CFHOME /opt/coldfusion > /dev/null 2>&1
	elif [ "$CFHOME" != "/opt/coldfusion" ]; then
		echo "WARNING: You already have a directory 
named /opt/coldfusion."
		echo "WARNING: ColdFusion may have trouble finding its 
files."
	fi

	# /usr/lib/coldfusion
	rm -f /usr/lib/coldfusion
	ln -s $CFHOME/lib /usr/lib/coldfusion
	if [ $? -ne 0 ]; then
		echo "ERROR: Unable to create symbol 
link: /usr/lib/coldfusion -> $CFHOME/lib"
		echo "ERROR: ColdFusion will be unable to run"
		echo "ERROR: Aborting installation"
		exit 1
	fi

	# Create convenience CFIDE synonym link.
	if [ -h ${DOCROOT}/cfide -o ! -d ${DOCROOT}/cfide ]; then
		rm -f ${DOCROOT}/cfide
    	ln -s ./CFIDE ${DOCROOT}/cfide
	else
		echo "WARNING: Unable to create symlink ${DOCROOT}/cfide."
	fi

} # do_symlinks

#####################################################################
# do_savesettings() - Save configuration settings
#
#####################################################################
do_savesettings()
{
	datafile=${INSTALLDIR}/coldfusion/registry/.cfinstall.dat
	if [ -f $datafile ]; then
		mv $datafile $datafile.bak
	fi

	echo "INSTALLDIR=${INSTALLDIR}" > $datafile
	echo "REGID=${REGID}" >> $datafile
	echo "WEBSERVER=${WEBSERVER}" >> $datafile
	echo "DOPLUGIN=${DOPLUGIN}" >> $datafile
	echo "NETSCAPEDIR=${NETSCAPEDIR}" >> $datafile
	echo "NETSCAPECONFIG=${NETSCAPECONFIG}" >> $datafile
	echo "NETSCAPEVERSION=${NETSCAPEVERSION}" >> $datafile
	echo "APACHEDIR=${APACHEDIR}" >> $datafile
	echo "CGIDIR=${CGIDIR}" >> $datafile
	echo "DOCROOT=${DOCROOT}" >> $datafile
	echo "CFOWNER=${CFOWNER}" >> $datafile
	echo "DOCFDOCS=${DOCFDOCS}" >> $datafile
	echo "DOEXAMPLES=${DOEXAMPLES}" >> $datafile
	echo "DOCLUSTER=${DOCLUSTER}" >> $datafile

} # do_savesettings


#####################################################################
# do_uninstall() - Set up the uninstall links
#
#####################################################################
do_uninstall()
{
	echo "Setting up uninstall links..."

	uninstall=${INSTALLDIR}/coldfusion/uninstall

	# Create uninstall directory
	rm -rf  $uninstall
	mkdir -m 0755 $uninstall
	cp ./cfremove $uninstall/cfremove
	mkdir -m 0755 $uninstall/private

	# link to installdir
	ln -s ${INSTALLDIR} $uninstall/private/basecfhome

	# link to docroot
	ln -s  ${DOCROOT} $uninstall/private/webdocroot

	# link webserver directory
	if [ "${WEBSERVER}" = "netscape" ]; then
    	ln -s  ${NETSCAPEDIR} $uninstall/private/webserverroot
	fi 

	if [ "${WEBSERVER}" = "apache" ]; then
    	ln -s  ${APACHEDIR} $uninstall/private/webserverroot
	fi 

} # do_uninstall

#####################################################################
# do_regconfig() - Set ups the ColdFusion registry
#
#####################################################################
do_regconfig()
{
	echo "Initializing ColdFusion Settings..."

	$CFHOME/bin/cfexec -install $CFHOME -password "$ADMIN_PASSWORD" -
rdspassword "$RDS_PASSWORD" -docroot $DOCROOT -register "$REGID" -user 
$CFOWNER
	if [ $? -ne 0 ]; then
		echo "ERROR: Unable to initialize the Cold Fusion 
settings."
		echo "ERROR: Aborting installation."
		exit 1
	fi

	# Make sure CFUSER owns registry files
	chown $CFOWNER:bin $CFHOME/registry/cf.registry 
$CFHOME/registry/cf.registry.template
	chmod 600 $CFHOME/registry/cf.registry 
$CFHOME/registry/cf.registry.template

} # do_regconfig

#####################################################################
# do_scripts() - Create start/stop etc. scripts
#
#####################################################################
do_scripts()
{
	echo "Customizing ColdFusion startup scripts..."

	TOKENSCRIPT="-e s+@CFHOME@+$CFHOME+"
	HOMESCRIPT="-e s+^CFHOME=.*$+CFHOME=$CFHOME+"
	SCRIPTFILES="bin/start bin/stop bin/coldfusion odbc/odbc.ini"

	for file in $SCRIPTFILES
	do
		sed $HOMESCRIPT $TOKENSCRIPT $CFHOME/$file 
>  /tmp/cfscript.$$
		cp -f /tmp/cfscript.$$ $CFHOME/$file
		chmod 755 $CFHOME/$file
	done
	rm -f /tmp/cfscript.$$

	# Copy old scripts back in place
	if [ -f $CFHOME/bin/start.SAVE ]; then
		echo -e "\tRestoring saved start script"

		# Grab everything above @SPECIAL_TOKEN@ from old script
		# make sure we update CFHOME and CFUSER to the current 
values
		sed -e '/@SPECIAL_TOKEN@/,$d' $HOMESCRIPT 
$CFHOME/bin/start.SAVE > /tmp/cfstart.$$

		# Then grab everything below @SPECIAL_TOKEN@ from the new 
start script
		sed -n -e '/@SPECIAL_TOKEN@/,$p' $CFHOME/bin/start 
>> /tmp/cfstart.$$

		# move the new file in place
		cp -f /tmp/cfstart.$$ $CFHOME/bin/start
		rm -f /tmp/cfstart.$$

		chmod 755 $CFHOME/bin/start
	fi

	if [ -f $CFHOME/odbc/odbc.ini.SAVE ]; then
		echo -e "\tRestoring saved odbc.ini"

		cp -f $CFHOME/odbc/odbc.ini.SAVE $CFHOME/odbc/odbc.ini
		rm -f $CFHOME/odbc/odbc.ini.SAVE
	fi

	# Make sure odbc.ini has the correct permissions
	chown $CFOWNER:bin $CFHOME/odbc/odbc.ini
	chmod 644 $CFHOME/odbc/odbc.ini

	# Move system startup script to init.d directory
	RCDIR=/etc/rc.d/
	INITDIR=/etc/rc.d/init.d
	if [ -d $INITDIR ]; then
		mv $CFHOME/bin/coldfusion $INITDIR
		chmod 555 $INITDIR/coldfusion
		chown bin:bin $INITDIR/coldfusion

		if [ -d $RCDIR/rc3.d ]; then
			rm -f $RCDIR/rc3.d/S90coldfusion
			ln -s ../init.d/coldfusion 
$RCDIR/rc3.d/S90coldfusion
		fi
		if [ -d $RCDIR/rc1.d ]; then
			rm -f $RCDIR/rc1.d/K19coldfusion
			ln -s ../init.d/coldfusion 
$RCDIR/rc1.d/K19coldfusion
		fi
	else
		echo "WARNING: Unable to find $INITDIR, you will have to 
configure ColdFusion to"
		echo "WARNING: run at system startup using your local 
Linux startup scripts."
	fi

} # do_scripts


#####################################################################
# config_netscape() - Configure Netscape webserver
#
# This function edits mime.types and obj.conf
# in the netscape server config directory.
#####################################################################

config_netscape()
{
	# check for enterprise/fasttrack first
	config=$NETSCAPECONFIG

	# Add mime type
	if [ -w $config/mime.types ]; then

		# Don't write it if it already exists
		grep -qi "type=magnus-internal/cold-fusion" 
$config/mime.types

		if [ $? -ne 0 ]; then
			cat >> $config/mime.types <<EOF
type=magnus-internal/cold-fusion exts=cfm,dbm
EOF
		fi
	else
		echo "ERROR: Unable to write to file $config/mime.types."
		echo "ERROR: Aborting installation"
		exit 1
	fi

	# Add new Service and Init lines
	if [ -w $config/obj.conf ]; then
		# Remove any existing entries
		grep -vi "DoCFRequest" $config/obj.conf > /tmp/cfobj.$$
		awk -v netscapedir=$NETSCAPEDIR '
				BEGIN {
					initwritten = 0
					initline = "Init fn=\"load-
modules\" shlib=\"%s/plugins/coldfusion/coldfusion.so\" 
funcs=\"DoCFRequest\""
					servline = "Service 
fn=\"DoCFRequest\" method=\"(GET|POST)\" type=\"magnus-internal/cold-
fusion\""
				}
				{
					line=tolower($0)
					if ( ! initwritten && match
(line, "init fn") != 0) {
							print $0
							printf initline, 
netscapedir
							printf "\n"
							initwritten = 1
					} else if (match(line, "<object
[[:space:]]*name") != 0) {
						if (index
(line, "default") != 0) {
							print $0
							print servline
						} else {
							print $0
						}
					} else {
						print $0
					}
				}' /tmp/cfobj.$$ > /tmp/cfinstall.$$
		rm -f /tmp/cfobj.$$
		# Check to make sure script worked
		grep -qi "DoCFRequest" /tmp/cfinstall.$$
		if [ $? -ne 0 ]; then
			echo "ERROR: Unable to write to file 
$config/obj.conf."
			echo "ERROR: Aborting installation"
			exit 1
		else
			cp /tmp/cfinstall.$$ $config/obj.conf
		fi
		rm -f /tmp/cfinstall.$$
	else
		echo "ERROR: Unable to write to file $config/obj.conf."
		echo "ERROR: Aborting installation"
		exit 1
	fi

	# Restart server so setting will take affect
	nstatus=0
	if [ -x $config/../stop -a -f $config/../logs/pid ]; then
		echo "Stopping Netscape web server."
		$config/../stop
		nstatus=$?
	fi

	if [ $nstatus -eq 0 -a -x $config/../start  ]; then
		echo "Starting Netscape web server."
		$config/../start
	else
		echo "ERROR: Unable to start Netscape web server - You 
must restart manually."
	fi
}




#####################################################################
# config_apache() - Configure Apache webserver
#
#####################################################################
config_apache()
{
	if [ ! -w $APACHEDIR/libexec ]; then
		echo "ERROR: Unable to write module directory: 
$APACHEDIR/libexec"
		echo "ERROR: Aborting installation."
		exit 1
	fi

	echo "Configuring the ColdFusion Apache Module"

	origdir=`pwd`
	cd $CFHOME/webserver/apache/src

	# we need to have the C compiler on our path, give it our best shot
	PATH=/usr/ccs/bin:$APACHEDIR/bin:/usr/local/bin:$PATH
	export PATH

	type apxs > /dev/null 2>&1
	if [ $? -ne 0 ]; then
		echo "ERROR: Unable to execute: apxs"
		echo "ERROR: Aborting installation."
		exit 1
	fi

	# Run the module makefile which will compile and install module
	make install
	if [ $? -eq 0 ]; then
		# restart Apache
		if [ -x $APACHEDIR/bin/apachectl ]; then
			echo "Restarting Apache web server"
			$APACHEDIR/bin/apachectl graceful
		else
			echo "WARNING: You must restart your Apache web 
server manually."
		fi
	else
		echo "ERROR: Unable to build/install Apache 1.3 module"
		echo "ERROR: I may be unable to find your C compiler"
		echo "ERROR: Please readthe file:"
		echo -e "ERROR:\t$CFHOME/webserver/apache/README"
		echo "ERROR: for instructions on how to configure your 
Apache web server"
	fi

	cd $origdir
}


#####################################################################
# config_redhat() - Configure Apache on Red Hat Linux
#
# We have to do different stuff since 'apache-devel' might not be installed
# (so no rebuild) and apxs, which is in apache-devel, is broken and
# doesn't put the right path in httpd.conf (See RH bug #4181)
#####################################################################
config_redhat()
{
	echo "Configuring the ColdFusion Apache Module"

	origdir=`pwd`
	cd $CFHOME/webserver/apache/src

	# we need to have the C compiler on our path, give it our best shot
	PATH=/usr/ccs/bin:$APACHEDIR/bin:/usr/local/bin:$PATH
	export PATH

	# Run the module makefile which will compile and install module
	if [ $rebuild = y ]; then
		cd $CFHOME/webserver/apache/src

		make

		# Use the local apxs since the Red Hat one is broken
		./apxs.redhat -i -a -n 'coldfusion' mod_coldfusion.so
	else
		$CFHOME/webserver/apache/src/apxs.redhat -i -a -
n 'coldfusion' $CFHOME/webserver/apache/mod_coldfusion.so
	fi

	echo "Restarting Apache..."
	/etc/rc.d/init.d/httpd restart

	cd $origdir

} # config_redhat


#####################################################################
# do_configplugin() - Configure webserver plugin
#
#####################################################################
do_configplugin()
{
if [ "$WEBSERVER" = "netscape" ]; then
  if [ "$DOPLUGIN" = "y" ]; then
	echo "Setting up Netscape NSAPI plugin..."

	if [ ! -d $NETSCAPEDIR/plugins/coldfusion ]; then
		mkdir -p $NETSCAPEDIR/plugins/coldfusion || {
			echo "ERROR: Unable to create plugin directory: 
$NETSCAPEDIR/plugins/coldfusion"
			echo "ERROR: Aborting installation."
			exit 1
		}
	fi
	if [ "$NETSCAPEVERSION" = "2" ]; then
		ver="2x"
	elif [ "$NETSCAPEVERSION" = "3" ]; then
		ver="3x"
	else
		ver="35"
	fi

	# We name all versions coldfusion.so
	cp -f $CFHOME/webserver/nsapi/coldfusion${ver}.so \
		  $NETSCAPEDIR/plugins/coldfusion/coldfusion.so || {
		echo "ERROR: Unable to copy NSAPI plugin to 
$NETSCAPEDIR/plugins/coldfusion"
		echo "ERROR: Aborting installation."
		exit 1
	}

	if [ "$DOPLUGIN" = "y" ]; then
		config_netscape
	fi

	echo "Netscape configuration complete."
  fi
  if [ "$DOPLUGIN" = "n" ]; then
	echo "Please read the file:"
	echo -e "\t$CFHOME/webserver/nsapi/README"
	echo "for instructions on how to configure your Netscape web 
server."
  fi

elif [ "$WEBSERVER" = "apache" ]; then

	if [ "$DOPLUGIN" = "y" ]; then
		if [ "$redhat" = "y" ]; then
			config_redhat
		else
			config_apache
		fi
	else
		echo ""
		echo "Please read the file:"
		echo -e "\t$CFHOME/webserver/apache/README"
		echo "for instructions on how to configure your Apache web 
server."
	fi

else
	echo "Installing CGI stub..."
	cp -f $CFHOME/webserver/cgi/cfml $CGIDIR || {
		echo "ERROR: Unable to copy CGI stub."
		echo "ERROR: Aborting installation."
		exit 1
	}
fi

} # do_configplugin


#####################################################################
# do_datasources() - Configure PostgreSQL sample datasources
#
#####################################################################
do_datasources()
{
	# configure the datasources in odbc.ini
	echo "Configuring odbc.ini with sample data sources"
	$CFHOME/odbc/config_odbcini $CFHOME
	if [ $? -ne 0 ]; then
		echo "WARNING: Unable to configure odbc.ini with sample 
data sources."
	fi

} # do_datassources


#####################################################################
# do_startcf() - Start up ColdFusion servers
#
#####################################################################
do_startcf()
{
	echo "Starting ColdFusion servers..."

	# start ColdFusion
	$CFHOME/bin/start
	if [ $? -ne 0 ]; then
		echo "ERROR: Start script did not return success"
		echo "ERROR: ColdFusion servers NOT running."
		exit 1
	fi

} # do_startcf

#####################################################################
# do_cluster() - Run the ClusterCATS install script
#
# NOTE: This function does not return (it does an exec)
#####################################################################
do_cluster()
{
	BTCATS=/usr/lib/btcats
	if [ "$DOCLUSTER" != "y" ]; then
		return
	fi

	if [ -x ./cluster_install ]; then
		#create /usr/lib/btcats symlink
		rm -f $BTCATS
		ln -s ${CFHOME}/btcats $BTCATS

		echo "Running the ClusterCATS for ColdFusion installation 
script"
		echo ""
		exec ./cluster_install
	fi

} # do_cluster

####################################################################
# do_verity() - Setup the Verity gateway file
#
####################################################################
do_verity()
{
    echo "Installing Verity DB gateway file..."

    cat > $CFHOME/verity/common/style/custom/style.vgw << EOF
#
# Cold Fusion DB Gateway style.vgw
#
\$control: 1
gateway:
{
        DDA: "DLL:$CFHOME/lib/libcfindex.so:GetInterface"
}
EOF

    chmod 444 $CFHOME/verity/common/style/custom/style.vgw
    chown $CFOWNER:bin $CFHOME/verity/common/style/custom/style.vgw

} # do_verity


#####################################################################
# Main
#####################################################################

# Validate Environment
check_env

# print welcome
echo ""
echo "*******************************************************************"
echo "*   Welcome to the ColdFusion $CFVERSION Installation for 
Linux      "
echo "*"
echo "*                Thank you for choosing ColdFusion!                "
echo "*******************************************************************"
echo ""

# Request the registration id
get_regid

# Get the install path
get_installdir

# Select webserver
get_webserver

# Get Dcoument root
get_docroot

# Do they want documentation?
get_cfdocs

# Get admin passwords
get_adminpw

# Get the ColdFusion user
get_cfuser

# Ask about ClusterCATS
get_cluster

# Give the user a chance to bail out
echo -en "\n\nReady to begin the installation.  Press ENTER to 
continue..\c"
read line

# Preserve previous config
do_preserve

# Copy files
do_untar

# Set permissions
do_perms

# Create symbolic links
do_symlinks

# Set up verity gateway file
do_verity

# Set up uninstall
do_uninstall

# Configure the registry
do_regconfig

# Set up startup scripts
do_scripts

# Configure webserver plugin
do_configplugin

# Set up datasources
do_datasources

# Save installation settings
do_savesettings

# Start ColdFusion
do_startcf


echo ""
echo "ColdFusion installation completed successfully."
echo ""
echo "The ColdFusion Application Server is now running!"
echo ""

# Run the ClusterCATS install script
do_cluster

exit 0
Comment 1 Jakub Jelinek 2001-01-12 08:01:43 EST
You don't have to grab anything from older Red Hat Linux releases, just make
sure compat-libstdc++ package (which contains standard C++ libraries for
earlier versions of the compiler such as g++ 2.7.2 or egcs 1.1.2).
Server/Web Server just contains a typical set of packages used for Web servers,
and typically that does not include compat-libstdc++ (as opposed to e.g.
libstdc++).

Note You need to log in before you can comment on or make changes to this bug.