2013-03-07 14:49:24 +01:00
|
|
|
# Created by: Eric F Crist <ecrist@secure-computing.net>
|
2010-02-12 20:27:38 +01:00
|
|
|
# $FreeBSD$
|
|
|
|
|
|
|
|
PORTNAME= rackmonkey
|
|
|
|
PORTVERSION= 1.2.5
|
2010-03-31 19:16:42 +02:00
|
|
|
PORTREVISION= 2
|
2010-02-12 20:27:38 +01:00
|
|
|
CATEGORIES= net-mgmt www
|
2010-04-15 00:11:45 +02:00
|
|
|
MASTER_SITES= SF \
|
|
|
|
ftp://ftp.secure-computing.net/pub/FreeBSD/ports/${PORTNAME}/ \
|
|
|
|
ftp://ftp2.secure-computing.net/pub/FreeBSD/ports/${PORTNAME}/
|
2010-02-12 20:27:38 +01:00
|
|
|
DISTNAME= ${PORTNAME}-${PORTVERSION}-1
|
|
|
|
|
|
|
|
MAINTAINER= ecrist@secure-computing.net
|
|
|
|
COMMENT= A web-based tool for managing racks of equipment
|
|
|
|
|
|
|
|
RUN_DEPENDS= p5-DBI>=0:${PORTSDIR}/databases/p5-DBI \
|
|
|
|
p5-HTML-Template>=0:${PORTSDIR}/www/p5-HTML-Template \
|
|
|
|
p5-Spreadsheet-WriteExcel>=0:${PORTSDIR}/textproc/p5-Spreadsheet-WriteExcel \
|
2010-03-10 18:53:27 +01:00
|
|
|
p5-Net-DNS>=0:${PORTSDIR}/dns/p5-Net-DNS \
|
|
|
|
p5-HTML-Parser>=0:${PORTSDIR}/www/p5-HTML-Parser
|
2010-02-12 20:27:38 +01:00
|
|
|
|
2013-03-07 14:49:24 +01:00
|
|
|
OPTIONS_DEFINE= SQLITE MYSQL PGSQL INIT_DB SAMPLE
|
|
|
|
OPTIONS_DEFAULT= SQLITE INIT_DB SAMPLE
|
|
|
|
INIT_DB_DESC= Initialize DB at installation (SQLite Only)
|
|
|
|
SAMPLE_DESC= Install sample data (SQLite Only)
|
2010-02-12 20:27:38 +01:00
|
|
|
|
|
|
|
WRKSRC= ${WRKDIR}/${PORTNAME}-${PORTVERSION}-1
|
|
|
|
NO_BUILD= YES
|
|
|
|
|
2013-09-14 18:38:28 +02:00
|
|
|
USES= perl5
|
|
|
|
USE_PERL5= run
|
2010-02-12 20:27:38 +01:00
|
|
|
|
|
|
|
SUB_FILES= pkg-message
|
|
|
|
|
2013-09-21 00:24:43 +02:00
|
|
|
NO_STAGE= yes
|
2010-02-12 20:27:38 +01:00
|
|
|
.include <bsd.port.options.mk>
|
2013-09-14 18:38:28 +02:00
|
|
|
|
2013-03-07 14:49:24 +01:00
|
|
|
.if ${PORT_OPTIONS:MSQLITE}
|
2010-02-12 20:27:38 +01:00
|
|
|
USE_SQLITE= yes
|
|
|
|
RUN_DEPENDS+= p5-DBD-SQLite>=0:${PORTSDIR}/databases/p5-DBD-SQLite
|
|
|
|
.endif
|
2013-03-07 14:49:24 +01:00
|
|
|
.if ${PORT_OPTIONS:MMYSQL}
|
2010-02-12 20:27:38 +01:00
|
|
|
USE_MYSQL= yes
|
2010-12-11 00:04:49 +01:00
|
|
|
RUN_DEPENDS+= p5-DBD-mysql>=0:${PORTSDIR}/databases/p5-DBD-mysql
|
2010-02-12 20:27:38 +01:00
|
|
|
.endif
|
2013-03-07 14:49:24 +01:00
|
|
|
.if ${PORT_OPTIONS:MPGSQL}
|
2010-02-12 20:27:38 +01:00
|
|
|
USE_PGSQL= 83
|
2010-05-20 10:44:31 +02:00
|
|
|
RUN_DEPENDS+= p5-DBD-Pg>=0:${PORTSDIR}/databases/p5-DBD-Pg
|
2010-02-12 20:27:38 +01:00
|
|
|
.endif
|
|
|
|
|
2013-03-07 14:49:24 +01:00
|
|
|
.if ${PORT_OPTIONS:MINIT_DB}
|
2010-12-23 04:31:48 +01:00
|
|
|
PLIST_SUB+= INIT_DB=""
|
2013-03-07 14:49:24 +01:00
|
|
|
INIT_DB= yes
|
2010-12-23 04:31:48 +01:00
|
|
|
.else
|
|
|
|
PLIST_SUB+= INIT_DB="@comment "
|
|
|
|
.endif
|
|
|
|
|
2013-03-07 14:49:24 +01:00
|
|
|
.if ${PORT_OPTIONS:MSAMPLE}
|
|
|
|
SAMPLE= yes
|
|
|
|
.endif
|
|
|
|
|
2010-02-12 20:27:38 +01:00
|
|
|
do-install:
|
|
|
|
${MKDIR} ${WWWDIR}/
|
|
|
|
${INSTALL} ${WRKSRC}/perl/rackmonkey.pl ${WRKSRC}/perl/rack2xls.pl ${WRKSRC}/perl/rackdns.pl ${WWWDIR}/
|
|
|
|
cd ${WRKSRC}/www && ${COPYTREE_SHARE} \* ${WWWDIR}/
|
|
|
|
cd ${WRKSRC} && ${COPYTREE_SHARE} tmpl ${WWWDIR}/
|
|
|
|
cd ${WRKSRC}/perl && ${COPYTREE_SHARE} RackMonkey ${WWWDIR}/
|
2010-03-31 19:16:42 +02:00
|
|
|
${MKDIR} ${WRKDIR}/build_conf; \
|
|
|
|
${CP} ${WRKSRC}/conf/rackmonkey.conf-default ${WRKDIR}/build_conf/rackmonkey.conf; \
|
2013-03-07 14:49:24 +01:00
|
|
|
if [ "${USE_SQLITE}" ]; then \
|
2010-02-12 20:27:38 +01:00
|
|
|
${ECHO} "Building with SQLite............."; \
|
|
|
|
${SED} -i '' -e 's%dbconnect =%dbconnect = dbi:SQLite:dbname=${WWWDIR}/rackmonkey.db%' ${WRKDIR}/build_conf/rackmonkey.conf; \
|
2013-03-07 14:49:24 +01:00
|
|
|
if [ "${INIT_DB}" ]; then \
|
2010-02-12 20:27:38 +01:00
|
|
|
if [ -e "${WWWDIR}/rackmonkey.db" ]; then \
|
|
|
|
${ECHO} "Database exists, skipping initalization..."; \
|
|
|
|
else \
|
2010-04-15 00:11:45 +02:00
|
|
|
${LOCALBASE}/bin/sqlite3 ${WWWDIR}/rackmonkey.db < ${WRKSRC}/sql/schema/schema.sqlite.sql; \
|
|
|
|
${LOCALBASE}/bin/sqlite3 ${WWWDIR}/rackmonkey.db < ${WRKSRC}/sql/data/default_data.sql; \
|
2013-03-07 14:49:24 +01:00
|
|
|
if [ "${SAMPLE}" ]; then \
|
2010-04-15 00:11:45 +02:00
|
|
|
${LOCALBASE}/bin/sqlite3 ${WWWDIR}/rackmonkey.db < ${WRKSRC}/sql/data/sample_data.sql; \
|
2010-02-12 20:27:38 +01:00
|
|
|
fi \
|
|
|
|
fi \
|
|
|
|
fi \
|
2013-03-07 14:49:24 +01:00
|
|
|
elif [ "${USE_MYSQL}" -o "${USE_PGSQL}" ]; then \
|
2010-02-12 20:27:38 +01:00
|
|
|
${INSTALL} ${WRKSRC}/conf/rackmonkey.conf-default ${WWWDIR}/; \
|
|
|
|
fi
|
|
|
|
if [ -e "${WWWDIR}/rackmonkey.conf" ]; then \
|
|
|
|
${MV} ${WWWDIR}/rackmonkey.conf ${WWWDIR}/rackmonkey.conf.old; \
|
|
|
|
fi
|
|
|
|
${SED} -i '' \
|
|
|
|
-e 's/#plugin_xls/plugin_xls/' \
|
|
|
|
-e 's/#plugin_dns/plugin_dns/' \
|
|
|
|
-e 's%tmplpath =%tmplpath = ${WWWDIR}/tmpl%' \
|
|
|
|
-e 's%wwwpath =%wwwpath = /rackmonkey%' \
|
|
|
|
${WRKDIR}/build_conf/rackmonkey.conf
|
|
|
|
${INSTALL} ${WRKDIR}/build_conf/rackmonkey.conf ${WWWDIR}/
|
|
|
|
${INSTALL} ${WRKDIR}/build_conf/rackmonkey.conf ${WWWDIR}/rackmonkey.conf-default
|
|
|
|
cd ${WRKSRC} && ${COPYTREE_SHARE} sql ${WWWDIR}/
|
|
|
|
cd ${WRKSRC} && ${COPYTREE_SHARE} doc ${WWWDIR}/
|
|
|
|
${CHOWN} -R 80:80 ${WWWDIR}
|
|
|
|
${CAT} ${PKGMESSAGE}
|
|
|
|
|
|
|
|
.include <bsd.port.mk>
|