[Pkg-samba-maint] [samba] 01/04: Adapt init script changes from master branch
Ivo De Decker
idd-guest at alioth.debian.org
Thu Oct 10 19:21:57 UTC 2013
This is an automated email from the git hooks/post-receive script.
idd-guest pushed a commit to branch samba_4.0
in repository samba.
commit 098a61d8cce09f16053719e4eae3df16f06f8099
Author: Ivo De Decker <ivo.dedecker at ugent.be>
Date: Wed Oct 9 23:11:09 2013 +0200
Adapt init script changes from master branch
---
debian/changelog | 1 +
debian/control | 2 +-
debian/rules | 11 ++++
debian/samba-common.dhcp | 2 +-
debian/samba.init | 107 +++++++-------------------------------
debian/samba.logrotate | 2 +-
debian/samba.nmbd.init | 91 ++++++++++++++++++++++++++++++++
debian/samba.nmbd.upstart | 21 ++++++++
debian/samba.reload-smbd.upstart | 12 +++++
debian/samba.smbd.init | 92 ++++++++++++++++++++++++++++++++
debian/samba.smbd.upstart | 19 +++++++
debian/winbind.init | 9 ++++
debian/winbind.upstart | 19 +++++++
13 files changed, 296 insertions(+), 92 deletions(-)
diff --git a/debian/changelog b/debian/changelog
index 634b2ac..9218e97 100644
--- a/debian/changelog
+++ b/debian/changelog
@@ -4,6 +4,7 @@ samba (2:4.0.10+dfsg-1) UNRELEASED; urgency=low
* Update vcs urls to point to samba instead of samba4.
* New upstream release.
* Limit build-dep on libaio-dev to linux architectures.
+ * Merge init script changes from 3.6 packages.
[ Steve Langasek ]
* Don't put useless symlinks to nss modules in the libnss-winbind package.
diff --git a/debian/control b/debian/control
index 0446b9c..6fe05b7 100644
--- a/debian/control
+++ b/debian/control
@@ -59,7 +59,7 @@ Pre-Depends: dpkg (>= 1.15.6~), ${misc:Pre-Depends}
Depends: adduser,
libpam-modules,
libpam-runtime (>= 1.0.1-11),
- lsb-base (>= 3.2-13),
+ lsb-base (>= 4.1+Debian),
procps,
python,
python-dnspython,
diff --git a/debian/rules b/debian/rules
index 91369e9..5529e20 100755
--- a/debian/rules
+++ b/debian/rules
@@ -146,6 +146,17 @@ ifneq (,$(filter libpam-smbpass, $(shell dh_listpackages)))
dh_installchangelogs -plibpam-smbpass source3/pam_smbpass/CHANGELOG
endif
+override_dh_installinit:
+ifneq (,$(filter samba, $(shell dh_listpackages)))
+ dh_installinit -psamba --name smbd
+ dh_installinit -psamba --name nmbd
+ dh_installinit -psamba --noscripts
+ dh_installinit -psamba --no-start --name reload-smbd
+endif
+ifneq (,$(filter winbind, $(shell dh_listpackages)))
+ dh_installinit -pwinbind
+endif
+
override_dh_installdocs:
dh_installdocs source4/NEWS
diff --git a/debian/samba-common.dhcp b/debian/samba-common.dhcp
index 94b00f0..b86dfeb 100644
--- a/debian/samba-common.dhcp
+++ b/debian/samba-common.dhcp
@@ -68,7 +68,7 @@ netbios_setup() {
# reload the samba server
# We don't necessarily have the samba package installed. #414841
- [ -x /etc/init.d/samba ] && /usr/sbin/invoke-rc.d samba reload
+ [ -x /etc/init.d/smbd ] && /usr/sbin/invoke-rc.d smbd reload
}
diff --git a/debian/samba.init b/debian/samba.init
index d7e7264..eedb48e 100644
--- a/debian/samba.init
+++ b/debian/samba.init
@@ -2,107 +2,38 @@
### BEGIN INIT INFO
# Provides: samba
-# Required-Start: $network $local_fs $remote_fs
-# Required-Stop: $network $local_fs $remote_fs
-# Default-Start: 2 3 4 5
-# Default-Stop: 0 1 6
-# Should-Start: slapd cups
-# Should-Stop: slapd cups
-# Short-Description: start Samba daemons (nmbd and smbd)
+# Required-Start: smbd nmbd
+# Required-Stop: smbd nmbd
+# Default-Start:
+# Default-Stop:
+# Short-Description: ensure Samba daemons are started (nmbd and smbd)
### END INIT INFO
+set -e
-PIDDIR=/var/run/samba
-NMBDPID=$PIDDIR/nmbd.pid
-SMBDPID=$PIDDIR/smbd.pid
-
-# clear conflicting settings from the environment
-unset TMPDIR
-
-# See if the daemons are there
-test -x /usr/sbin/nmbd -a -x /usr/sbin/smbd || exit 0
-
-. /lib/lsb/init-functions
-
-case "$1" in
+case $1 in
start)
- 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
-
- log_daemon_msg "Starting Samba daemons"
- # Make sure we have our PIDDIR, even if it's on a tmpfs
- install -o root -g root -m 755 -d $PIDDIR
-
- if [ -n `which testparm` ]
- then
- NMBD_DISABLED=`testparm -s --parameter-name='disable netbios' 2>/dev/null`
- fi
- if [ "$NMBD_DISABLED" != 'Yes' ]; then
- log_progress_msg "nmbd"
- if ! start-stop-daemon --start --quiet --oknodo --exec /usr/sbin/nmbd -- -D
- then
- log_end_msg 1
- exit 1
- fi
- fi
-
- log_progress_msg "smbd"
- if ! start-stop-daemon --start --quiet --oknodo --exec /usr/sbin/smbd -- -D; then
- log_end_msg 1
- exit 1
- fi
-
- log_end_msg 0
+ /etc/init.d/nmbd start
+ /etc/init.d/smbd start
;;
stop)
- log_daemon_msg "Stopping Samba daemons"
- log_progress_msg "nmbd"
-
- start-stop-daemon --stop --quiet --pidfile $NMBDPID
- # Wait a little and remove stale PID file
- sleep 1
- if [ -f $NMBDPID ] && ! ps h `cat $NMBDPID` > /dev/null
- then
- # Stale PID file (nmbd was succesfully stopped),
- # remove it (should be removed by nmbd itself IMHO.)
- rm -f $NMBDPID
- fi
-
- log_progress_msg "smbd"
- start-stop-daemon --stop --quiet --pidfile $SMBDPID
- # Wait a little and remove stale PID file
- sleep 1
- if [ -f $SMBDPID ] && ! ps h `cat $SMBDPID` > /dev/null
- then
- # Stale PID file (nmbd was succesfully stopped),
- # remove it (should be removed by smbd itself IMHO.)
- rm -f $SMBDPID
- fi
-
- log_end_msg 0
-
+ /etc/init.d/smbd stop
+ /etc/init.d/nmbd stop
;;
reload)
- log_daemon_msg "Reloading /etc/samba/smb.conf" "smbd only"
-
- start-stop-daemon --stop --quiet --signal HUP --pidfile $SMBDPID
-
- log_end_msg 0
+ /etc/init.d/smbd reload
;;
restart|force-reload)
- $0 stop
- sleep 1
- $0 start
+ /etc/init.d/nmbd "$1"
+ /etc/init.d/smbd "$1"
;;
- status)
- status="0"
+ status)
+ status=0
NMBD_DISABLED=`testparm -s --parameter-name='disable netbios' 2>/dev/null`
if [ "$NMBD_DISABLED" != "Yes" ]; then
- status_of_proc -p $NMBDPID /usr/sbin/nmbd nmbd || status=$?
+ /etc/init.d/nmbd status || status=$?
fi
- status_of_proc -p $SMBDPID /usr/sbin/smbd smbd || status=$?
+ /etc/init.d/smbd status || status=$?
exit $status
;;
*)
@@ -110,5 +41,3 @@ case "$1" in
exit 1
;;
esac
-
-exit 0
diff --git a/debian/samba.logrotate b/debian/samba.logrotate
index c3186e5..3788020 100644
--- a/debian/samba.logrotate
+++ b/debian/samba.logrotate
@@ -3,7 +3,7 @@
missingok
rotate 7
postrotate
- /etc/init.d/samba reload > /dev/null
+ /etc/init.d/smbd reload > /dev/null
endscript
compress
notifempty
diff --git a/debian/samba.nmbd.init b/debian/samba.nmbd.init
new file mode 100644
index 0000000..97a89d4
--- /dev/null
+++ b/debian/samba.nmbd.init
@@ -0,0 +1,91 @@
+#!/bin/sh
+
+### BEGIN INIT INFO
+# Provides: nmbd
+# Required-Start: $network $local_fs $remote_fs
+# Required-Stop: $network $local_fs $remote_fs
+# X-Start-Before: smbd
+# Default-Start: 2 3 4 5
+# Default-Stop: 0 1 6
+# Short-Description: start Samba NetBIOS nameserver (nmbd)
+### END INIT INFO
+
+
+PIDDIR=/var/run/samba
+NMBDPID=$PIDDIR/nmbd.pid
+
+# clear conflicting settings from the environment
+unset TMPDIR
+
+# See if the daemons are there
+test -x /usr/sbin/nmbd || exit 0
+
+. /lib/lsb/init-functions
+
+case $1 in
+ start)
+ if init_is_upstart; then
+ exit 1
+ fi
+ 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
+
+ if [ -n `which testparm` ]
+ then
+ NMBD_DISABLED=`testparm -s --parameter-name='disable netbios' 2>/dev/null`
+ fi
+ if [ "$NMBD_DISABLED" != Yes ]; then
+ log_daemon_msg "Starting NetBIOS name server" nmbd
+ # Make sure we have our PIDDIR, even if it's on a tmpfs
+ install -o root -g root -m 755 -d $PIDDIR
+
+ if ! start-stop-daemon --start --quiet --oknodo --exec /usr/sbin/nmbd -- -D
+ then
+ log_end_msg 1
+ exit 1
+ fi
+ log_end_msg 0
+ fi
+
+ ;;
+ stop)
+ if init_is_upstart; then
+ exit 0
+ fi
+
+ log_daemon_msg "Stopping NetBIOS name server" nmbd
+
+ start-stop-daemon --stop --quiet --pidfile $NMBDPID
+ # Wait a little and remove stale PID file
+ sleep 1
+ if [ -f $NMBDPID ] && ! ps h `cat $NMBDPID` > /dev/null
+ then
+ # Stale PID file (nmbd was succesfully stopped),
+ # remove it (should be removed by nmbd itself IMHO.)
+ rm -f $NMBDPID
+ fi
+
+ log_end_msg 0
+
+ ;;
+ restart|force-reload)
+ if init_is_upstart; then
+ exit 1
+ fi
+ $0 stop
+ sleep 1
+ $0 start
+ ;;
+ status)
+ status_of_proc -p $NMBDPID /usr/sbin/nmbd nmbd
+ exit $?
+ ;;
+ *)
+ echo "Usage: /etc/init.d/nmbd {start|stop|restart|force-reload|status}"
+ exit 1
+ ;;
+esac
+
+exit 0
diff --git a/debian/samba.nmbd.upstart b/debian/samba.nmbd.upstart
new file mode 100644
index 0000000..908c284
--- /dev/null
+++ b/debian/samba.nmbd.upstart
@@ -0,0 +1,21 @@
+description "NetBIOS name server"
+author "Steve Langasek <steve.langasek at ubuntu.com>"
+
+start on (local-filesystems and net-device-up IFACE!=lo)
+stop on runlevel [!2345]
+
+expect fork
+respawn
+
+pre-start script
+ [ -f /etc/samba/smb.conf ] || { stop; exit 0; }
+
+ install -o root -g root -m 755 -d /var/run/samba
+ NMBD_DISABLED=`testparm -s --parameter-name='disable netbios' 2>/dev/null || true`
+
+ [ "x$NMBD_DISABLED" = xYes ] && { stop; exit 0; }
+
+ exit 0
+end script
+
+exec nmbd -D
diff --git a/debian/samba.reload-smbd.upstart b/debian/samba.reload-smbd.upstart
new file mode 100644
index 0000000..b7e61f1
--- /dev/null
+++ b/debian/samba.reload-smbd.upstart
@@ -0,0 +1,12 @@
+description "Samba Auto-reload Integration"
+author "James Page <james.page at ubuntu.com>"
+
+start on started cups
+
+task
+
+script
+ if status smbd | grep -q "running"; then
+ reload smbd
+ fi
+end script
diff --git a/debian/samba.smbd.init b/debian/samba.smbd.init
new file mode 100644
index 0000000..3db327e
--- /dev/null
+++ b/debian/samba.smbd.init
@@ -0,0 +1,92 @@
+#!/bin/sh
+
+### BEGIN INIT INFO
+# Provides: smbd
+# Required-Start: $network $local_fs $remote_fs
+# Required-Stop: $network $local_fs $remote_fs
+# Default-Start: 2 3 4 5
+# Default-Stop: 0 1 6
+# Should-Start: slapd cups
+# Should-Stop: slapd cups
+# Short-Description: start Samba SMB/CIFS daemon (smbd)
+### END INIT INFO
+
+
+PIDDIR=/var/run/samba
+SMBDPID=$PIDDIR/smbd.pid
+
+# clear conflicting settings from the environment
+unset TMPDIR
+
+# See if the daemons are there
+test -x /usr/sbin/smbd || exit 0
+
+. /lib/lsb/init-functions
+
+case $1 in
+ start)
+ if init_is_upstart; then
+ exit 1
+ fi
+ 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
+
+ log_daemon_msg "Starting SMB/CIFS daemon" smbd
+ # Make sure we have our PIDDIR, even if it's on a tmpfs
+ install -o root -g root -m 755 -d $PIDDIR
+
+ if ! start-stop-daemon --start --quiet --oknodo --exec /usr/sbin/smbd -- -D; then
+ log_end_msg 1
+ exit 1
+ fi
+
+ log_end_msg 0
+ ;;
+ stop)
+ if init_is_upstart; then
+ exit 0
+ fi
+
+ log_daemon_msg "Stopping SMB/CIFS daemon" smbd
+
+ start-stop-daemon --stop --quiet --pidfile $SMBDPID
+ # Wait a little and remove stale PID file
+ sleep 1
+ if [ -f $SMBDPID ] && ! ps h `cat $SMBDPID` > /dev/null
+ then
+ # Stale PID file, remove it (should be removed by
+ # smbd itself IMHO).
+ rm -f $SMBDPID
+ fi
+
+ log_end_msg 0
+
+ ;;
+ reload)
+ log_daemon_msg "Reloading /etc/samba/smb.conf" smbd
+
+ start-stop-daemon --stop --quiet --signal HUP --pidfile $SMBDPID
+
+ log_end_msg 0
+ ;;
+ restart|force-reload)
+ if init_is_upstart; then
+ exit 1
+ fi
+ $0 stop
+ sleep 1
+ $0 start
+ ;;
+ status)
+ status_of_proc -p $SMBDPID /usr/sbin/smbd smbd
+ exit $?
+ ;;
+ *)
+ echo "Usage: /etc/init.d/smbd {start|stop|reload|restart|force-reload|status}"
+ exit 1
+ ;;
+esac
+
+exit 0
diff --git a/debian/samba.smbd.upstart b/debian/samba.smbd.upstart
new file mode 100644
index 0000000..3e85ea4
--- /dev/null
+++ b/debian/samba.smbd.upstart
@@ -0,0 +1,19 @@
+description "SMB/CIFS File Server"
+author "Steve Langasek <steve.langasek at ubuntu.com>"
+
+start on (local-filesystems and net-device-up)
+stop on runlevel [!2345]
+
+respawn
+
+pre-start script
+ RUN_MODE="daemons"
+
+ [ -r /etc/default/samba ] && . /etc/default/samba
+
+ [ "$RUN_MODE" = inetd ] && { stop; exit 0; }
+
+ install -o root -g root -m 755 -d /var/run/samba
+end script
+
+exec smbd -F
diff --git a/debian/winbind.init b/debian/winbind.init
index ce0171d..6c0ec05 100644
--- a/debian/winbind.init
+++ b/debian/winbind.init
@@ -34,6 +34,9 @@ fi
case "$1" in
start)
+ if init_is_upstart; then
+ exit 1
+ fi
log_daemon_msg "Starting the Winbind daemon" "winbind"
mkdir -p /var/run/samba/winbindd_privileged || return 1
@@ -45,12 +48,18 @@ case "$1" in
;;
stop)
+ if init_is_upstart; then
+ exit 0
+ fi
log_daemon_msg "Stopping the Winbind daemon" "winbind"
start-stop-daemon --stop --quiet --oknodo --exec $DAEMON
log_end_msg $?
;;
restart|force-reload)
+ if init_is_upstart; then
+ exit 1
+ fi
$0 stop && sleep 2 && $0 start
;;
diff --git a/debian/winbind.upstart b/debian/winbind.upstart
new file mode 100644
index 0000000..5ea6697
--- /dev/null
+++ b/debian/winbind.upstart
@@ -0,0 +1,19 @@
+description "Samba Winbind"
+author "David Weber"
+
+start on (local-filesystems and net-device-up IFACE!=lo)
+stop on runlevel [!2345]
+
+respawn
+
+pre-start script
+ test -x /usr/sbin/winbindd || exit 0
+ mkdir -p /var/run/samba/winbindd_privileged
+ chgrp winbindd_priv /var/run/samba/winbindd_privileged
+ chmod 0750 /var/run/samba/winbindd_privileged
+end script
+
+script
+ [ -r /etc/default/winbind ] && . /etc/default/winbind
+ exec /usr/sbin/winbindd -F $WINBINDD_OPTS
+end script
--
Alioth's /usr/local/bin/git-commit-notice on /srv/git.debian.org/git/pkg-samba/samba.git
More information about the Pkg-samba-maint
mailing list