diff --git a/www/jakarta-tomcat/Makefile b/www/jakarta-tomcat/Makefile index c68de1e366fb..77019497c12c 100644 --- a/www/jakarta-tomcat/Makefile +++ b/www/jakarta-tomcat/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-tomcat/files/daemonctl.c b/www/jakarta-tomcat/files/daemonctl.c index 1c6b0ede2ee5..f88961d4fa56 100644 --- a/www/jakarta-tomcat/files/daemonctl.c +++ b/www/jakarta-tomcat/files/daemonctl.c @@ -4,7 +4,7 @@ * * Daemon control program. * - * $FreeBSD: /tmp/pcvs/ports/www/jakarta-tomcat/files/Attic/daemonctl.c,v 1.2 2002-04-03 19:49:27 znerd Exp $ + * $FreeBSD: /tmp/pcvs/ports/www/jakarta-tomcat/files/Attic/daemonctl.c,v 1.3 2002-04-03 20:42:07 znerd Exp $ */ #include @@ -17,10 +17,11 @@ #include #include #include +#include #include #include -#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%%..."); diff --git a/www/jakarta-tomcat4/Makefile b/www/jakarta-tomcat4/Makefile index c68de1e366fb..77019497c12c 100644 --- a/www/jakarta-tomcat4/Makefile +++ b/www/jakarta-tomcat4/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-tomcat4/files/daemonctl.c b/www/jakarta-tomcat4/files/daemonctl.c index 3ced2dab79db..7b50995a76cd 100644 --- a/www/jakarta-tomcat4/files/daemonctl.c +++ b/www/jakarta-tomcat4/files/daemonctl.c @@ -4,7 +4,7 @@ * * Daemon control program. * - * $FreeBSD: /tmp/pcvs/ports/www/jakarta-tomcat4/files/Attic/daemonctl.c,v 1.2 2002-04-03 19:49:27 znerd Exp $ + * $FreeBSD: /tmp/pcvs/ports/www/jakarta-tomcat4/files/Attic/daemonctl.c,v 1.3 2002-04-03 20:42:07 znerd Exp $ */ #include @@ -17,10 +17,11 @@ #include #include #include +#include #include #include -#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%%..."); 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 @@ -17,10 +17,11 @@ #include #include #include +#include #include #include -#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%%..."); diff --git a/www/tomcat41/Makefile b/www/tomcat41/Makefile index c68de1e366fb..77019497c12c 100644 --- a/www/tomcat41/Makefile +++ b/www/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/tomcat41/files/daemonctl.c b/www/tomcat41/files/daemonctl.c index 49a45728ac74..a8b09bfb79b1 100644 --- a/www/tomcat41/files/daemonctl.c +++ b/www/tomcat41/files/daemonctl.c @@ -4,7 +4,7 @@ * * Daemon control program. * - * $FreeBSD: /tmp/pcvs/ports/www/tomcat41/files/Attic/daemonctl.c,v 1.2 2002-04-03 19:49:27 znerd Exp $ + * $FreeBSD: /tmp/pcvs/ports/www/tomcat41/files/Attic/daemonctl.c,v 1.3 2002-04-03 20:42:07 znerd Exp $ */ #include @@ -17,10 +17,11 @@ #include #include #include +#include #include #include -#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%%...");