Add rc scripts.

While here, fix the LOCALBASE vs PREFIX and SYSCONFDIR vs /etc mess.

ok robert@
This commit is contained in:
ajacoutot 2011-01-17 17:58:03 +00:00
parent 0d38a0464a
commit 242a7d4483
8 changed files with 118 additions and 33 deletions

View File

@ -1,4 +1,4 @@
# $OpenBSD: Makefile,v 1.131 2010/12/06 19:41:54 ajacoutot Exp $
# $OpenBSD: Makefile,v 1.132 2011/01/17 17:58:03 ajacoutot Exp $
SHARED_ONLY= Yes
@ -7,7 +7,7 @@ COMMENT-docs= additional documentation and examples for Samba
DISTNAME= samba-3.5.6
PKGNAME-main= ${DISTNAME}
REVISION-main = 3
REVISION-main = 4
FULLPKGNAME-docs= ${DISTNAME:S/-/-docs-/}
FULLPKGPATH-docs= net/samba,-docs
SHARED_LIBS= smbclient 2.0 \

View File

@ -1,4 +1,2 @@
!!! ATTENTION !!!
The default passdb backend has been changed to 'tdbsam'!
See the ${LOCALBASE}/share/doc/pkg-readmes/${FULLPKGNAME} file for
more information.

View File

@ -1,4 +1,4 @@
@comment $OpenBSD: PLIST-main,v 1.14 2010/10/29 09:40:41 espie Exp $
@comment $OpenBSD: PLIST-main,v 1.15 2011/01/17 17:58:04 ajacoutot Exp $
@conflict samba-docs-<=3.5.0
@pkgpath ${BASE_PKGPATH}
@bin bin/eventlogadm
@ -206,3 +206,7 @@ share/swat/include/footer.html
share/swat/include/header.html
@sample /var/log/samba/
@sample /var/spool/samba/
@rcscript ${RCDIR}/nmbd
@rcscript ${RCDIR}/samba
@rcscript ${RCDIR}/smbd
@rcscript ${RCDIR}/winbindd

View File

@ -1,42 +1,22 @@
$OpenBSD: README-main,v 1.3 2010/11/06 07:56:48 ajacoutot Exp $
$OpenBSD: README-main,v 1.4 2011/01/17 17:58:04 ajacoutot Exp $
Using samba package in an OpenBSD environment:
1. Edit ${SYSCONFDIR}/samba/smb.conf to suit your needs.
2. Edit /etc/rc.conf.local:
...
smbd_flags="-D" # for normal use: "-D"
nmbd_flags="-D" # for normal use: "-D"
...
3. Edit /etc/rc.local:
echo -n 'starting local daemons:'
...
if [ -f ${SYSCONFDIR}/samba/smb.conf ]; then
if [ X"${smbd_flags}" != X"NO" -a -x ${LOCALBASE}/libexec/smbd ]; then
echo -n ' smbd'; ${LOCALBASE}/libexec/smbd ${smbd_flags}
fi
if [ X"${nmbd_flags}" != X"NO" -a -x ${LOCALBASE}/libexec/nmbd ]; then
echo -n ' nmbd'; ${LOCALBASE}/libexec/nmbd ${nmbd_flags}
fi
fi
...
echo '.'
Steps 4 and 5 are only necessary if you want to enable swat (Samba
Steps 2 and 3 are only necessary if you want to enable swat (Samba
Web Administration Tool). Please note that administering the server
with swat over a network is inadvisable as passwords are passed in
the clear. You can avoid this problem by using ssh forwarding to
port 901.
4. add the following entry to /etc/inetd.conf:
2. add the following entry to /etc/inetd.conf:
...
swat stream tcp nowait.400 root ${LOCALBASE}/libexec/swat swat
swat stream tcp nowait.400 root ${TRUEPREFIX}/libexec/swat swat
...
5. add the following entry to /etc/services:
3. add the following entry to /etc/services:
...
swat 901/tcp # samba admin service
@ -75,12 +55,12 @@ An EXPERIMENTAL implementation of the SMB2 protocol has been added.
SMB2 can be enabled by setting "max protocol = smb2". SMB2 is a new
implementation of the SMB protocol used by Windows Vista and higher.
To use Samba as a PDC the values of openfiles-max in ${SYSCONFDIR}/login.conf
To use Samba as a PDC the values of openfiles-max in /etc/login.conf
and kern.maxfiles should be increased to 16384.
Rebuild the login.conf.db file if necessary:
# cap_mkdb ${SYSCONFDIR}/login.conf
# cap_mkdb /etc/login.conf
Don't forget to add the entry kern.maxfiles=16384 to the ${SYSCONFDIR}/sysctl.conf
Don't forget to add the entry kern.maxfiles=16384 to the /etc/sysctl.conf
file to keep the change across reboots.

24
net/samba/pkg/nmbd.rc Normal file
View File

@ -0,0 +1,24 @@
#!/bin/sh
#
# $OpenBSD: nmbd.rc,v 1.1 2011/01/17 17:58:04 ajacoutot Exp $
daemon="/usr/local/libexec/nmbd"
daemon_flags="-D"
. /etc/rc.d/rc.subr
smbcontrol="${TRUEPREFIX}/bin/smbcontrol"
rc_check() {
${smbcontrol} nmbd ping >/dev/null 2>&1
}
rc_reload() {
${smbcontrol} nmbd reload-config
}
rc_stop() {
${smbcontrol} nmbd shutdown 2>/dev/null
}
rc_cmd $1

31
net/samba/pkg/samba.rc Normal file
View File

@ -0,0 +1,31 @@
#!/bin/sh
#
# $OpenBSD: samba.rc,v 1.1 2011/01/17 17:58:04 ajacoutot Exp $
daemon="/bin/true"
. /etc/rc.d/rc.subr
_samba_daemons="smbd nmbd"
rc_start() {
for i in ${_samba_daemons}; do /etc/rc.d/$i start; done
}
rc_check() {
for i in ${_samba_daemons}; do /etc/rc.d/$i check || return; done
}
rc_reload() {
for i in ${_samba_daemons}; do /etc/rc.d/$i reload; done
}
rc_stop() {
set -A _s -- ${_samba_daemons}
_s="${_s[1]} ${_s[0]}"
for i in ${_s}; do
/etc/rc.d/$i stop
done
}
rc_cmd $1

24
net/samba/pkg/smbd.rc Normal file
View File

@ -0,0 +1,24 @@
#!/bin/sh
#
# $OpenBSD: smbd.rc,v 1.1 2011/01/17 17:58:04 ajacoutot Exp $
daemon="/usr/local/libexec/smbd"
daemon_flags="-D"
. /etc/rc.d/rc.subr
smbcontrol="${TRUEPREFIX}/bin/smbcontrol"
rc_check() {
${smbcontrol} smbd ping >/dev/null 2>&1
}
rc_reload() {
${smbcontrol} smbd reload-config
}
rc_stop() {
${smbcontrol} smbd shutdown 2>/dev/null
}
rc_cmd $1

24
net/samba/pkg/winbindd.rc Normal file
View File

@ -0,0 +1,24 @@
#!/bin/sh
#
# $OpenBSD: winbindd.rc,v 1.1 2011/01/17 17:58:04 ajacoutot Exp $
daemon="/usr/local/libexec/winbindd"
daemon_flags="-D"
. /etc/rc.d/rc.subr
smbcontrol="${TRUEPREFIX}/bin/smbcontrol"
rc_check() {
${smbcontrol} winbindd ping >/dev/null 2>&1
}
rc_reload() {
${smbcontrol} winbindd reload-config
}
rc_stop() {
${smbcontrol} winbindd shutdown 2>/dev/null
}
rc_cmd $1