Skip site navigation (1)Skip section navigation (2)
Date:      Wed, 3 Oct 2001 09:45:43 +0200 (CEST)
From:      ernst@jollem.com
To:        FreeBSD-gnats-submit@freebsd.org
Cc:        java@freebsd.org, sobomax@freebsd.org, jeh@freebsd.org, ernst@jollem.com
Subject:   Maintainer update: www/orion 1.4.5_7
Message-ID:  <200110030745.f937jh308148@heinz.jollem.com>

next in thread | raw e-mail | index | archive | help

>Submitter-Id:	current-users
>Originator:	Ernst de Haan
>Organization:	Jollem Information Technology
>Confidential:	no
>Synopsis:	Maintainer update: www/orion 1.4.5_7
>Severity:	non-critical
>Priority:	medium
>Category:	ports
>Class:		maintainer-update
>Release:	FreeBSD 4.3-RELEASE i386
>Environment:
System: FreeBSD heinz.jollem.com 4.3-RELEASE FreeBSD 4.3-RELEASE #5: Mon May 14 16:08:56 CEST 2001 root@heinz.jollem.com:/usr/src/sys/compile/HEINZ i386
>Description:
Makes this port more advanced. Summary of changes:

   * Now uses the native JDK 1.3.1 by default (option: JAVA_HOME)
   * Now allows automatic configuration for use with Jikes. By default Orion
     is now configured to use Jikes (option: WITH_JIKES)
   * Now runs as a different user (options: USER_NAME, GROUP_NAME, USER_ID,
     GROUP_ID), this user and the corresponding group are created during
     installation and removed at deinstallation. The default name for both the
     user and for the group is 'orion'. The default ID for both is 7104.
   * Now allows one to configure the port the web server should listen at at
     installation time. The default changed from 80 to 8090, to avoid clashes
     with the default ports of other web server products, especially Apache
     (port 80) and Tomcat (8080 and 8007) (option: LISTEN_PORT)
   * Now allows that Orion is automatically started after installation
     (option: AUTO_START). By default it now is.
   * Now prints the installation settings at pre-install stage.

>How-To-Repeat:
N/A
>Fix:

diff -ruN --exclude=work --exclude=CVS --exclude=README.html /usr/ports/www/orion/Makefile /home/ernst/freebsd-ports/www/orion/Makefile
--- /usr/ports/www/orion/Makefile	Wed Jun 27 03:51:26 2001
+++ /home/ernst/freebsd-ports/www/orion/Makefile	Tue Oct  2 19:22:34 2001
@@ -7,7 +7,7 @@
 
 PORTNAME=	orion
 PORTVERSION=	1.4.5
-PORTREVISION=	6
+PORTREVISION=	7
 CATEGORIES=	www java
 MASTER_SITES=	ftp://ftp.sunet.se/pub/database/utils/orionserver/ \
 		${MASTER_SITE_LOCAL} \
@@ -18,7 +18,7 @@
 
 MAINTAINER=	ernst@jollem.com
 
-RUN_DEPENDS=	${JAVA_HOME}/bin/java:${PORTSDIR}/java/linux-jdk13
+RUN_DEPENDS=	${JAVA_HOME}/bin/java:${PORTSDIR}/java/jdk13
 
 USE_ZIP=	YES
 NO_BUILD=	YES
@@ -30,36 +30,104 @@
 ORIONCTL_NAME=	orionctl
 ORIONCTL_DEST=	${PREFIX}/bin/${ORIONCTL_NAME}
 RC_SCRIPT=	${PREFIX}/etc/rc.d/${PORTNAME}.sh
-JAVA_HOME?=	${LOCALBASE}/linux-jdk1.3.1
+JAVA_HOME?=	${LOCALBASE}/jdk1.3.1
+JIKES_LOCATION=	${LOCALBASE}/bin/jikes
+WITH_JIKES?=	YES
+.if ${WITH_JIKES} == "YES"
+RUN_DEPENDS+=	${JIKES_LOCATION}:${PORTSDIR}/java/jikes
+.endif
+USER_NAME?=	${PORTNAME}
+GROUP_NAME?=	${USER_NAME}
+USER_ID?=	7104
+GROUP_ID?=	${USER_ID}
+PW?=		/usr/sbin/pw
+LISTEN_PORT?=	8090
+AUTO_START?=	YES
 
 .include <bsd.port.pre.mk>
 
+pre-install:
+	@${ECHO} "Installation settings:"
+	@${ECHO} "   Destination directory:   ${ORION_HOME}"
+	@${ECHO} "   Control script location: ${ORIONCTL_DEST}"
+	@${ECHO} "   Startup script location: ${RC_SCRIPT}"
+	@${ECHO} "   Startup script location: ${RC_SCRIPT}"
+	@${ECHO} "   Location of JDK:         ${JAVA_HOME}"
+	@${ECHO} "   Using Jikes:             ${WITH_JIKES}"
+	@${ECHO} "   Running as (user/group): ${USER_NAME}/${GROUP_NAME} (${USER_ID}:${GROUP_ID})"
+	@${ECHO} "   Port to listen at:       ${LISTEN_PORT}"
+	@${ECHO} "   Starting after install:  ${AUTO_START}"
+
 do-install:
+	@# Add the group and the user if they do not exist
+	${PW} groupadd -n ${GROUP_NAME} -g ${GROUP_ID} || true
+	${PW} useradd -n ${USER_NAME} -u ${USER_ID} -g ${GROUP_NAME} -c "Orion Server account" -d ${ORION_HOME} -s ${SH} -h - || true
+
+	@# Create the destination directory for Orion
 	${MKDIR} ${ORION_HOME}
+
+	@# Copy all files and make them rwxr-xr-x
 	${CP} -R ${WRKSRC}/* ${ORION_HOME}
 	${CHMOD} 755 `find ${ORION_HOME} -type d`
+
+	@# Configure for use of Jikes, if necessary
+.if ${WITH_JIKES} == "YES"
+	${CAT} ${WRKSRC}/config/server.xml \
+	| ${SED} "/\<!-- \<compiler executable=\"jikes\" classpath=\"\/myjdkdir\/jre\/lib\/rt.jar\" \/\> -->/s//\<compiler executable=\"${JIKES_LOCATION:S/\//\\\//g}\" classpath=\"${JAVA_HOME:S/\//\\\//g}\/jre\/lib\/rt.jar\"\/\>/" \
+	> ${ORION_HOME}/config/server.xml
+.endif
+
+	@# Configure the port to listen to
+	${CAT} ${WRKSRC}/config/default-web-site.xml \
+	| ${SED} "/port=\"80\"/s//port=\"${LISTEN_PORT}\"/" \
+	> ${ORION_HOME}/config/default-web-site.xml
+
+	@# Install the 'orionctl' script
 	${CAT} ${FILESDIR}/${ORIONCTL_NAME} \
 	| ${SED} "/%%PORTNAME%%/s//${PORTNAME}/" \
 	| ${SED} "/%%PORTVERSION%%/s//${PORTVERSION}/" \
 	| ${SED} "/%%ORION_HOME%%/s//${ORION_HOME:S/\//\\\//g}/" \
 	| ${SED} "/%%RC_SCRIPT_NAME%%/s//${PORTNAME}.sh/" \
 	| ${SED} "/%%JAVA_HOME%%/s//${JAVA_HOME:S/\//\\\//g}/" \
+	| ${SED} "/%%USER_NAME%%/s//${USER_NAME}/" \
 	> ${ORIONCTL_DEST}
-	${CAT} ${FILESDIR}/${ORIONCTL_NAME}.1 \
-	| ${SED} "/%%PREFIX%%/s//${PREFIX:S/\//\\\//g}/" \
-	> ${WRKDIR}/${ORIONCTL_NAME}.1
 	${CHMOD} 755 ${ORIONCTL_DEST}
+
+	@# Fix a small typo in the index.html served as the root
+	${CAT} ${WRKSRC}/default-web-app/index.html \
+	| ${SED} "/1\.4\.0/s//${PORTVERSION}/" \
+	> ${ORION_HOME}/default-web-app/index.html
+
+	@# Install the startup script
 	${LN} -sf ${ORIONCTL_DEST} ${RC_SCRIPT}
+
+	@# Create the 'application-deployments' directory, since Orion will
+	@# otherwise create it when it is first run
 	${MKDIR} ${ORION_HOME}/application-deployments
+
+	@# Install the tools.jar file from the JDK, since it is needed by Orion
 	${LN} -sf ${JAVA_HOME}/lib/tools.jar ${ORION_HOME}/tools.jar
+
+	@# Change ownership for the files
+	${CHOWN} -R ${USER_NAME}:${GROUP_NAME} ${ORION_HOME}
+
+	@# Install the man page
 .if !defined(NOPORTDOCS)
-	${INSTALL_MAN} ${WRKDIR}/orionctl.1 ${MANPREFIX}/man/man1
+	${CAT} ${FILESDIR}/${ORIONCTL_NAME}.1 \
+	| ${SED} "/%%PREFIX%%/s//${PREFIX:S/\//\\\//g}/" \
+	> ${WRKDIR}/${ORIONCTL_NAME}.1
+	${INSTALL_MAN} ${WRKDIR}/${ORIONCTL_NAME}.1 ${MANPREFIX}/man/man1
 .endif
 
 post-install:
 	@${ECHO} "${PORTTITLE} ${PORTVERSION} has been installed in ${ORION_HOME}."
 .if !defined(NOPORTDOCS)
 	@${ECHO} "Use 'man orionctl' for information about starting and stopping Orion."
+.endif
+.if ${AUTO_START} == "YES"
+	@${ECHO} -n "Starting..."
+	@${RC_SCRIPT} start
+	@${ECHO} ""
 .endif
 
 .include <bsd.port.post.mk>
diff -ruN --exclude=work --exclude=CVS --exclude=README.html /usr/ports/www/orion/files/orionctl /home/ernst/freebsd-ports/www/orion/files/orionctl
--- /usr/ports/www/orion/files/orionctl	Tue Jun 12 12:20:48 2001
+++ /home/ernst/freebsd-ports/www/orion/files/orionctl	Tue Oct  2 19:22:34 2001
@@ -1,9 +1,10 @@
 #!/bin/sh
 
-# Set some more variables
+# Set some variables
 NAME=%%PORTNAME%%
 VERSION=%%PORTVERSION%%
 ORION_HOME=%%ORION_HOME%%
+USER_NAME=%%USER_NAME%%
 LOG=${ORION_HOME}/log/${NAME}.log
 PID_FILE=/var/run/${NAME}.pid
 JAR_FILE=${ORION_HOME}/${NAME}.jar
@@ -64,13 +65,16 @@
 		# Create the process ID file
 		rm -f ${PID_FILE}
 		touch ${PID_FILE}
-		chown root:wheel ${PID_FILE}
+		chown ${USER_NAME} ${PID_FILE}
 		chmod 600 ${PID_FILE}
 
 		if [ "${AS_RC_SCRIPT}" = "yes" ]; then
 			echo -n " ${NAME}"
 		fi
-		( cd ${ORION_HOME} && ${JAVA_CMD} -jar orion.jar & echo $! > ${PID_FILE} ) > ${LOG} 2>&1
+		touch ${PID_FILE}
+		chown ${USER_NAME} ${PID_FILE}
+		chmod 600 ${PID_FILE}
+		su - ${USER_NAME} -c "(cd ${ORION_HOME} && ${JAVA_CMD} -jar orion.jar & echo \$! > ${PID_FILE}) > ${LOG} 2>&1"
 		;;
 	stop)
 		if [ ! -e ${PID_FILE} ]; then
diff -ruN --exclude=work --exclude=CVS --exclude=README.html /usr/ports/www/orion/pkg-plist /home/ernst/freebsd-ports/www/orion/pkg-plist
--- /usr/ports/www/orion/pkg-plist	Wed Jun 27 02:15:07 2001
+++ /home/ernst/freebsd-ports/www/orion/pkg-plist	Tue Oct  2 14:30:31 2001
@@ -394,3 +394,5 @@
 @dirrm %%T%%/persistence/ejb
 @dirrm %%T%%/persistence
 @dirrm %%T%%
+@unexec pw groupdel orion || true
+@unexec pw userdel orion || true

To Unsubscribe: send mail to majordomo@FreeBSD.org
with "unsubscribe freebsd-java" in the body of the message




Want to link to this message? Use this URL: <https://mail-archive.FreeBSD.org/cgi/mid.cgi?200110030745.f937jh308148>