summaryrefslogtreecommitdiff
path: root/packaging/Debian/debian/samba.prerm
diff options
context:
space:
mode:
authorGerald Carter <jerry@samba.org>2002-02-02 15:44:37 +0000
committerGerald Carter <jerry@samba.org>2002-02-02 15:44:37 +0000
commitc8bc0fa4a7be25cb926750a56085e1e98ed9046b (patch)
treeec7bb9c0ce893fda80a6eb1f264c4717b3f667ac /packaging/Debian/debian/samba.prerm
parent8cb4e23ffc77a9842e1304f3de20af5861982746 (diff)
downloadsamba-c8bc0fa4a7be25cb926750a56085e1e98ed9046b.tar.gz
samba-c8bc0fa4a7be25cb926750a56085e1e98ed9046b.tar.bz2
samba-c8bc0fa4a7be25cb926750a56085e1e98ed9046b.zip
merge from 2.2
(This used to be commit 473a89cde2e60c359cb435c714dc98974489a118)
Diffstat (limited to 'packaging/Debian/debian/samba.prerm')
-rw-r--r--packaging/Debian/debian/samba.prerm74
1 files changed, 74 insertions, 0 deletions
diff --git a/packaging/Debian/debian/samba.prerm b/packaging/Debian/debian/samba.prerm
new file mode 100644
index 0000000000..acd6d087b5
--- /dev/null
+++ b/packaging/Debian/debian/samba.prerm
@@ -0,0 +1,74 @@
+#!/bin/sh
+#
+# Pre-removal script for the Samba package for Debian GNU/Linux.
+#
+# Written by Eloy A. Paris for the Debian project.
+#
+
+DEBIAN_CONFIG=/etc/samba/debian_config
+
+NMBDPID=/var/state/samba/nmbd.pid
+SMBDPID=/var/state/samba/smbd.pid
+
+# The most important thing the prerm script must do is to stop the Samba
+# daemons (nmbd and smbd). Note that this can be tricky since Samba
+# can be running from the inetd meta-daemon or as daemons (it's a
+# user choice).
+
+# Before we stop Samba we need to know how it is running (from inetd
+# or as daemons). We could source in the debian_config file but it
+# is safer to grep /etc/inetd.conf.
+if grep -q '^netbios-ns' /etc/inetd.conf; then
+ # Samba is running from inetd. We need to disable the Samba daemons
+ # in /etc/inetd.conf before we stop the daemons. Otherwise traffic
+ # in the NetBIOS ports will make inetd start them again.
+ #
+ # Note: user preferences regarding the mode he/she wants Samba to
+ # be run (inetd or daemons) will be lost next. In the postinst
+ # we depend on the information present in the debian_config
+ # file to restore everything back to the way it was.
+ update-inetd --disable netbios-ssn
+ update-inetd --disable netbios-ns
+
+ # Now it is safe to stop the daemons...
+
+ # I have just recalled that old versions of nmbd and smbd did not store
+ # their PID's in /var/samba/state/ (or whatever directory
+ # was used for this purpose in configure), so I can't use
+ # --pidfile in start-stop-daemon to stop nmbd or smbd. I
+ # will handle this by testing first whether the PID file exists.
+ if [ -f $NMBDPID ]; then
+ start-stop-daemon --stop --oknodo --user root --name nmbd --quiet --pidfile $NMBDPID
+ else
+ start-stop-daemon --stop --oknodo --user root --name nmbd --quiet
+ fi
+
+ # nmbd must be dead by now, now it's smbd's turn
+ if [ -f $SMBDPID ]; then
+ start-stop-daemon --stop --oknodo --user root --name smbd --quiet --pidfile $SMBDPID
+ else
+ start-stop-daemon --stop --oknodo --user root --name smbd --quiet
+ fi
+elif [ -x /etc/init.d/samba ]; then # Old Samba packages didn't have a
+ # /etc/init.d/samba so we better
+ # check first.
+ # Samba is running as daemons. No problem here, just stop Samba...
+ /etc/init.d/samba stop
+fi
+
+if [ \( "$1" = "upgrade" -o "$1" = "remove" \) -a -L /usr/doc/samba ]; then
+ rm -f /usr/doc/samba
+fi
+
+# Make sure there are no nmbd or smbd daemons running (security check)
+# (as you see this code is commented out - so far I haven't had the need
+# to do this sanity check - peloy, Aug. 23, 1998)
+#ps -ax | grep nmbd
+#if [ $? ... ]; then
+# killall -9 nmbd
+#fi
+
+#ps -ax | grep smbd
+#if [ $? ... ]; then
+# killall -9 smbd
+#fi