commit 613c6c5090fbecd42e0312683217d36b01692d91
Author: Jan RÄ™korajski <[email protected]>
Date:   Wed Jan 1 23:10:07 2014 +0100

    - make daemons start based on server role set in samba config

 samba.init        |  5 +++++
 server-role.patch | 31 +++++++++++++++++++++++++++++++
 smb.init          | 14 +++++++++++---
 3 files changed, 47 insertions(+), 3 deletions(-)
---
diff --git a/samba.init b/samba.init
index bec37c3..d4a9c02 100644
--- a/samba.init
+++ b/samba.init
@@ -29,6 +29,11 @@ fi
 TMPDIR="/tmp"; export TMPDIR
 unset TMP || :
 
+SERVER_ROLE=`samba-tool testparm --parameter-name="server role"  2>/dev/null | 
tail -1`
+if [ "$SERVER_ROLE" != "active directory domain controller" ]; then
+       exit 0
+fi
+
 start() {
        # Check if the service is already running?
        if [ -f /var/lock/subsys/samba ]; then
diff --git a/server-role.patch b/server-role.patch
new file mode 100644
index 0000000..8469230
--- /dev/null
+++ b/server-role.patch
@@ -0,0 +1,31 @@
+--- samba-4.1.3/packaging/systemd/smb.service.orig     2013-12-20 
19:15:20.885742895 +0100
++++ samba-4.1.3/packaging/systemd/smb.service  2014-01-01 16:33:29.280076263 
+0100
+@@ -7,6 +7,7 @@
+ PIDFile=/run/samba/smbd.pid
+ LimitNOFILE=16384
+ EnvironmentFile=-/etc/sysconfig/samba
++ExecStartPre=/bin/sh -c '[ "`samba-tool testparm --parameter-name="server 
role"  2>/dev/null | tail -1`" != "active directory domain controller" ]'
+ ExecStart=/usr/sbin/smbd $SMBDOPTIONS
+ ExecReload=/usr/bin/kill -HUP $MAINPID
+ 
+--- samba-4.1.3/packaging/systemd/nmb.service.orig     2013-12-20 
19:15:20.885742895 +0100
++++ samba-4.1.3/packaging/systemd/nmb.service  2014-01-01 16:38:17.089656135 
+0100
+@@ -6,6 +6,8 @@
+ Type=forking
+ PIDFile=/run/samba/nmbd.pid
+ EnvironmentFile=-/etc/sysconfig/samba
++ExecStartPre=/bin/sh -c '[ "`samba-tool testparm --parameter-name="server 
role"  2>/dev/null | tail -1`" != "active directory domain controller" ]'
++ExecStartPre=/bin/sh -c '[ "`testparm -s --parameter-name="disable netbios" 
2>/dev/null`" != "Yes" ]'
+ ExecStart=/usr/sbin/nmbd $NMBDOPTIONS
+ ExecReload=/usr/bin/kill -HUP $MAINPID
+ 
+--- samba-4.1.3/packaging/systemd/samba.service.orig   2014-01-01 
16:44:59.833724642 +0100
++++ samba-4.1.3/packaging/systemd/samba.service        2014-01-01 
16:45:17.763905567 +0100
+@@ -7,6 +7,7 @@
+ PIDFile=/run/samba/samba.pid
+ LimitNOFILE=16384
+ EnvironmentFile=-/etc/sysconfig/samba
++ExecStartPre=/bin/sh -c '[ "`samba-tool testparm --parameter-name="server 
role"  2>/dev/null | tail -1`" = "active directory domain controller" ]'
+ ExecStart=/usr/sbin/samba $SAMBAOPTIONS
+ ExecReload=/usr/bin/kill -HUP $MAINPID
+ 
diff --git a/smb.init b/smb.init
index d129f75..541d581 100644
--- a/smb.init
+++ b/smb.init
@@ -37,6 +37,11 @@ fi
 TMPDIR="/tmp"; export TMPDIR
 unset TMP || :
 
+SERVER_ROLE=`samba-tool testparm --parameter-name="server role"  2>/dev/null | 
tail -1`
+if [ "$SERVER_ROLE" = "active directory domain controller" ]; then
+       exit 0
+fi
+
 start() {
        # Check if the service is already running?
        if [ -f /var/lock/subsys/$lockname ]; then
@@ -47,9 +52,12 @@ start() {
        msg_starting "Samba SMB/CIFS Server"
        daemon /usr/sbin/smbd -D -s $CFGFILE
        RETVAL=$?
-       msg_starting "Samba NetBIOS Name Server"
-       daemon /usr/sbin/nmbd -D $CFGFILE
-       [ $RETVAL -eq 0 ] && RETVAL=$?
+       NMBD_DISABLED=`testparm -s --parameter-name='disable netbios' 
2>/dev/null`
+       if [ "$NMBD_DISABLED" != Yes ]; then
+               msg_starting "Samba NetBIOS Name Server"
+               daemon /usr/sbin/nmbd -D $CFGFILE
+               [ $RETVAL -eq 0 ] && RETVAL=$?
+       fi
        if [ $RETVAL -eq 0 ]; then
                touch /var/lock/subsys/$lockname
        fi
================================================================

---- gitweb:

http://git.pld-linux.org/gitweb.cgi/packages/samba4.git/commitdiff/362fec620dc87324067677990d41d0edd75dbbca

_______________________________________________
pld-cvs-commit mailing list
[email protected]
http://lists.pld-linux.org/mailman/listinfo/pld-cvs-commit

Reply via email to