From 49fc35e69eacebb0a0a39ea7420b73535516be56 Mon Sep 17 00:00:00 2001 From: Daniel Berteaud Date: Tue, 20 Mar 2018 17:36:56 +0100 Subject: [PATCH] Add samba.service unit in samba-dc package --- samba.service | 16 ++++++++++++++++ samba.spec | 15 +++++++++++++++ 2 files changed, 31 insertions(+) create mode 100644 samba.service diff --git a/samba.service b/samba.service new file mode 100644 index 0000000..50add6e --- /dev/null +++ b/samba.service @@ -0,0 +1,16 @@ +[Unit] +Description=Samba AD Daemon +After=syslog.target network.target + +[Service] +Environment=KRB5CCNAME=FILE:/run/samba/krb5cc_samba +Type=notify +NotifyAccess=all +PIDFile=/run/samba.pid +LimitNOFILE=16384 +EnvironmentFile=-/etc/sysconfig/samba +ExecStart=/usr/sbin/samba --foreground --no-process-group $SAMBAOPTIONS +ExecReload=/usr/bin/kill -HUP $MAINPID + +[Install] +WantedBy=multi-user.target diff --git a/samba.spec b/samba.spec index 13adfdb..c729192 100644 --- a/samba.spec +++ b/samba.spec @@ -99,6 +99,9 @@ Source0: samba-%{version}%{pre_release}.tar.gz Source1: samba-%{version}%{pre_release}.tar.asc Source2: gpgkey-52FBC0B86D954B0843324CDC6F33915B6568B7EA.gpg +# For DC +Source3: samba.service + # Red Hat specific replacement-files Source10: samba.log Source11: smb.conf.vendor @@ -866,6 +869,8 @@ install -m 0644 %{SOURCE201} packaging/README.downgrade %if ! %with_dc install -m 0644 %{SOURCE200} packaging/README.dc install -m 0644 %{SOURCE200} packaging/README.dc-libs +%else +install -m 0644 %{SOURCE3} %{buildroot}%{_unitdir}/samba.service %endif install -d -m 0755 %{buildroot}%{_unitdir} @@ -949,7 +954,17 @@ fi %if %with_dc %post dc-libs -p /sbin/ldconfig + %postun dc-libs -p /sbin/ldconfig + +%post dc +%systemd_post samba.service + +%preun dc +%systemd_preun samba.service + +%postun dc +%systemd_postun_with_restart samba.service %endif %post krb5-printing