summaryrefslogtreecommitdiff
path: root/sysutils/backuppc/Makefile
blob: b40adb24904a636be8ae5283359f99aec7a84a36 (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
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
# $NetBSD: Makefile,v 1.10 2019/08/11 13:23:03 wiz Exp $

DISTNAME=	BackupPC-3.3.1
PKGNAME=	${DISTNAME:tl}
PKGREVISION=	8
CATEGORIES=	sysutils
MASTER_SITES=	${MASTER_SITE_SOURCEFORGE:=backuppc/}

MAINTAINER=	tnn@NetBSD.org
HOMEPAGE=	http://backuppc.sourceforge.net/
COMMENT=	Fast, agentless backup system supporting *NIX, Windows and OSX clients
LICENSE=	gnu-gpl-v2

DEPENDS+=	rsync-[0-9]*:../../net/rsync
DEPENDS+=	samba-[0-9]*:../../net/samba
DEPENDS+=	par2-[0-9]*:../../archivers/par2
DEPENDS+=	p5-Archive-Zip-[0-9]*:../../archivers/p5-Archive-Zip
DEPENDS+=	p5-CGI-[0-9]*:../../www/p5-CGI
DEPENDS+=	p5-File-Listing-[0-9]*:../../devel/p5-File-Listing
DEPENDS+=	p5-File-RsyncP-[0-9]*:../../net/p5-File-RsyncP

HAS_CONFIGURE=	yes
USE_LANGUAGES=	# none
USE_TOOLS+=	bzip2:run cat:run tar:run perl:run hostname:run gzip:run pax

CONFIG_SHELL=		${PERL5}
CONFIGURE_SCRIPT=	configure.pl
CONFIGURE_ARGS+=	--batch
CONFIGURE_ARGS+=	--backuppc-user ${BACKUPPC_USER}
CONFIGURE_ARGS+=	--hostname localhost
CONFIGURE_ARGS+=	--dest-dir ${WRKSRC}/build
CONFIGURE_ARGS+=	--config-dir ${PREFIX}/share/examples/BackupPC
CONFIGURE_ARGS+=	--cgi-dir ${PREFIX}/share/BackupPC/cgi-bin
CONFIGURE_ARGS+=	--data-dir ${VARBASE}/BackupPC
CONFIGURE_ARGS+=	--html-dir ${PREFIX}/share/BackupPC/htdocs
CONFIGURE_ARGS+=	--html-dir-url /BackupPC
CONFIGURE_ARGS+=	--install-dir ${PREFIX}/share/BackupPC
CONFIGURE_ARGS+=	--log-dir ${VARBASE}/log/BackupPC
CONFIGURE_ARGS+=	--uid-ignore
CONFIGURE_ARGS+=	--no-set-perms

CONFIGURE_ARGS+=	--bin-path bzip2=${TOOLS_PATH.bzip2}
CONFIGURE_ARGS+=	--bin-path cat=${TOOLS_PATH.cat}
CONFIGURE_ARGS+=	--bin-path tar=${TOOLS_PATH.tar}
CONFIGURE_ARGS+=	--bin-path gzip=${TOOLS_PATH.gzip}
CONFIGURE_ARGS+=	--bin-path hostname=${TOOLS_PATH.hostname}

CONFIGURE_ARGS+=	--bin-path perl=${PERL5}
CONFIGURE_ARGS+=	--bin-path rsync=${PREFIX}/bin/rsync
CONFIGURE_ARGS+=	--bin-path nmblookup=${PREFIX}/bin/nmblookup
CONFIGURE_ARGS+=	--bin-path smbclient=${PREFIX}/bin/smbclient
CONFIGURE_ARGS+=	--bin-path par2=${PREFIX}/bin/par2

.if exists(/usr/bin/ssh)
CONFIGURE_ARGS+=	--bin-path ssh=/usr/bin/ssh
.else
DEPENDS+=		openssh-[0-9]*:../../security/openssh
CONFIGURE_ARGS+=	--bin-path ssh=${PREFIX}/bin/ssh
.endif

BUILD_DEFS+=		BACKUPPC_USER BACKUPPC_GROUP APACHE_USER APACHE_GROUP VARBASE

BACKUPPC_USER?=		backuppc
BACKUPPC_GROUP?=	backuppc

PKG_USERS_VARS=		BACKUPPC_USER
PKG_GROUPS_VARS=	BACKUPPC_GROUP
PKG_GROUPS=		${BACKUPPC_GROUP}
PKG_USERS=		${BACKUPPC_USER}:${BACKUPPC_GROUP}

SUBST_CLASSES+=			fix-paths
SUBST_STAGE.fix-paths=		post-configure
SUBST_MESSAGE.fix-paths=	Substituting paths and usernames.
SUBST_FILES.fix-paths=		${WRKSRC}/build/${PREFIX}/share/examples/BackupPC/config.pl
SUBST_FILES.fix-paths+=		${WRKSRC}/build/${PREFIX}/share/BackupPC/doc/*
SUBST_FILES.fix-paths+=		${WRKSRC}/build/${PREFIX}/share/BackupPC/lib/BackupPC/Lib.pm
SUBST_FILES.fix-paths+=		${WRKSRC}/backuppc.conf
SUBST_FILES.fix-paths+=		${WRKSRC}/cgiwrapper.c
SUBST_SED.fix-paths=		-e 's,${PREFIX}/share/examples/BackupPC,${PKG_SYSCONFDIR},g'
SUBST_VARS.fix-paths=		PREFIX
SUBST_VARS.fix-paths+=		PKG_SYSCONFDIR
SUBST_VARS.fix-paths+=		APACHE_USER
SUBST_VARS.fix-paths+=		APACHE_GROUP
SUBST_VARS.fix-paths+=		BACKUPPC_USER
SUBST_VARS.fix-paths+=		BACKUPPC_GROUP
SUBST_VARS.fix-paths+=		PERL5

FILES_SUBST+=			BACKUPPC_USER=${BACKUPPC_USER:Q} BACKUPPC_GROUP=${BACKUPPC_GROUP:Q}

PKG_SYSCONFSUBDIR=	BackupPC
PKG_SYSCONFDIR_PERMS=   ${BACKUPPC_USER} ${BACKUPPC_GROUP} 0755
RCD_SCRIPTS=		backuppc

OWN_DIRS_PERMS+=	${VARBASE}/BackupPC ${BACKUPPC_USER} ${BACKUPPC_GROUP} 0750
.for d in pool cpool pc trash
OWN_DIRS_PERMS+=	${VARBASE}/BackupPC/${d} ${BACKUPPC_USER} ${BACKUPPC_GROUP} 0750
.endfor
OWN_DIRS_PERMS+=	${VARBASE}/log/BackupPC ${BACKUPPC_USER} ${BACKUPPC_GROUP} 0750

EGDIR=			${PREFIX}/share/examples/BackupPC
CONF_FILES_PERMS+=	${EGDIR}/config.pl ${PKG_SYSCONFDIR}/config.pl ${BACKUPPC_USER} ${BACKUPPC_GROUP} 0640
CONF_FILES_PERMS+=	${EGDIR}/hosts ${PKG_SYSCONFDIR}/hosts ${BACKUPPC_USER} ${BACKUPPC_GROUP} 0640
CONF_FILES_PERMS+=	${EGDIR}/backuppc.conf ${PKG_SYSCONFDIR}/backuppc.conf ${REAL_ROOT_USER} ${REAL_ROOT_GROUP} 0644

post-extract:
	cp ${FILESDIR}/backuppc.conf ${WRKSRC}/backuppc.conf
	cp ${FILESDIR}/cgiwrapper.c ${WRKSRC}/cgiwrapper.c

do-build:
	rm -rf ${WRKSRC}/build/${VARBASE}

do-install:
	cd ${WRKSRC}/build && pax -rw . ${DESTDIR}/
	chmod +x ${DESTDIR}${PREFIX}/share/BackupPC/bin/*
	${INSTALL_DATA} ${WRKSRC}/backuppc.conf ${DESTDIR}${PREFIX}/share/examples/BackupPC/backuppc.conf
	${INSTALL_DATA} ${WRKSRC}/cgiwrapper.c ${DESTDIR}${PREFIX}/share/examples/BackupPC/cgiwrapper.c

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