aboutsummaryrefslogtreecommitdiff
path: root/www/jakarta-tomcat41
diff options
context:
space:
mode:
authorErnst de Haan <znerd@FreeBSD.org>2002-04-03 20:42:07 +0000
committerErnst de Haan <znerd@FreeBSD.org>2002-04-03 20:42:07 +0000
commitd0f2cbece8e3b221960dc6bbbc78f32036560203 (patch)
treed358b93575eb3a0b2c4f3e9e7fbc0b4a2da89993 /www/jakarta-tomcat41
parentcb8529a76287a04f2468f282f2764db3f6a9e169 (diff)
downloadports-d0f2cbece8e3b221960dc6bbbc78f32036560203.tar.gz
ports-d0f2cbece8e3b221960dc6bbbc78f32036560203.zip
Notes
Diffstat (limited to 'www/jakarta-tomcat41')
-rw-r--r--www/jakarta-tomcat41/Makefile1
-rw-r--r--www/jakarta-tomcat41/files/daemonctl.c46
2 files changed, 44 insertions, 3 deletions
diff --git a/www/jakarta-tomcat41/Makefile b/www/jakarta-tomcat41/Makefile
index c68de1e366fb..77019497c12c 100644
--- a/www/jakarta-tomcat41/Makefile
+++ b/www/jakarta-tomcat41/Makefile
@@ -7,6 +7,7 @@
PORTNAME= jakarta-tomcat
PORTVERSION= 4.0.3
+PORTREVISION= 1
CATEGORIES= www java
MASTER_SITES= http://jakarta.apache.org/builds/jakarta-tomcat-4.0/release/v${PORTVERSION}/bin/ \
http://www.metaverse.nl/~ernst/ \
diff --git a/www/jakarta-tomcat41/files/daemonctl.c b/www/jakarta-tomcat41/files/daemonctl.c
index b8289abc33ab..5ec5bed8398a 100644
--- a/www/jakarta-tomcat41/files/daemonctl.c
+++ b/www/jakarta-tomcat41/files/daemonctl.c
@@ -4,7 +4,7 @@
*
* Daemon control program.
*
- * $FreeBSD: /tmp/pcvs/ports/www/jakarta-tomcat41/files/Attic/daemonctl.c,v 1.2 2002-04-03 19:49:27 znerd Exp $
+ * $FreeBSD: /tmp/pcvs/ports/www/jakarta-tomcat41/files/Attic/daemonctl.c,v 1.3 2002-04-03 20:42:07 znerd Exp $
*/
#include <assert.h>
@@ -17,10 +17,11 @@
#include <syslog.h>
#include <unistd.h>
#include <sys/errno.h>
+#include <sys/stat.h>
#include <sys/types.h>
#include <sys/uio.h>
-#define MAX_FILE_SIZE 32
+#define MAX_FILE_SIZE 32
#define ERR_ILLEGAL_ARGUMENT 1
#define ERR_PID_FILE_NOT_FOUND 2
@@ -33,6 +34,11 @@
#define ERR_STDOUT_LOGFILE_OPEN 9
#define ERR_STDERR_LOGFILE_OPEN 10
#define ERR_FORK_FAILED 11
+#define ERR_STAT_JAVA_HOME 12
+#define ERR_JAVA_HOME_NOT_DIR 13
+#define ERR_STAT_JAVA_CMD 14
+#define ERR_JAVA_CMD_NOT_FILE 15
+#define ERR_JAVA_CMD_NOT_EXECUTABLE 16
#define private static
@@ -236,6 +242,7 @@ void start(void) {
int result;
int stdoutLogFile;
int stderrLogFile;
+ struct stat sb;
/* Open and read the PID file */
file = openPIDFile();
@@ -255,7 +262,40 @@ void start(void) {
printf(" [ DONE ]\n");
- /* XXX: printf(">> Checking for Java VM..."); */
+ printf(">> Checking for Java VM...");
+ result = stat("%%JAVA_HOME%%", &sb);
+ if (result != 0) {
+ printf(" [ FAILED ]\n");
+ fprintf(stderr, "%%CONTROL_SCRIPT_NAME%%: Unable to stat %%JAVA_HOME%%: ");
+ perror(NULL);
+ exit(ERR_STAT_JAVA_HOME);
+ }
+ if (!S_ISDIR(sb.st_mode)) {
+ printf(" [ FAILED ]\n");
+ fprintf(stderr, "%%CONTROL_SCRIPT_NAME%%: Java home directory %%JAVA_HOME%% is not a directory.\n");
+ exit(ERR_JAVA_HOME_NOT_DIR);
+ }
+
+ result = stat("%%JAVA_HOME%%/%%JAVA_CMD%%", &sb);
+ if (result != 0) {
+ printf(" [ FAILED ]\n");
+ fprintf(stderr, "%%CONTROL_SCRIPT_NAME%%: Unable to stat %%JAVA_HOME%%/%%JAVA_CMD%%: ");
+ perror(NULL);
+ exit(ERR_STAT_JAVA_CMD);
+ }
+ if (!S_ISREG(sb.st_mode)) {
+ printf(" [ FAILED ]\n");
+ fprintf(stderr, "%%CONTROL_SCRIPT_NAME%%: Java command %%JAVA_HOME%%/%%JAVA_CMD%% is not a regular file.\n");
+ exit(ERR_JAVA_CMD_NOT_FILE);
+ }
+ result = access("%%JAVA_HOME%%/%%JAVA_CMD%%", X_OK);
+ if (result != 0) {
+ printf(" [ FAILED ]\n");
+ fprintf(stderr, "%%CONTROL_SCRIPT_NAME%%: Java command %%JAVA_HOME%%/%%JAVA_CMD%% is not executable: ");
+ perror(NULL);
+ exit(ERR_JAVA_CMD_NOT_EXECUTABLE);
+ }
+ printf(" [ DONE ]\n");
printf(">> Starting %%APP_TITLE%%...");