| Summary: | net-fs/samba-3.0.25c init script doesn't work | ||
|---|---|---|---|
| Product: | Gentoo Linux | Reporter: | Napoleon <napoleonb> |
| Component: | New packages | Assignee: | Gentoo's SAMBA Team <samba> |
| Status: | RESOLVED FIXED | ||
| Severity: | normal | CC: | kristov, marek.bartosiewicz, nbensa, tomasz.chilinski |
| Priority: | High | ||
| Version: | unspecified | ||
| Hardware: | x86 | ||
| OS: | Linux | ||
| Whiteboard: | |||
| Package list: | Runtime testing required: | --- | |
|
Description
Napoleon
2007-09-08 02:05:00 UTC
Try to change code snippet in /etc/init.d/samba:
if [[ -n ${DAEMONNAME} ]] ; then
daemon_list=${DAEMONNAME}
fi
to:
if [[ -z ${DAEMONNAME} ]] ; then
daemon_list=${DAEMONNAME}
fi
Should resolve problem.
Bests, Tom.
Hello Tomasz,
you are right that your suggestion fixes the problem. However, it is not the right thing to do. As I understand it, the purpose of the code
DAEMONNAME="${SVCNAME##samba.}"
if [[ -n ${DAEMONNAME} ]] ; then
daemon_list=${DAEMONNAME}
fi
is to determine if someone wants a specific service to be stopped/started/whatever, i.e., if you link /etc/init.d/samba.smbd --> /etc/init.d/samba and then you call "/etc/init.d/samba.smbd start", DAEMONNAME will be set to "smbd". As DAEMONNAME is not empty now, daemon_list is set to DAEMONNAME, ignoring the value inherited from /etc/conf.d/samba (which typically contains all samba services).
The problem is that DAEMONNAME is *not* empty if /etc/init.d/samba is called -- it is the string "samba" instead. So the expression [[ -n ${DAEMONNAME} ]] *always* evaluates to true (as "samba" is not an empty string), and daemon_list is *always* set to "samba". The result is that nothing happens when starting and stopping, as there are no "samba_start" or "samba_stop" variables set in /etc/conf.d/samba.
So in my opinion, the correct fix to the problem described would be to replace the expression
[[ -n ${DAEMONNAME} ]]
by
[[ ${DAEMONNAME} != "samba" ]]
(By the way, this works for me!)
Perhaps there is a possibility to change the bash expression "${SVCNAME##samba.}" such that the result is empty if "samba." is not found as prefix (instead of being the string "samba"), but a quick look into bash's man page did not reveal a solution. However, I'm not a bash expert.
Regards,
Christoph
sorry, missed that one. Fixed in CVS. |