# Copyright 1999-2004 Gentoo Foundation # Distributed under the terms of the GNU General Public License v2 # TODO for -r1: make coldfusion scipts more robust (handle SYSTEM VM changes and location changes) inherit eutils DESCRIPTION="Macromedia Coldfusion MX, version ${PV}" HOMEPAGE="http://www.macromedia.com/coldfusion" LICENSE="macromedia-eula-coldfusionmx" KEYWORDS="x86 ~ppc ~amd64" RESTRICT="fetch nostrip" COLDFUSION="coldfusion-macr-linux.bin" VERITY_EUR="verity_linux_eur.tar" UPDATER="cfmx_61update_linux.bin" HOTFIX1="hf55681_61.zip" HOTFIX2="navserver_611.zip" HOTFIX3="hf56991_611.zip" SRC_URI="${COLDFUSION} ${UPDATER} ${HOTFIX1} ${HOTFIX2} ${HOTFIX3}" DEPEND=">=virtual/jre-1.4.2 sys-apps/sed app-arch/unzip >=net-www/apache-1.3.26-r2 apache2? ( >=net-www/apache-2.0.48 )" RDEPEND="x86? ( sys-libs/lib-compat )" PROVIDE="www-servers/macromedia-coldfusion" detectapache() { local domsg= [ -n "$1" ] && domsg=1 HAVE_APACHE1= HAVE_APACHE2= has_version '=net-www/apache-1*' && HAVE_APACHE1=1 has_version '=net-www/apache-2*' && HAVE_APACHE2=1 [ -n "${HAVE_APACHE1}" ] && APACHEVER=1 [ -n "${HAVE_APACHE2}" ] && APACHEVER=2 [ -n "${HAVE_APACHE1}" ] && [ -n "${HAVE_APACHE2}" ] && APACHEVER='both' case "${APACHEVER}" in 1) [ -n "${domsg}" ] && einfo 'Apache1 only detected' ;; 2) [ -n "${domsg}" ] && einfo 'Apache2 only detected';; both) if use apache2; then [ -n "${domsg}" ] && einfo "Multiple Apache versions detected, using Apache2 (USE=apache2)" APACHEVER=2 else [ -n "${domsg}" ] && einfo 'Multiple Apache versions detected, using Apache1 (USE=-apache2)' APACHEVER=1 fi ;; *) if [ -n "${domsg}" ]; then MSG="Unknown Apache version!"; eerror $MSG ; die $MSG else APACHEVER=0 fi; ;; esac } detectapache SLOT="${APACHEVER}" [ "${APACHEVER}" -eq '2' ] && USE_APACHE2='2' || USE_APACHE2='' pkg_nofetch() { einfo "Please download ${S} from http://www.macromedia.com/coldfusion and select the linux install" } src_unpack() { detectapache domsg if [ ! -r ${DISTDIR}/${COLDFUSION} ]; then die "cannot read ${COLDFUSION}. Please check the permissions and try again" fi einfo "Setting installation config in ${FILESDIR}/installation.properties" cp ${FILESDIR}/installation.properties ${WORKDIR} cp ${FILESDIR}/coldfusionmx.conf ${WORKDIR} echo "JAVA_DOT_HOME=${JAVA_HOME}/jre" >> ${WORKDIR}/installation.properties echo "JAVA_EXECUTABLE=${JAVA_HOME}/jre/bin/java" >> ${WORKDIR}/installation.properties echo "JAVA_HOME=${JAVA_HOME}" >> ${WORKDIR}/installation.properties echo "SILENT_INSTALL_FOLDER=${WORKDIR}/coldfusionmx" >> ${WORKDIR}/installation.properties # for the updater echo "INSTALLER_UI=silent" >> ${WORKDIR}/updater.properties echo "USER_INSTALL_DIR=${WORKDIR}/coldfusionmx" >> ${WORKDIR}/updater.properties # silent updating doesn't seem to work # echo "USER_MAGIC_FOLDER_3_1=/var/www/html/CFIDE" >> ${WORKDIR}/updater.properties if [ "${COLDFUSION_SERIAL_NUMBER}" != "" ]; then einfo "Setting serial number to: ${COLDFUSION_SERIAL_NUMBER}" sed -i "s:SILENT_SERIAL_NUMBER=developer:SILENT_SERIAL_NUMBER=${COLDFUSION_SERIAL_NUMBER}:" ${WORKDIR}/installation.properties fi einfo "This could take a while" addwrite /var/.com.zerog.registry.xml addwrite /var/.com.zerog.registry.lock sh ${DISTDIR}/${COLDFUSION} -f ${WORKDIR}/installation.properties addpredict /root einfo "Applying update" ewarn "Please do not provide any keyboard input, the updater cannot be run silently" # updater fails sometimes with no apparant reason when run in unattended mode epause 3 cd ${WORKDIR}/coldfusionmx sh ${DISTDIR}/${UPDATER} -f ${WORKDIR}/updater.properties < ${FILESDIR}/input-updater # silent install does not seem to function if [ ! -r ${DISTDIR}/${VERITY_EUR} ]; then einfo "${DISTDIR}/${VERITY_EUR} unavailable: Not installing verity eur language pack." einfo "If you are a using a registered version you can download the pack" einfo "at http://www.macromedia.com/support/coldfusion/verity_reg/register/index.cgi?lang=English" einfo "then place it in ${DISTDIR} and re-emerge this package" else einfo "Installing verity eur language pack" cd ${WORKDIR}/coldfusionmx tar xvf ${DISTDIR}/${VERITY_EUR} fi # unzip hotfixes cd ${WORKDIR} unzip ${DISTDIR}/${HOTFIX1} unzip ${DISTDIR}/${HOTFIX2} unzip ${DISTDIR}/${HOTFIX3} } src_compile() { # create sun-util-sec.jar see http://www.macromedia.com/support/flex/ts/documents/ibm_jdk.htm einfo "Creating sun-sec-util.jar" cd ${WORKDIR} unzip coldfusionmx/runtime/jre/lib/rt.jar sun/security/util/* jar -cf sun-sec-util.jar sun rm -rf sun cp sun-sec-util.jar ${WORKDIR}/coldfusionmx/runtime/lib cd ${WORKDIR}/coldfusionmx # create the apache connector einfo "Creating apache${APACHEVER} connector" cd ${WORKDIR} unzip coldfusionmx/runtime/lib/wsconfig.jar connectors/src/ApacheModule.zip cd connectors/src unzip ApacheModule.zip chmod 777 * if [ "${APACHEVER}" -eq '2' ]; then apxs2 -c -Wc,-w -n jrun20 mod_jrun20.c jrun_maptable_impl.c jrun_property.c \ jrun_session.c platform.c \ jrun_mutex.c jrun_proxy.c jrun_ssl.c jrun_utils.c strip .libs/mod_jrun20.so else apxs -c -Wc,-w -DJRUN_SSL mod_jrun.c jrun_maptable_impl.c \ jrun_property.c jrun_session.c \ platform.c jrun_mutex.c jrun_proxy.c jrun_ssl.c jrun_utils.c strip .libs/mod_jrun.so fi } src_install() { cd ${WORKDIR}/coldfusionmx dodir /opt/coldfusionmx into /opt/coldfusionmx # patch coldfusion start einfo "Patching start up script" sed -i "s:^CF_DIR=\"${WORKDIR}:CF_DIR=\"/opt:" bin/coldfusion sed -i "s:-s /bin/sh::" bin/coldfusion epatch ${FILESDIR}/startstop.patch # patch cfinfo einfo "Patching cfinfo" sed -i "s:${WORKDIR}:/opt:" bin/cfinfo sed -i "s:${WORKDIR}:/opt:" bin/cfcompile.sh # patch jvm.config to use the system vm einfo "Patching jvm.config" sed -i "s:^java.home=${WORKDIR}/coldfusionmx/runtime/jre:java.home=${JAVA_HOME}:" runtime/bin/jvm.config sed -i "s:lib$:lib,{application.home}/runtime/lib/sun-sec-util.jar:" runtime/bin/jvm.config sed -i "s:/servers/:/runtime/servers/:" runtime/bin/jvm.config # see http://jakarta.apache.org/tomcat/tomcat-5.0-doc/class-loader-howto.html # see http://www.macromedia.com/cfusion/webforums/forum/messageview.cfm?catid=274&threadid=819702 sed -i "s:args=-server:args=-server -Djava.endorsed.dirs={application.home}/endorsed:" runtime/bin/jvm.config insinto /opt/coldfusionmx/endorsed doins lib/crimson.jar # patch web.xml einfo "Patching jrun-web.xml" sed -i "s:${WORKDIR}:/opt:" wwwroot/WEB-INF/jrun-web.xml einfo "Activating proxy in jrun-web.xml" epatch ${FILESDIR}/jrun-xml.patch insinto /opt/coldfusionmx/runtime/lib/wsconfig doins ${FILESDIR}/wsconfig.properties insinto /opt/coldfusionmx/runtime/lib/wsconfig/1 doins ${FILESDIR}/jrunserver.store # install apache connector insinto /usr/lib/apache${USE_APACHE2}/modules if [ "${APACHEVER}" -eq '2' ]; then doins ${WORKDIR}/connectors/src/.libs/mod_jrun20.so sed -i "s:/usr/lib:/usr/lib/apache2/modules/mod_jrun20.so:" ${WORKDIR}/coldfusionmx.conf else doins ${WORKDIR}/connectors/src/.libs/mod_jrun.so sed -i "s:/usr/lib:/usr/lib/apache/modules/mod_jrun.so:" ${WORKDIR}/coldfusionmx.conf sed -i "s:run20:run:" ${WORKDIR}/coldfusionmx.conf fi insinto /etc/apache${USE_APACHE2}/conf/modules.d doins ${WORKDIR}/coldfusionmx.conf # install files insinto /opt/coldfusionmx/bin dobin bin/cfinfo # needs patching dobin bin/coldfusion # needs patching dobin bin/cfcompile.sh dobin bin/cfencode.linux dobin bin/cfusion insinto /opt/coldfusionmx/lib doins -r lib/* # rm the jre? # rm -rf runtime/jre insinto /opt/coldfusionmx/runtime doins -r runtime/* insinto /opt/coldfusionmx/charting doins -r charting/* insinto /opt/coldfusionmx/wwwroot doins -r wwwroot/* insinto /opt/coldfusionmx/META-INF doins -r META-INF/* insinto /opt/coldfusionmx/charting doins -r charting/* insinto /opt/coldfusionmx/registry doins -r registry/* dodir /opt/coldfusionmx/cache dosym /var/log/coldfusionmx /opt/coldfusionmx/logs dosym /var/cache/coldfusionmx/verity /opt/coldfusionmx/verity/collections dosym /var/cache/coldfusionmx/charting /opt/coldfusionmx/charting dosym /var/spool/coldfusionmx/mail /opt/coldfusionmx/Mail dosym /var/log/coldfusionmx /opt/coldfusionmx/runtime/logs dosym /opt/coldfusionmx/runtime/bin/jvm.config /opt/coldfusionmx/bin/jvm.config exeinto /etc/init.d doexe bin/coldfusion # log dirs and verity collections dodir /var/log/coldfusion dodir /var/log/jrun dodir /var/cache/coldfusionmx/verity dodir /var/cache/coldfusionmx/charting/cache dodir /var/spool/coldfusionmx/mail dodir /var/log/coldfusionmx # install hotfixes cd ${WORKDIR} insinto /opt/coldfusionmx/wwwroot/CFIDE/Administrator doins navserver.cfm insinto /opt/coldfusionmx/runtime/servers/lib doins hf55681_61.jar doins hf56991_611.jar } pkg_postinst() { chown -R cfusion:cfusion /opt/coldfusionmx chown -R cfusion:cfusion /var/log/coldfusionmx chown -R cfusion:cfusion /var/cache/coldfusionmx chown -R cfusion:cfusion /var/spool/coldfusionmx rm -f /var/.com.zerog.registry.xml # do not keep zerog installer files around ewarn "Coldfusion is using the *CURRENT* SYSTEM VM" ewarn "If you want to change this after the installation check /opt/coldfusionmx/runtime/bin/jvm.config" ewarn "Some standard settings are not compatible with non-SUN vm's, please check the settings first" ewarn "Also note that the 1.4 IBM JDK seems to have issues with verity" einfo "If you would like to use coldfusion with JVM 1.5 (unsupported)" einfo "you probably need to add in the jvm.config:" einfo " -Djmx.invoke.getters=true" einfo "Note however that there are still issues with this (problems with CFCHART)" einfo "" ebeep 2 einfo "A new user has been added to the system: cfusion" einfo "A new group has been added to the system: cfusion" einfo "" einfo "The apache connector has been installed and the proxy service has been activated" einfo "If you are not interested in using this connector please remove it from the apache config (modules.d/coldfusionmx.conf)" einfo "and disable the proxy service by disabling it in /opt/coldfusionmx/runtime/servers/default/SERVER-INF/jrun.xml" einfo "" einfo "The coldfusion service will be started with dropped privileges" einfo "To finish the installation" einfo " /etc/init.d/coldfusion start" einfo " /etc/init.d/apache${HAS_APACHE2} restart" einfo "and go to http://localhost/CFIDE/administrator/index.cfm" einfo "The configuration can only be done from localhost! If you want to add hosts have a look at modules.d/coldfusionmx.conf" einfo "" ewarn "Please note that coldfusion opens ports and these might be potentially vurnerable to abuse" ewarn "You should change the admin password which is currently: 'admin'" } pkg_preinst() { einfo "Creating user/group for coldfusion: cfusion" enewgroup cfusion enewuser cfusion -1 /bin/sh /opt/coldfusionmx cfusion }