summaryrefslogtreecommitdiff
path: root/net/samba/Makefile
blob: 63421cb12b929da0d0a4d0c9b185da0feb5d76fb (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
# $NetBSD: Makefile,v 1.28 1999/10/06 17:05:23 dmcmahill Exp $

DISTNAME=	samba-2.0.5a
WRKSRC=		${WRKDIR}/${DISTNAME}/source
CATEGORIES=	net
MASTER_SITES=	ftp://ftp.samba.org/pub/samba/

MAINTAINER=	bouyer@netbsd.org
HOMEPAGE=	http://www.samba.org/

DEPENDS+=	readline-4.0:../../devel/readline

GNU_CONFIGURE=	yes

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

STARTUP_SCRIPT=	${PREFIX}/etc/rc.d/samba.sh.sample
SAMPLE_CONFIG=	${PREFIX}/share/examples/smb.conf.sample
SAMBA_LOGDIR=	/var/log
SAMBA_LOCKDIR=	/var/run/samba
SAMBA_ETCDIR?=	/etc/samba
SAMBA_PRIVATE?=	${SAMBA_ETCDIR}/private

MAKE_ENV+=	ETCDIR=${SAMBA_ETCDIR}
MAKE_ENV+=	LOGDIR=${SAMBA_LOGDIR}

CONFIGURE_ARGS+= --with-swatdir=${PREFIX}/share/swat \
	--with-lockdir=${SAMBA_LOCKDIR} \
	--with-privatedir=${SAMBA_PRIVATE}

PLIST_SRC= ${WRKDIR}/.PLIST-src

post-install:
	${MKDIR} ${PREFIX}/share/doc/samba/faq
	${MKDIR} ${PREFIX}/share/doc/samba/textdocs
	for i in ${WRKDIR}/${DISTNAME}/docs/NT4_PlainPassword.reg \
	    ${WRKDIR}/${DISTNAME}/docs/Win95_PlainPassword.reg \
	    ${WRKDIR}/${DISTNAME}/docs/THANKS ; do \
		${INSTALL_DATA} $$i ${PREFIX}/share/doc/samba; \
	done
	for i in ${WRKDIR}/${DISTNAME}/docs/faq/* ; do \
		${INSTALL_DATA} $$i ${PREFIX}/share/doc/samba/faq; \
	done
	for i in ${WRKDIR}/${DISTNAME}/docs/textdocs/* ; do \
		${INSTALL_DATA} $$i ${PREFIX}/share/doc/samba/textdocs; \
	done
	@${ECHO} "Installing ${STARTUP_SCRIPT} startup file.";          \
	${ECHO} '#!/bin/sh' > ${STARTUP_SCRIPT};                        \
	${ECHO} 'smbd=${PREFIX}/sbin/smbd' >> ${STARTUP_SCRIPT};        \
	${ECHO} 'nmbd=${PREFIX}/sbin/nmbd' >> ${STARTUP_SCRIPT};        \
	${ECHO} 'if [ -f $$smbd ]; then' >> ${STARTUP_SCRIPT};          \
	${ECHO} "       ${ECHO} -n ' Samba'" >> ${STARTUP_SCRIPT};      \
	${ECHO} '       $$smbd -D' >> ${STARTUP_SCRIPT};                \
	${ECHO} '       $$nmbd -D' >> ${STARTUP_SCRIPT};                \
	${ECHO} "fi" >> ${STARTUP_SCRIPT};                              \
	${CHMOD} 755 ${STARTUP_SCRIPT};                                 \
	${CHOWN} ${BINOWN}:${BINGRP} ${STARTUP_SCRIPT};
	@if [ ! -f ${SAMPLE_CONFIG} ]; then                             \
		${SED} -e 's:__LOGDIR__:${SAMBA_LOGDIR}:g'              \
		-e 's:__ETCDIR__:${SAMBA_ETCDIR}:g'			\
		-e 's:__PREFIX__:${PREFIX}:g'				\
			${FILESDIR}/smb.conf.sample                     \
			> ${SAMPLE_CONFIG} ;                            \
	fi
	${INSTALL_SCRIPT} ${WRKSRC}/script/mksmbpasswd.sh ${PREFIX}/bin
	if [ ! -d ${SAMBA_PRIVATE} ] ; then				\
		${MKDIR} ${SAMBA_PRIVATE} ;				\
		${CHOWN} root:${BINGRP} ${SAMBA_PRIVATE} ;		\
		${CHMOD} 700 ${SAMBA_PRIVATE} ;				\
	fi
	if [ ! -f ${SAMBA_PRIVATE}/smbpasswd ] ; then                   \
		${CAT} /etc/passwd | ${PREFIX}/bin/mksmbpasswd.sh	\
			> ${SAMBA_PRIVATE}/smbpasswd ;			\
		${CHMOD} 600 ${SAMBA_PRIVATE}/smbpasswd ;                  \
	fi
	${SED} -e 's:__SAMBA_PRIVATE__:${SAMBA_PRIVATE}:g' ${PKGDIR}/PLIST \
		> ${PLIST_SRC}

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