samba: wsdd started and stopped when samba started or stopped

Message ID 20240229140937.15643-1-adolf.belka@ipfire.org
State Superseded
Headers
Series samba: wsdd started and stopped when samba started or stopped |

Commit Message

Adolf Belka Feb. 29, 2024, 2:09 p.m. UTC
  - Add wsdd as a dependency to samba so it will be installed together with samba
- Add the starting and stopping of wsdd into the samba initscript

Tested-by: Adolf Belka <adolf.belka@ipfire.org>
Signed-off-by: Adolf Belka <adolf.belka@ipfire.org>
---
 lfs/samba                      | 4 ++--
 src/initscripts/packages/samba | 6 +++++-
 2 files changed, 7 insertions(+), 3 deletions(-)
  

Comments

Michael Tremer March 1, 2024, 4:17 p.m. UTC | #1
Hello,

Hmm, I am not sure whether this change is too confusing…

We normally don’t call one initscript from another one (at least I am not aware).

Would it not be better if we have a check in the wsdd initscript and skip launching the daemon if samba isn’t running? Or should we simply throw away the wsdd initscript and launch the daemon in the samba initscript?

Those options feel slightly cleaner to me. But since I lost the ball on this so badly, maybe I am overlooking the reason why you solved it this way.

-Michael

> On 29 Feb 2024, at 15:09, Adolf Belka <adolf.belka@ipfire.org> wrote:
> 
> - Add wsdd as a dependency to samba so it will be installed together with samba
> - Add the starting and stopping of wsdd into the samba initscript
> 
> Tested-by: Adolf Belka <adolf.belka@ipfire.org>
> Signed-off-by: Adolf Belka <adolf.belka@ipfire.org>
> ---
> lfs/samba                      | 4 ++--
> src/initscripts/packages/samba | 6 +++++-
> 2 files changed, 7 insertions(+), 3 deletions(-)
> 
> diff --git a/lfs/samba b/lfs/samba
> index 76088abfa..df7811313 100644
> --- a/lfs/samba
> +++ b/lfs/samba
> @@ -33,9 +33,9 @@ DL_FROM    = $(URL_IPFIRE)
> DIR_APP    = $(DIR_SRC)/$(THISAPP)
> TARGET     = $(DIR_INFO)/$(THISAPP)
> PROG       = samba
> -PAK_VER    = 99
> +PAK_VER    = 100
> 
> -DEPS       = avahi cups perl-Parse-Yapp perl-JSON
> +DEPS       = avahi cups perl-Parse-Yapp perl-JSON wsdd
> 
> SERVICES   = samba
> 
> diff --git a/src/initscripts/packages/samba b/src/initscripts/packages/samba
> index 93f14cd29..99b9929cf 100644
> --- a/src/initscripts/packages/samba
> +++ b/src/initscripts/packages/samba
> @@ -42,6 +42,8 @@ case "$1" in
> 
> boot_mesg "Starting winbind..."
> loadproc /usr/sbin/winbindd
> + 
> + /etc/rc.d/init.d/wsdd start
> ;;
> 
> stop)
> @@ -53,7 +55,9 @@ case "$1" in
> 
> boot_mesg "Stopping winbind..."
> killproc /usr/sbin/winbindd
> -                ;;
> + 
> + /etc/rc.d/init.d/wsdd stop
> +              ;;
> 
> reload)
> boot_mesg "Reloading smbd..."
> -- 
> 2.44.0
>
  
Adolf Belka March 1, 2024, 5:13 p.m. UTC | #2
Hi Michael,

On 01/03/2024 17:17, Michael Tremer wrote:
> Hello,
> 
> Hmm, I am not sure whether this change is too confusing…
> 
> We normally don’t call one initscript from another one (at least I am not aware).
> 
> Would it not be better if we have a check in the wsdd initscript and skip launching the daemon if samba isn’t running? Or should we simply throw away the wsdd initscript and launch the daemon in the samba initscript?
> 
> Those options feel slightly cleaner to me. But since I lost the ball on this so badly, maybe I am overlooking the reason why you solved it this way.

I did think about putting the wsdd initscript start, stop & status 
options into the samba initscript but thought that would make the samba 
initscript much more complicated and if samba ends up adding the wsdd 
functionality into itself then we would have to clear it out of the 
samba initscript.

However, I also thought it was a bit clunky to call an initscript from 
another initscript.

I think the first option of skipping launching the wsdd daemon if samba 
isn't running wouldn't work so well if samba was then restarted because 
wsdd would then be stopped and would not get started. Daniel was looking 
at the situation of stopping the samba daemon and then modifying the 
workgroup name and then restarting samba. If wsdd is not also re-started 
then it will still have the old workgroup name and will not function 
correctly until it is also restarted.

I think after your feedback, and thinking more about it, that adding the 
wsdd start, stop & status functions directly into the samba initscript, 
together with the ARGs etc functions, makes the most sense.

I would also remove the service option from wsdd lfs file so that it 
does not get shown in the Addon Services page as it will no longer have 
its own initscript. So you would only ever see the samba service as 
being running or not. wsdd would be similar to

I will do a v2 version of the change and re-submit.

Regards,

Adolf.

> 
> -Michael
> 
>> On 29 Feb 2024, at 15:09, Adolf Belka <adolf.belka@ipfire.org> wrote:
>>
>> - Add wsdd as a dependency to samba so it will be installed together with samba
>> - Add the starting and stopping of wsdd into the samba initscript
>>
>> Tested-by: Adolf Belka <adolf.belka@ipfire.org>
>> Signed-off-by: Adolf Belka <adolf.belka@ipfire.org>
>> ---
>> lfs/samba                      | 4 ++--
>> src/initscripts/packages/samba | 6 +++++-
>> 2 files changed, 7 insertions(+), 3 deletions(-)
>>
>> diff --git a/lfs/samba b/lfs/samba
>> index 76088abfa..df7811313 100644
>> --- a/lfs/samba
>> +++ b/lfs/samba
>> @@ -33,9 +33,9 @@ DL_FROM    = $(URL_IPFIRE)
>> DIR_APP    = $(DIR_SRC)/$(THISAPP)
>> TARGET     = $(DIR_INFO)/$(THISAPP)
>> PROG       = samba
>> -PAK_VER    = 99
>> +PAK_VER    = 100
>>
>> -DEPS       = avahi cups perl-Parse-Yapp perl-JSON
>> +DEPS       = avahi cups perl-Parse-Yapp perl-JSON wsdd
>>
>> SERVICES   = samba
>>
>> diff --git a/src/initscripts/packages/samba b/src/initscripts/packages/samba
>> index 93f14cd29..99b9929cf 100644
>> --- a/src/initscripts/packages/samba
>> +++ b/src/initscripts/packages/samba
>> @@ -42,6 +42,8 @@ case "$1" in
>>
>> boot_mesg "Starting winbind..."
>> loadproc /usr/sbin/winbindd
>> +
>> + /etc/rc.d/init.d/wsdd start
>> ;;
>>
>> stop)
>> @@ -53,7 +55,9 @@ case "$1" in
>>
>> boot_mesg "Stopping winbind..."
>> killproc /usr/sbin/winbindd
>> -                ;;
>> +
>> + /etc/rc.d/init.d/wsdd stop
>> +              ;;
>>
>> reload)
>> boot_mesg "Reloading smbd..."
>> -- 
>> 2.44.0
>>
>
  

Patch

diff --git a/lfs/samba b/lfs/samba
index 76088abfa..df7811313 100644
--- a/lfs/samba
+++ b/lfs/samba
@@ -33,9 +33,9 @@  DL_FROM    = $(URL_IPFIRE)
 DIR_APP    = $(DIR_SRC)/$(THISAPP)
 TARGET     = $(DIR_INFO)/$(THISAPP)
 PROG       = samba
-PAK_VER    = 99
+PAK_VER    = 100
 
-DEPS       = avahi cups perl-Parse-Yapp perl-JSON
+DEPS       = avahi cups perl-Parse-Yapp perl-JSON wsdd
 
 SERVICES   = samba
 
diff --git a/src/initscripts/packages/samba b/src/initscripts/packages/samba
index 93f14cd29..99b9929cf 100644
--- a/src/initscripts/packages/samba
+++ b/src/initscripts/packages/samba
@@ -42,6 +42,8 @@  case "$1" in
 
 		boot_mesg "Starting winbind..."
 		loadproc /usr/sbin/winbindd
+		
+		/etc/rc.d/init.d/wsdd start
 		;;
 
 	stop)
@@ -53,7 +55,9 @@  case "$1" in
 
 		boot_mesg "Stopping winbind..."
 		killproc /usr/sbin/winbindd
-                ;;
+		
+		/etc/rc.d/init.d/wsdd stop
+              ;;
 
 	reload)
 		boot_mesg "Reloading smbd..."