From owner-freebsd-ports-bugs@FreeBSD.ORG Fri Dec 8 16:54:07 2006 Return-Path: X-Original-To: freebsd-ports-bugs@freebsd.org Delivered-To: freebsd-ports-bugs@freebsd.org Received: from mx1.FreeBSD.org (mx1.freebsd.org [69.147.83.52]) by hub.freebsd.org (Postfix) with ESMTP id 3C06716A4A0; Fri, 8 Dec 2006 16:54:07 +0000 (UTC) (envelope-from timur@com.bat.ru) Received: from mail.bat.ru (dzokonda.xs4all.nl [194.109.164.75]) by mx1.FreeBSD.org (Postfix) with ESMTP id 0F85A43CA3; Fri, 8 Dec 2006 16:53:06 +0000 (GMT) (envelope-from timur@com.bat.ru) Received: from timur.home.bat.ru ([192.168.0.4] verified) by mail.bat.ru (CommuniGate Pro SMTP 4.2.7) with ESMTP-TLS id 1391777; Fri, 08 Dec 2006 17:54:35 +0100 Received: (from timur@localhost) by timur.home.bat.ru (8.13.6/8.13.6/Submit) id kB8Gs3KV011297; Fri, 8 Dec 2006 17:54:03 +0100 (CET) (envelope-from timur) Date: Fri, 8 Dec 2006 17:54:03 +0100 From: "Timur I. Bakeyev" To: Shaun Amott Message-ID: <20061208165403.GB2084@com.bat.ru> References: <200612071500.kB7F0JnG055175@freefall.freebsd.org> MIME-Version: 1.0 Content-Type: multipart/mixed; boundary="VbJkn9YxBvnuCH5J" Content-Disposition: inline In-Reply-To: <200612071500.kB7F0JnG055175@freefall.freebsd.org> User-Agent: mutt-ng/devel-r804 (FreeBSD) Cc: freebsd-ports-bugs@FreeBSD.org, "Rashid N. Achilov" , timur@gnu.org Subject: Re: ports/106436: Samba startup script uses old PID files naming scheme X-BeenThere: freebsd-ports-bugs@freebsd.org X-Mailman-Version: 2.1.5 Precedence: list List-Id: Ports bug reports List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Fri, 08 Dec 2006 16:54:07 -0000 --VbJkn9YxBvnuCH5J Content-Type: text/plain; charset=us-ascii Content-Disposition: inline Hi, Rashid! On Thu, Dec 07, 2006 at 03:00:19PM +0000, Shaun Amott wrote: > Synopsis: Samba startup script uses old PID files naming scheme Thanks a lot for your report and your patch. I'm really unpleasantly surprised by the silent change that was done to the PID naming schema in tne recent Samba version... > http://www.freebsd.org/cgi/query-pr.cgi?pr=106436 I'm attaching modified version of samba.in file, can you, please, test, that it works for you? Just place it in the files/ directory of the port and run: make apply-slist make install-rc-script in the port directory. That would perform necessary substitutions and will install rc scrypt in a proper place. Check, that it works with your configuration. With besy regards, Timur. --VbJkn9YxBvnuCH5J Content-Type: text/plain; charset=us-ascii Content-Disposition: attachment; filename="samba.in" #!/bin/sh # # $FreeBSD: ports/net/samba3/files/samba.in,v 1.4 2006/10/09 17:50:13 shaun Exp $ # # PROVIDE: nmbd smbd %%WINBIND%%# PROVIDE: winbindd # REQUIRE: NETWORKING SERVERS DAEMON ldconfig resolv %%CUPSD%%# REQUIRE: cupsd # BEFORE: LOGIN # KEYWORD: shutdown # # Add the following lines to /etc/rc.conf.local or /etc/rc.conf # to enable this service: # #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" # # Configuration file can be set with: #samba_config="%%SAMBA_CONFDIR%%/%%SAMBA_CONFIG%%" # . %%RC_SUBR%% name="samba" rcvar=$(set_rcvar) load_rc_config "${name}" # Custom commands extra_commands="reload status" start_precmd="samba_start_precmd" start_cmd="samba_cmd" stop_cmd="samba_cmd" status_cmd="samba_cmd" restart_precmd="samba_checkconfig" reload_precmd="samba_checkconfig" reload_cmd="samba_reload_cmd" rcvar_cmd="samba_rcvar_cmd" # Defaults samba_enable=${samba_enable:="NO"} samba_config_default="%%SAMBA_CONFDIR%%/%%SAMBA_CONFIG%%" samba_config="${samba_config=${samba_config_default}}" samba_daemons="nmbd smbd" %%WINBIND%%samba_daemons="${samba_daemons} winbindd" testparm_command="%%PREFIX%%/bin/testparm" smbcontrol_command="%%PREFIX%%/bin/smbcontrol" # Fetch parameters from configuration file samba_parm="${testparm_command} -s -v --parameter-name" %%WINBIND%%samba_idmap=$(${samba_parm} 'idmap uid' ${samba_config} 2>/dev/null) samba_lockdir=$(${samba_parm} 'lock directory' ${samba_config} 2>/dev/null) # Setup dependent variables if [ -n "${rcvar}" ] && checkyesno ${rcvar}; then nmbd_enable=${nmbd_enable="YES"} smbd_enable=${smbd_enable="YES"} %%WINBIND%% # Check that winbindd is actually configured %%WINBIND%% if [ -n "${samba_idmap}" ]; then %%WINBIND%% winbindd_enable=${winbindd_enable="YES"} %%WINBIND%% fi fi # Hack to work around name change of pid file with non-default config pid_extra= if [ "${samba_config}" != "${samba_config_default}" ]; then pid_extra="-$(basename "${samba_config}")" fi # Hack to enable check of dependent variables eval real_${rcvar}=\${${rcvar}:="NO"} ${rcvar}="YES" # Defaults for dependent variables nmbd_enable=${nmbd_enable:="NO"} nmbd_flags=${nmbd_flags="-D"} smbd_enable=${smbd_enable:="NO"} smbd_flags=${smbd_flags="-D"} %%WINBIND%%winbindd_enable=${winbindd_enable:="NO"} %%WINBIND%%winbindd_flags=${winbindd_flags=""} # Requirements required_files="${samba_config}" required_dirs="${samba_lockdir}" command_args="${samba_config:+"-s ${samba_config}"}" #" samba_checkconfig() { echo -n "Performing sanity check on Samba configuration: " if ${testparm_command} -s "${samba_config}" >/dev/null 2>&1; then echo "OK" else echo "FAILED" return 1 fi } samba_start_precmd() { # XXX: Never delete winbindd_idmap, winbindd_cache and group_mapping if [ -d "${samba_lockdir}" ]; then echo -n "Removing stale Samba tdb files: " for file in brlock.tdb browse.dat connections.tdb gencache.tdb \ locking.tdb messages.tdb namelist.debug sessionid.tdb \ unexpected.tdb do rm "${samba_lockdir}/${file}" /dev/null && echo -n '.' done echo " done" fi } samba_rcvar_cmd() { # Prevent recursive calling unset ${rc_arg}_cmd ${rc_arg}_precmd ${rc_arg}_postcmd # Check master variable echo "# ${name}" if [ -n "${rcvar}" ]; then # Use original configured value if checkyesno "real_${rcvar}"; then echo "\$${rcvar}=YES" else echo "\$${rcvar}=NO" fi fi # Check dependent variables samba_cmd "${_rc_prefix}${rc_arg}" ${rc_extra_args} } samba_reload_cmd() { local name rcvar # Prevent recursive calling unset ${rc_arg}_cmd ${rc_arg}_precmd ${rc_arg}_postcmd # Apply to all the daemons for name in ${samba_daemons}; do rcvar=$(set_rcvar) command="%%PREFIX%%/sbin/${name}" pidfile="%%SAMBA_RUNDIR%%/${name}${pid_extra}.pid" # Daemon should be enabled and running if [ -n "${rcvar}" ] && checkyesno ${rcvar}; then if [ -n "$(check_pidfile "${pidfile}" "${command}")" ]; then debug "reloading ${name} configuration" echo "Reloading ${name}." ${smbcontrol_command} "${name}" 'reload-config' ${command_args} fi fi done } samba_cmd() { local name rcvar # Prevent recursive calling unset ${rc_arg}_cmd ${rc_arg}_precmd ${rc_arg}_postcmd # Stop processes in the reverse to order if [ "${rc_arg}" = "stop" ] ; then samba_daemons=$(reverse_list ${samba_daemons}) fi # Apply to all the daemons for name in ${samba_daemons}; do rcvar=$(set_rcvar) command="%%PREFIX%%/sbin/${name}" pidfile="%%SAMBA_RUNDIR%%/${name}${pid_extra}.pid" run_rc_command "${_rc_prefix}${rc_arg}" ${rc_extra_args} done } run_rc_command "$1" --VbJkn9YxBvnuCH5J--