aboutsummaryrefslogtreecommitdiffstats
path: root/net/foreman-proxy/Makefile
blob: b07dccb0f0df9eeca071ab66d2bde9065e3248b8 (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
# Created by: Martin Matuska <mm@FreeBSD.org>
# $FreeBSD$

PORTNAME=   foreman-proxy
PORTVERSION=    1.5.1
CATEGORIES= net
MASTER_SITES=   GH

MAINTAINER= mm@FreeBSD.org
COMMENT=    Foreman Smart Proxy

LICENSE=    GPLv3

RUN_DEPENDS=    rubygem-sinatra>=1.4.3:${PORTSDIR}/www/rubygem-sinatra \
        rubygem-json>=1.8.1:${PORTSDIR}/devel/rubygem-json

OPTIONS_DEFINE= BMC PUPPET
BMC_DESC=   Depend on rubyipmi for BMC support
PUPPET_DESC=    Depend on Puppet

USE_GITHUB= yes
GH_ACCOUNT= theforeman
GH_PROJECT= smart-proxy
GH_COMMIT=  2924287
USE_RUBY=   yes
USE_RAKE=   yes
USE_RC_SUBR=    foreman-proxy
NO_BUILD=   yes
PKGINSTALL= ${WRKDIR}/pkg-install

FOREMAN_PROXY_USER?=    foreman_proxy
FOREMAN_PROXY_GROUP?=   foreman_proxy
FOREMAN_PROXY_LOGDIR?=  /var/log/foreman-proxy
FOREMAN_PROXY_RUNDIR?=  /var/run/foreman-proxy

USERS=      ${FOREMAN_PROXY_USER}
GROUPS=     ${FOREMAN_PROXY_GROUP}

SUB_FILES+= pkg-install
SUB_LIST+=  RUBY="${RUBY}" \
        FOREMAN_PROXY_USER="${FOREMAN_PROXY_USER}" \
        FOREMAN_PROXY_GROUP="${FOREMAN_PROXY_GROUP}" \
        FOREMAN_PROXY_RUNDIR="${FOREMAN_PROXY_RUNDIR}" \
        FOREMAN_PROXY_LOGDIR="${FOREMAN_PROXY_LOGDIR}"

PLIST_SUB+= ${SUB_LIST} \
        MKDIR="${MKDIR}"

.include <bsd.port.options.mk>

.if ${PORT_OPTIONS:MBMC}
RUN_DEPENDS+=   rubygem-rubyipmi>=0.7:${PORTSDIR}/sysutils/rubygem-rubyipmi
.endif

.if ${PORT_OPTIONS:MPUPPET}
RUN_DEPENDS+=   puppet:${PORTSDIR}/sysutils/puppet
.endif

.include <bsd.port.pre.mk>

post-patch:
    @${REINPLACE_CMD} \
        -e "s|/usr/bin/env ruby|${RUBY}|g" \
        -e "s|#{File.dirname(__FILE__)}/..|${DATADIR}|g" \
        ${WRKSRC}/bin/smart-proxy
    @${REINPLACE_CMD} -e "s|%%PREFIX%%|${PREFIX}|g" \
        -e "s|%%LOCALBASE%%|${LOCALBASE}|g" \
        ${WRKSRC}/config/settings.yml.example

do-install:
    @${MKDIR} ${STAGEDIR}${PREFIX}/etc/foreman-proxy
    @${MKDIR} ${STAGEDIR}${DATADIR}
    @${LN} -s ${PREFIX}/etc/foreman-proxy ${STAGEDIR}${DATADIR}/config
    @${INSTALL_SCRIPT} ${WRKSRC}/bin/smart-proxy \
        ${STAGEDIR}${PREFIX}/sbin/smart-proxy
.for file in Rakefile config.ru lib public views
    @${CP} -r ${WRKSRC}/${file} ${STAGEDIR}${DATADIR}
.endfor
    ${INSTALL} ${COPY} -m 644 ${WRKSRC}/config/settings.yml.example \
        ${STAGEDIR}${PREFIX}/etc/foreman-proxy/settings.yml.sample
.if !exists(${STAGEDIR}${PREFIX}/etc/foreman-proxy/settings.yml)
    @${INSTALL} ${COPY} -m 644 ${WRKSRC}/config/settings.yml.example \
        ${STAGEDIR}${PREFIX}/etc/foreman-proxy/settings.yml
.endif

post-install:
    @${MKDIR} -m 0700 ${STAGEDIR}${FOREMAN_PROXY_LOGDIR} \
        ${STAGEDIR}${FOREMAN_PROXY_RUNDIR}
    @${SH} ${PKGINSTALL} STAGEDIR=${STAGEDIR}

.include <bsd.port.post.mk>