Gentoo Websites Logo
Go to: Gentoo Home Documentation Forums Lists Bugs Planet Store Wiki Get Gentoo!

Bug 433074

Summary: net-fs/samba: add systemd unit
Product: Gentoo Linux Reporter: RedEyedMan <kegalym2>
Component: [OLD] ServerAssignee: Gentoo's SAMBA Team <samba>
Status: RESOLVED FIXED    
Severity: normal CC: alexander, nikoli, pacho
Priority: Normal    
Version: unspecified   
Hardware: All   
OS: Linux   
Whiteboard:
Package list:
Runtime testing required: ---
Bug Depends on:    
Bug Blocks: 448882, 468898    
Attachments: samba.service
nmbd.service
samba.service
samba-3.6.9.ebuild.patch
samba.confd.patch
windbd.service
smbd.service
nmbd.service
samba-3.6.12.ebuild.patch
samba.tmpfilesd
samba-3.6.12.ebuild.patch
net-fs/samba-3.6.12.ebuild
samba.confd
smbd.service
nmbd.service
winbind.service
samba-3.6.14-r1.ebuild.patch

Description RedEyedMan 2012-08-28 16:20:31 UTC
Please add systemd unit file for net-fs/samba.

Thanks for understanding.
Comment 1 RedEyedMan 2012-10-24 15:01:33 UTC
Created attachment 327298 [details]
samba.service

samba.service for systemd created by me.
Comment 2 RedEyedMan 2012-10-24 15:06:11 UTC
Created attachment 327300 [details]
nmbd.service

nmbd.service for systemd created by me.
Comment 3 RedEyedMan 2012-10-24 15:07:29 UTC
Created attachment 327302 [details]
samba.service

samba.service for systemd created by me.
Comment 4 Emery Hemingway 2013-02-01 19:09:04 UTC
Another way to do it is to create smbd.service, nmbd.service, winbind.service, and samba.target. samba.target can Require smbd.service and nmbd.service. If the user wants winbind, they can copy their samba target to /etc/systemd/system and add that to Require from there.

I don't know which way is better and I'm not sure what the systemd policy is on creating new targets.
Comment 5 Alexander Tsoy 2013-02-14 11:49:44 UTC
Created attachment 338852 [details, diff]
samba-3.6.9.ebuild.patch

systemd units already included in release tarball, so only ebuild and conf.d file modifications are needed.
Comment 6 Alexander Tsoy 2013-02-14 11:53:45 UTC
Created attachment 338854 [details, diff]
samba.confd.patch
Comment 7 Alexander Tsoy 2013-02-14 11:56:20 UTC
(In reply to comment #6)
> Created attachment 338854 [details, diff] [details, diff]
> samba.confd.patch

This variables taken from "packaging/systemd/samba.sysconfig"
Comment 8 RedEyedMan 2013-02-15 18:15:31 UTC
Created attachment 339002 [details]
windbd.service
Comment 9 RedEyedMan 2013-02-15 18:18:05 UTC
Created attachment 339004 [details]
smbd.service
Comment 10 RedEyedMan 2013-02-15 18:19:32 UTC
Created attachment 339006 [details]
nmbd.service
Comment 11 Alexander Tsoy 2013-02-22 13:34:44 UTC
Created attachment 339696 [details, diff]
samba-3.6.12.ebuild.patch

Updated patch:
- also change location of PID files, otherwise services won't start
- install winbind.service only if USE=winbind

There is still an issue:
"/var/run/samba" should be created by tmpfiles.d. Another way is to migrate to "/run".

And maybe variables names should be unified between initscripts and units?
Comment 12 Alexander Tsoy 2013-02-22 21:26:14 UTC
Created attachment 339748 [details]
samba.tmpfilesd
Comment 13 Alexander Tsoy 2013-02-22 21:37:48 UTC
Created attachment 339752 [details, diff]
samba-3.6.12.ebuild.patch

- install tmpfiles.d config
Comment 14 RedEyedMan 2013-02-24 17:02:58 UTC
Created attachment 339980 [details]
net-fs/samba-3.6.12.ebuild

Patched with above samba-3.6.12.ebuild.patch
Comment 15 RedEyedMan 2013-02-24 17:13:58 UTC
Created attachment 339982 [details]
samba.confd

Patched with above samba.confd.patch
Comment 16 RedEyedMan 2013-02-26 01:15:49 UTC
Created attachment 340122 [details]
smbd.service

smbd.service  with PIDFile=/var/run/samba due to ebuild
Comment 17 RedEyedMan 2013-02-26 01:17:02 UTC
Created attachment 340124 [details]
nmbd.service

nmbd.service  with PIDFile=/var/run/samba due to ebuild
Comment 18 RedEyedMan 2013-02-26 01:19:16 UTC
Created attachment 340126 [details]
winbind.service

winbind.service  with PIDFile=/var/run/samba due to ebuild
Comment 19 Alexander Tsoy 2013-05-13 14:43:32 UTC
Created attachment 348164 [details, diff]
samba-3.6.14-r1.ebuild.patch

Drop EnvironmentFile option from units. Using distro-cpecific env files is not recommended [1] [2]. Use /etc/systemd/system/{smb,nmb,winbind}.service.d/*.conf files for that purpose.

[1]: https://bugs.gentoo.org/show_bug.cgi?id=459372#c3
[2]: https://fedoraproject.org/wiki/Features/Systemd-unit-cleanup
Comment 20 Pacho Ramos gentoo-dev 2013-07-05 16:57:18 UTC
I would take changes from:
https://github.com/Sabayon/systemd-love/tree/master/net-fs/samba

I will commit in a week if nobody disagrees. Thanks
Comment 21 Pacho Ramos gentoo-dev 2013-07-13 11:21:28 UTC
+  13 Jul 2013; Pacho Ramos <pacho@gentoo.org> +files/nmbd.service,
+  +files/samba.conf, +files/smbd.service, +files/smbd.socket,
+  +files/smbd_at.service, +files/winbindd.service, samba-3.6.16.ebuild,
+  samba-4.0.7.ebuild:
+  Install unit file (#433074)
+