summaryrefslogtreecommitdiff
path: root/devel/monotone-server/Makefile
blob: c99dcaaa8409cd992feff4b3d928f8741b49343f (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
86
87
88
89
90
91
92
93
# $NetBSD: Makefile,v 1.47 2010/03/15 09:52:56 jmmv Exp $
#

DISTNAME=	monotone-0.47
PKGNAME=	${DISTNAME:S/-/-server-/}
CATEGORIES=	devel scm
MASTER_SITES=	http://monotone.ca/downloads/0.47/

MAINTAINER=	jmmv@NetBSD.org
HOMEPAGE=	http://monotone.ca/
COMMENT=	Simplifies the configuration of a dedicated Monotone server

DEPENDS+=	digest>=20080510:../../pkgtools/digest
DEPENDS+=	monotone>=0.47:../../devel/monotone

PKG_DESTDIR_SUPPORT=	user-destdir

LICENSE=	2-clause-bsd
NO_BUILD=	yes

RCD_SCRIPTS=		monotone

PKG_SYSCONFSUBDIR=	monotone-server
OWN_DIRS_PERMS=	${PKG_SYSCONFDIR}/keys \
			${MONOTONE_USER} ${MONOTONE_GROUP} 700

EXAMPLEDIR=		${PREFIX}/share/examples/monotone-server
CONF_FILES_PERMS=	${EXAMPLEDIR}/monotonerc \
			${PKG_SYSCONFDIR}/monotonerc \
			${MONOTONE_USER} ${MONOTONE_GROUP} 600
CONF_FILES_PERMS+=	${EXAMPLEDIR}/read-permissions \
			${PKG_SYSCONFDIR}/read-permissions \
			${MONOTONE_USER} ${MONOTONE_GROUP} 600
CONF_FILES_PERMS+=	${EXAMPLEDIR}/write-permissions \
			${PKG_SYSCONFDIR}/write-permissions \
			${MONOTONE_USER} ${MONOTONE_GROUP} 600
CONF_FILES_PERMS+=	/dev/null ${MONOTONE_LOGFILE} \
			${MONOTONE_USER} ${MONOTONE_GROUP} 600

PKG_GROUPS=		${MONOTONE_GROUP}
PKG_USERS=		${MONOTONE_USER}:${MONOTONE_GROUP}

PKG_GROUPS_VARS+=	MONOTONE_GROUP
PKG_USERS_VARS+=	MONOTONE_USER

.include "../../mk/bsd.prefs.mk"

BUILD_DEFS+=		RCD_SCRIPTS_DIR VARBASE

MONOTONE_HOME=		${VARBASE}/monotone
MONOTONE_LOGFILE=	${VARBASE}/log/monotone.log

PKG_GECOS.${MONOTONE_USER}=	Monotone dedicated server
PKG_HOME.${MONOTONE_USER}=	${MONOTONE_HOME}
PKG_SHELL.${MONOTONE_USER}=	${SH}

SUBST_CLASSES+=	vars
SUBST_STAGE.vars=	do-configure
SUBST_MESSAGE.vars=	Configuring sources.
SUBST_FILES.vars=	${WRKDIR}/monotone-server.7
SUBST_SED.vars+=	-e 's|@MONOTONE_HOME@|${MONOTONE_HOME}|g'
SUBST_SED.vars+=	-e 's|@MONOTONE_LOGFILE@|${MONOTONE_LOGFILE}|g'
SUBST_SED.vars+=	-e 's|@MONOTONE_USER@|${MONOTONE_USER}|g'
SUBST_SED.vars+=	-e 's|@PKG_SYSCONFDIR@|${PKG_SYSCONFDIR}|g'
SUBST_SED.vars+=	-e 's|@PREFIX@|${PREFIX}|g'
SUBST_SED.vars+=	-e 's|@RCD_SCRIPTS_DIR@|${RCD_SCRIPTS_DIR}|g'

FILES_SUBST+=		DIGEST=${PREFIX:Q}/bin/digest
FILES_SUBST+=		MONOTONE=${PREFIX:Q}/bin/mtn
FILES_SUBST+=		MONOTONE_GROUP=${MONOTONE_GROUP:Q}
FILES_SUBST+=		MONOTONE_LOGFILE=${MONOTONE_LOGFILE:Q}
FILES_SUBST+=		MONOTONE_USER=${MONOTONE_USER:Q}
FILES_SUBST+=		PKG_SYSCONFDIR=${PKG_SYSCONFDIR:Q}

INSTALLATION_DIRS=	${PKGMANDIR}/man7

post-extract:
.for f in monotone-server.7 read-permissions write-permissions
	${CP} ${FILESDIR}/${f} ${WRKDIR}
.endfor

do-install:
	${INSTALL_DATA_DIR} ${DESTDIR}${EXAMPLEDIR}
	${INSTALL_DATA} ${WRKDIR}/monotone-server.7 \
		${DESTDIR}${PREFIX}/${PKGMANDIR}/man7/monotone-server.7
	${INSTALL_DATA} ${WRKSRC}/contrib/get_passphrase_from_file.lua \
		${DESTDIR}${EXAMPLEDIR}/monotonerc
	${INSTALL_DATA} ${WRKDIR}/read-permissions \
		${DESTDIR}${EXAMPLEDIR}/read-permissions
	${INSTALL_DATA} ${WRKDIR}/write-permissions \
		${DESTDIR}${EXAMPLEDIR}/write-permissions

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