summaryrefslogtreecommitdiff
path: root/sysutils/3dm/Makefile
blob: 44456df4f83a1edcd55a7bd416626972041697d7 (plain) (blame)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
# Created by: Daniel Baker <dbaker@FreeBSD.org>
# $FreeBSD$

PORTNAME=	3dm
PORTVERSION=	2.11.00.019
PORTEPOCH=	1
CATEGORIES=	sysutils
MASTER_SITES=	http://a.aranea.brtsvcs.net/3dm2/ \
		http://b.aranea.brtsvcs.net/3dm2/
DISTFILES=	tdmCliBSD_${PORTVERSION}.tar.gz
DIST_SUBDIR=	3dm2

MAINTAINER=	ports.maintainer@evilphi.com
COMMENT=	3ware RAID controller monitoring daemon and web server

USE_RC_SUBR=	3dm2

OPTIONS_DEFINE=	SSLFIX
SSLFIX_DESC=	Install KB16625-patched binaries

OPTIONS_DEFAULT=	SSLFIX

NO_STAGE=	yes
.include <bsd.port.options.mk>

.if !empty(PORT_OPTIONS:MSSLFIX)
DISTFILES+=	kb16625_${PORTVERSION}.tar.gz
BINPREFIX=	${WRKSRC}/kb16625
.else
BINPREFIX=	${WRKSRC}
.endif

.include <bsd.port.pre.mk>

ONLY_FOR_ARCHS=	i386 amd64
NO_BUILD=	yes

NO_WRKSUBDIR=	yes

.if ${OSVERSION} > 700000
BINSRC=		${BINPREFIX}/7x
.else
BINSRC=		${BINPREFIX}/6x
.endif

.if ${ARCH} == "i386"
BINSUFFIX=	x86
.elif ${ARCH} == "amd64"
BINSUFFIX=	x86_64
.endif

HELPSRC=	${WRKSRC}/en

HELPDIR=	${PREFIX}/share/3dm2/help/en
ETCDIR=		${PREFIX}/etc/3dm2
MSGDIR=		${ETCDIR}/msg

post-extract:
	${TAR} zxf ${WRKSRC}/tdm2Help.tgz -C ${WRKSRC}
	${TAR} zxf ${WRKSRC}/tdm2Msg.tgz -C ${WRKSRC}

post-configure:
	@${SED} -e 's,%%PREFIX%%,${PREFIX},g' \
	< ${FILESDIR}/3dm2.conf.sample > ${WRKSRC}/3dm2.conf.sample

do-install:
.for i in ${ETCDIR} ${MSGDIR} ${HELPDIR}/css ${HELPDIR}/images ${HELPDIR}/scripts
.if !exists(${i})
	${MKDIR} ${i}
.endif
.endfor

	${INSTALL_DATA} ${HELPSRC}/*.html ${HELPDIR}
	${INSTALL_DATA} ${HELPSRC}/*.gif ${HELPDIR}
	${INSTALL_DATA} ${HELPSRC}/*.jpg ${HELPDIR}
	${INSTALL_DATA} ${HELPSRC}/css/* ${HELPDIR}/css
	${INSTALL_DATA} ${HELPSRC}/images/* ${HELPDIR}/images
	${INSTALL_DATA} ${HELPSRC}/scripts/* ${HELPDIR}/scripts

	${INSTALL_PROGRAM} ${BINSRC}/3dm2.${BINSUFFIX} ${PREFIX}/sbin/3dm2

	${INSTALL_DATA} ${WRKSRC}/tdm_msg_en ${MSGDIR}
	${INSTALL_DATA} ${WRKSRC}/tw_msg_en ${MSGDIR}

	${INSTALL_DATA} ${WRKSRC}/3dm2.conf.sample ${ETCDIR}
	${CHMOD} 400 ${ETCDIR}/3dm2.conf.sample

post-install:
.if !exists(${PREFIX}/etc/3dm2/3dm2.conf)
	${INSTALL_DATA} ${WRKSRC}/3dm2.conf.sample ${PREFIX}/etc/3dm2/3dm2.conf
	${CHMOD} 600 ${PREFIX}/etc/3dm2/3dm2.conf
	@${ECHO} ""
	@${ECHO} ""
	@${ECHO} "!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!"
	@${ECHO} "        Don't forget to edit '${PREFIX}/etc/3dm2/3dm2.conf'"
	@${ECHO} "!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!"
	@${ECHO} "             Visit https://`hostname`:888/"
	@${ECHO} "!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!"
	@${ECHO} ""
	@${ECHO} ""
.endif

# 3ware uses a hardcoded config dir location that doesn't match hier(9)

.if !exists(/etc/3dm2)
	@${MKDIR} /etc/3dm2
.endif
	@${LN} -s ${PREFIX}/etc/3dm2/3dm2.conf /etc/3dm2/3dm2.conf
	@${LN} -s ${PREFIX}/etc/3dm2/3dm2.pem /etc/3dm2/3dm2.pem

	@${CAT} ${PKGMESSAGE}

.include <bsd.port.post.mk>