summaryrefslogtreecommitdiffstats
path: root/packaging/Debian/debian/samba.prerm
blob: ec30ff6687bf42d3e182b561bd9be5458df0df1a (plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
#!/bin/sh -e

# Clean up any such stale file.
rm -f /tmp/samba-was-not-running

# The smbd pid file is missing, or points to a dead process
if [ ! -f /var/run/samba/smbd.pid ] || \
	! ps h `cat /var/run/samba/smbd.pid` > /dev/null
then
	# The nmbd pid file is missing, or points to a dead process
	if [ -f /var/run/samba/nmbd.pid ] || \
		! ps h `cat /var/run/samba/nmbd.pid` > /dev/null
	then
		# let the postinst know not to start samba.
		[ "$1" = "upgrade" ] && touch /tmp/samba-was-not-running
	fi
fi

# We read /etc/default/samba to know if we're running from inetd or as
# daemons so we don't call the init script if we are running from inetd.
[ -r /etc/default/samba ] && . /etc/default/samba

# We call the init script to stop Samba only if we are running as daemons.
[ -x /etc/init.d/samba -a "$RUN_MODE" != "inetd" ] && /etc/init.d/samba stop

#DEBHELPER#