diff options
Diffstat (limited to 'net/samba3/files/samba.in')
-rw-r--r-- | net/samba3/files/samba.in | 107 |
1 files changed, 107 insertions, 0 deletions
diff --git a/net/samba3/files/samba.in b/net/samba3/files/samba.in new file mode 100644 index 00000000000..1f5a1c1a5d0 --- /dev/null +++ b/net/samba3/files/samba.in @@ -0,0 +1,107 @@ +#!/bin/sh +# +# $FreeBSD$ +# + +# PROVIDE: nmbd smbd +%%WINBIND%%# PROVIDE: winbindd +# REQUIRE: NETWORKING SERVERS DAEMON ldconfig resolv %%CUPSD%% +# BEFORE: LOGIN +# KEYWORD: shutdown + +# +# Add the following lines to /etc/rc.conf to enable samba: +# +#samba_enable="YES" +# +# or, for fine grain control +# +#nmbd_enable="YES" +#smbd_enable="YES" +%%WINBIND%%# You need to enable winbindd separately, by adding: +%%WINBIND%%#winbindd_enable="YES" +# + +. %%RC_SUBR%% + +name=samba +rcvar=`set_rcvar` + +load_rc_config $name +# Set defaults +samba_config=${samba_config="%%SAMBA_CONFIG%%"} +# Config file is required +if [ ! -r ${samba_config} ]; then + warn "${samba_config} is not readable." + case $1 in + force*) : ;; + *) exit 1 ;; + esac +fi + +if test -n ${samba_enable=""} && checkyesno samba_enable; then + nmbd_enable=${nmbd_enable="YES"} + smbd_enable=${smbd_enable="YES"} +%%WINBIND%% # Check that winbind is actually configured +%%WINBIND%% if [ "`egrep -i '(idmap.*uid|winbind.*uid)' ${samba_config} 2>/dev/null | egrep -v [\#\;]`" ]; then +%%WINBIND%% winbindd_enable="YES" +%%WINBIND%% fi +fi + +nmbd_precmd() { + # XXX: Never delete winbindd_idmap, winbindd_cache and group_mapping + if [ -d "%%SAMBA_LOCKDIR%%" ]; then + echo "Starting SAMBA: removing stale tdbs :" + for file in connections.tdb messages.tdb sessionid.tdb \ + unexpected.tdb brlock.tdb locking.tdb namelist.debug + do + rm -vf "%%SAMBA_LOCKDIR%%/$file" + done + fi +} + +# nmbd +name=nmbd +rcvar=`set_rcvar` +command="%%PREFIX%%/sbin/${name}" +required_dirs="%%SAMBA_LOCKDIR%%" +pidfile=%%SAMBA_RUNDIR%%/${name}.pid +start_precmd="nmbd_precmd" +# Defaults +nmbd_enable=${nmbd_enable="NO"} +nmbd_flags=${nmbd_flags="-D"} +command_args="-s ${samba_config}" + +load_rc_config $name +run_rc_command "$1" +_rc_restart_done=false + +# smbd +name=smbd +rcvar=`set_rcvar` +command="%%PREFIX%%/sbin/${name}" +pidfile=%%SAMBA_RUNDIR%%/${name}.pid +start_precmd=":" +# Defaults +smbd_enable=${smbd_enable="NO"} +smbd_flags=${smbd_flags="-D"} +command_args="-s ${samba_config}" + +load_rc_config $name +run_rc_command "$1" +%%WINBIND%%_rc_restart_done=false +%%WINBIND%% +%%WINBIND%%# winbindd +%%WINBIND%%name=winbindd +%%WINBIND%%rcvar=`set_rcvar` +%%WINBIND%%command="%%PREFIX%%/sbin/${name}" +%%WINBIND%%required_dirs="%%SAMBA_LOCKDIR%%" +%%WINBIND%%pidfile=%%SAMBA_RUNDIR%%/${name}.pid +%%WINBIND%%start_precmd=":" +%%WINBIND%%# Defaults +%%WINBIND%%winbindd_enable=${winbindd_enable="NO"} +%%WINBIND%%winbindd_flags=${winbindd_flags=""} +%%WINBIND%%command_args="-s ${samba_config}" +%%WINBIND%% +%%WINBIND%%load_rc_config $name +%%WINBIND%%run_rc_command "$1" |