summaryrefslogtreecommitdiff
path: root/sysutils/ups-nut/Makefile
blob: 2049a5a75d599de3befa095208b0ad59e0866897 (plain)
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
# $NetBSD: Makefile,v 1.10 2001/09/28 04:37:27 lukem Exp $
#

DISTNAME=		nut-0.45.1
PKGNAME=		ups-nut-0.45.1
CATEGORIES=		sysutils
MASTER_SITES=		http://www.exploits.org/nut/release/

PATCH_SITES=		http://www.exploits.org/nut/testing/0.45.2-pre/
PATCHFILES=		upsmon-pdflag.diff
PATCH_DIST_STRIP=	-p1

MAINTAINER=		collver@linuxfreemail.com
HOMEPAGE=		http://www.exploits.org/nut/
COMMENT=		Network UPS Tools

.include "../../mk/bsd.prefs.mk"
.if ${OPSYS} == "NetBSD"
.if exists(/usr/sbin/user)
ADDUSER=		/usr/sbin/useradd
ADDGROUP=		/usr/sbin/groupadd
USERDEL=		/usr/sbin/userdel
GROUPDEL=		/usr/sbin/groupdel
.else
DEPENDS+=		user>=20000313:../../sysutils/user
ADDUSER=		${LOCALBASE}/sbin/useradd
ADDGROUP=		${LOCALBASE}/sbin/groupadd
USERDEL=		${LOCALBASE}/sbin/userdel
GROUPDEL=		${LOCALBASE}/sbin/groupdel
.endif
.elif ${OPSYS} == "SunOS"
ADDUSER=		useradd
ADDGROUP=		groupadd
USERDEL=		userdel
GROUPDEL=		groupdel
.endif
DEINSTALL_FILE=         ${WRKDIR}/DEINSTALL
INSTALL_FILE=           ${WRKDIR}/INSTALL
BUILD_DEPENDS+=		autoconf>=2.13:../../devel/autoconf

GNU_CONFIGURE=		yes
NUT_DOCDIR=		${LOCALBASE}/share/doc/nut
NUT_USER=		nut
NUT_GROUP=		nut
CONFIGURE_ARGS+=	--sysconfdir=${LOCALBASE}/etc/nut \
			--with-user=${NUT_USER} \
			--with-group=${NUT_GROUP} \
			--with-statepath=/var/db/nut

pre-configure:
	cd ${WRKSRC} && autoreconf --force

pre-install:
	${SED}  -e 's|@NUT_USER@|${NUT_USER}|g' \
		-e 's|@NUT_GROUP@|${NUT_GROUP}|g' \
		-e 's|@USERDEL@|${USERDEL}|g' \
		-e 's|@GROUPDEL@|${GROUPDEL}|g' \
		< ${PKGDIR}/DEINSTALL > ${DEINSTALL_FILE}
	${SED}  -e 's|@NUT_USER@|${NUT_USER}|g' \
		-e 's|@NUT_GROUP@|${NUT_GROUP}|g' \
		-e 's|@USERDIR@|${USERDIR}|g' \
		-e 's|@ADDUSER@|${ADDUSER}|g' \
		-e 's|@ADDGROUP@|${ADDGROUP}|g' \
		-e 's|@CHGRP@|${CHGRP}|g' \
		-e 's|@ID@|${ID}|g' \
		-e 's|@RM@|${RM}|g' \
		-e 's|@TOUCH@|${TOUCH}|g' \
		< ${PKGDIR}/INSTALL > ${INSTALL_FILE}
	${SH} ${INSTALL_FILE}

post-install:
	@${SED} -e "/%%PREFIX%%/s##${LOCALBASE}#g" \
		${FILESDIR}/upsd \
		>${LOCALBASE}/etc/rc.d/upsd
	@${CHMOD} 0755 ${LOCALBASE}/etc/rc.d/upsd
	@${INSTALL} -d -o ${NUT_USER} -g ${NUT_GROUP} -m 0770 /var/db/nut
	@if ! [ -d ${NUT_DOCDIR} ]; then ${MKDIR} ${NUT_DOCDIR}; fi
	@if ! [ -d ${NUT_DOCDIR}/cables ]; then ${MKDIR} ${NUT_DOCDIR}/cables; fi
	${INSTALL_DATA} ${WRKSRC}/docs/cables/*.txt ${NUT_DOCDIR}/cables
	${INSTALL_DATA} ${WRKSRC}/docs/*.txt ${NUT_DOCDIR}
	${INSTALL_DATA} ${WRKSRC}/docs/FAQ ${NUT_DOCDIR}
	${INSTALL_DATA} ${WRKSRC}/docs/Changes.trust ${NUT_DOCDIR}
	${INSTALL_DATA} ${WRKSRC}/README ${NUT_DOCDIR}

.include "../../mk/bsd.pkg.mk"