summaryrefslogtreecommitdiff
path: root/sysutils/ups-nut/Makefile
blob: 12588ec74677fa08e7bcf0911a7a0d06fe2229a2 (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
# $NetBSD: Makefile,v 1.1.1.1 2000/12/28 16:06:13 martin Exp $
#

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

MAINTAINER=		collver@softhome.net
HOMEPAGE=		http://www.exploits.org/nut/

.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
WRKSRC=			${WRKDIR}/nut-0.44.2
DEINSTALL_FILE=         ${WRKDIR}/DEINSTALL
INSTALL_FILE=           ${WRKDIR}/INSTALL

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-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|@GREP@|${GREP}|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" \
		${WRKSRC}/scripts/NetBSD/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}
	${INSTALL_DATA} ${WRKSRC}/QUICKSTART ${NUT_DOCDIR}

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