summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorAndreas Schneider <asn@cryptomilk.org>2012-03-15 10:08:38 +0100
committerAndreas Schneider <asn@cryptomilk.org>2012-03-15 10:08:38 +0100
commit0c9809a754e5747df8f9f24adecc84b2ddcae0bb (patch)
treee34844be8f6ee887df5624ad0b6bb5a0b08890cf
parentd060f4187902cfe63f482c3c2fdb1ca116e8e599 (diff)
downloadsamba4-0c9809a754e5747df8f9f24adecc84b2ddcae0bb.tar.gz
samba4-0c9809a754e5747df8f9f24adecc84b2ddcae0bb.tar.xz
samba4-0c9809a754e5747df8f9f24adecc84b2ddcae0bb.zip
Add init scripts for RHEL 6.
-rw-r--r--nmb.init114
-rw-r--r--samba4.spec13
-rw-r--r--smb.init114
-rw-r--r--winbind.init102
4 files changed, 343 insertions, 0 deletions
diff --git a/nmb.init b/nmb.init
new file mode 100644
index 0000000..6234ff9
--- /dev/null
+++ b/nmb.init
@@ -0,0 +1,114 @@
+#!/bin/sh
+#
+# chkconfig: - 91 35
+# description: Starts and stops the Samba smbd and nmbd daemons \
+# used to provide SMB network services.
+#
+# pidfile: /var/run/samba/nmbd.pid
+# config: /etc/samba/smb.conf
+
+
+# Source function library.
+if [ -f /etc/init.d/functions ] ; then
+ . /etc/init.d/functions
+elif [ -f /etc/rc.d/init.d/functions ] ; then
+ . /etc/rc.d/init.d/functions
+else
+ exit 1
+fi
+
+# Avoid using root's TMPDIR
+unset TMPDIR
+
+# Source networking configuration.
+. /etc/sysconfig/network
+
+if [ -f /etc/sysconfig/samba ]; then
+ . /etc/sysconfig/samba
+fi
+
+# Check that networking is up.
+[ ${NETWORKING} = "no" ] && exit 1
+
+# Check that smb.conf exists.
+[ -f /etc/samba/smb.conf ] || exit 6
+
+RETVAL=0
+
+
+start() {
+ KIND="NMB"
+ echo -n $"Starting $KIND services: "
+ daemon nmbd $NMBDOPTIONS
+ RETVAL=$?
+ echo
+ [ $RETVAL -eq 0 ] && touch /var/lock/subsys/nmb || \
+ RETVAL=1
+ return $RETVAL
+}
+
+stop() {
+ KIND="NMB"
+ echo -n $"Shutting down $KIND services: "
+ killproc nmbd
+ RETVAL=$?
+ echo
+ [ $RETVAL -eq 0 ] && rm -f /var/lock/subsys/nmb
+ return $RETVAL
+}
+
+restart() {
+ stop
+ start
+}
+
+reload() {
+ echo -n $"Reloading smb.conf file: "
+ killproc nmbd -HUP
+ RETVAL=$?
+ echo
+ return $RETVAL
+}
+
+rhstatus() {
+ status -l nmb nmbd
+ return $?
+}
+
+
+# Allow status as non-root.
+if [ "$1" = status ]; then
+ rhstatus
+ exit $?
+fi
+
+# Check that we can write to it... so non-root users stop here
+[ -w /etc/samba/smb.conf ] || exit 4
+
+
+
+case "$1" in
+ start)
+ start
+ ;;
+ stop)
+ stop
+ ;;
+ restart)
+ restart
+ ;;
+ reload)
+ reload
+ ;;
+ status)
+ rhstatus
+ ;;
+ condrestart)
+ [ -f /var/lock/subsys/nmb ] && restart || :
+ ;;
+ *)
+ echo $"Usage: $0 {start|stop|restart|reload|status|condrestart}"
+ exit 2
+esac
+
+exit $?
diff --git a/samba4.spec b/samba4.spec
index f264c63..74e9884 100644
--- a/samba4.spec
+++ b/samba4.spec
@@ -52,6 +52,12 @@ Source5: pam_winbind.conf
Source6: samba.pamd
Source7: samba.conf.tmp
+%if 0%{?rhel} < 7
+Source100: nmb.init
+Source101: smb.init
+Source102: winbind.init
+%endif
+
Patch1: samba4-libpdb-soversion.patch
Patch2: samba4-samr-lsa-session_key.patch
@@ -418,6 +424,13 @@ install -m 0644 packaging/systemd/nmb.service %{buildroot}%{_unitdir}/nmb.servic
install -m 0644 packaging/systemd/smb.service %{buildroot}%{_unitdir}/smb.service
install -m 0644 packaging/systemd/winbind.service %{buildroot}%{_unitdir}/winbind.service
+%if 0%{?rhel} < 7
+install -d -m 0755 %{buildroot}%{_initrddir}
+install -m 0644 %{SOURCE100} %{buildroot}%{_initrddir}/nmb
+install -m 0644 %{SOURCE101} %{buildroot}%{_initrddir}/smb
+install -m 0644 %{SOURCE102} %{buildroot}%{_initrddir}/winbind
+%endif
+
# winbind krb5 locator
install -d -m 0755 %{buildroot}%{_libdir}/krb5/plugins/libkrb5
install -m 755 %{buildroot}/%{_libdir}/winbind_krb5_locator.so %{buildroot}/%{_libdir}/krb5/plugins/libkrb5/winbind_krb5_locator.so
diff --git a/smb.init b/smb.init
new file mode 100644
index 0000000..f9fec26
--- /dev/null
+++ b/smb.init
@@ -0,0 +1,114 @@
+#!/bin/sh
+#
+# chkconfig: - 91 35
+# description: Starts and stops the Samba smbd daemon \
+# used to provide SMB network services.
+#
+# pidfile: /var/run/samba/smbd.pid
+# config: /etc/samba/smb.conf
+
+
+# Source function library.
+if [ -f /etc/init.d/functions ] ; then
+ . /etc/init.d/functions
+elif [ -f /etc/rc.d/init.d/functions ] ; then
+ . /etc/rc.d/init.d/functions
+else
+ exit 1
+fi
+
+# Avoid using root's TMPDIR
+unset TMPDIR
+
+# Source networking configuration.
+. /etc/sysconfig/network
+
+if [ -f /etc/sysconfig/samba ]; then
+ . /etc/sysconfig/samba
+fi
+
+# Check that networking is up.
+[ ${NETWORKING} = "no" ] && exit 1
+
+# Check that smb.conf exists.
+[ -f /etc/samba/smb.conf ] || exit 6
+
+RETVAL=0
+
+
+start() {
+ KIND="SMB"
+ echo -n $"Starting $KIND services: "
+ daemon smbd $SMBDOPTIONS
+ RETVAL=$?
+ echo
+ [ $RETVAL -eq 0 ] && touch /var/lock/subsys/smb || \
+ RETVAL=1
+ return $RETVAL
+}
+
+stop() {
+ KIND="SMB"
+ echo -n $"Shutting down $KIND services: "
+ killproc smbd
+ RETVAL=$?
+ echo
+ [ $RETVAL -eq 0 ] && rm -f /var/lock/subsys/smb
+ return $RETVAL
+}
+
+restart() {
+ stop
+ start
+}
+
+reload() {
+ echo -n $"Reloading smb.conf file: "
+ killproc smbd -HUP
+ RETVAL=$?
+ echo
+ return $RETVAL
+}
+
+rhstatus() {
+ status -l smb smbd
+ return $?
+}
+
+
+# Allow status as non-root.
+if [ "$1" = status ]; then
+ rhstatus
+ exit $?
+fi
+
+# Check that we can write to it... so non-root users stop here
+[ -w /etc/samba/smb.conf ] || exit 4
+
+
+
+case "$1" in
+ start)
+ start
+ ;;
+ stop)
+ stop
+ ;;
+ restart)
+ restart
+ ;;
+ reload)
+ reload
+ ;;
+ status)
+ rhstatus
+ ;;
+ condrestart)
+ [ -f /var/lock/subsys/smb ] && restart || :
+ ;;
+ *)
+ echo $"Usage: $0 {start|stop|restart|reload|status|condrestart}"
+ exit 2
+esac
+
+exit $?
diff --git a/winbind.init b/winbind.init
new file mode 100644
index 0000000..88ce028
--- /dev/null
+++ b/winbind.init
@@ -0,0 +1,102 @@
+#!/bin/sh
+#
+# chkconfig: - 27 73
+# description: Starts and stops the Samba winbind daemon
+# #
+# pidfile: /var/run/winbindd.pid
+# config: /etc/samba/smb.conf
+
+
+# Source function library.
+. /etc/rc.d/init.d/functions
+
+# Avoid using root's TMPDIR
+unset TMPDIR
+
+# Source networking configuration.
+. /etc/sysconfig/network
+
+# Check that networking is up.
+[ ${NETWORKING} = "no" ] && exit 1
+
+# Check that smb.conf exists.
+[ -f /etc/samba/smb.conf ] || exit 6
+
+[ -f /etc/sysconfig/samba ] && . /etc/sysconfig/samba
+
+RETVAL=0
+
+
+start() {
+ KIND="Winbind"
+ echo -n $"Starting $KIND services: "
+ daemon winbindd "$WINBINDOPTIONS"
+ RETVAL=$?
+ echo
+ [ $RETVAL -eq 0 ] && touch /var/lock/subsys/winbindd || RETVAL=1
+ return $RETVAL
+}
+
+stop() {
+ echo
+ KIND="Winbind"
+ echo -n $"Shutting down $KIND services: "
+ killproc winbindd
+ RETVAL=$?
+ [ $RETVAL -eq 0 ] && rm -f /var/lock/subsys/winbindd
+ echo ""
+ return $RETVAL
+}
+
+restart() {
+ stop
+ start
+}
+
+reload() {
+ echo -n $"Reloading smb.conf file: "
+ killproc winbindd -HUP
+ RETVAL=$?
+ echo
+ return $RETVAL
+}
+
+rhstatus() {
+ status winbindd
+ return $?
+}
+
+# Allow status as non-root.
+if [ "$1" = status ]; then
+ rhstatus
+ exit $?
+fi
+
+# Check that we can write to it... so non-root users stop here
+[ -w /etc/samba/smb.conf ] || exit 4
+
+case "$1" in
+ start)
+ start
+ ;;
+ stop)
+ stop
+ ;;
+ restart)
+ restart
+ ;;
+ reload)
+ reload
+ ;;
+ status)
+ rhstatus
+ ;;
+ condrestart)
+ [ -f /var/lock/subsys/winbindd ] && restart || :
+ ;;
+ *)
+ echo $"Usage: $0 {start|stop|restart|reload|status|condrestart}"
+ exit 2
+esac
+
+exit $?