# mimic source4/smbd/server.c and mask service before it fails
SERVER_ROLE=`samba-tool testparm --parameter-name="server role" 2>/dev/null | tail -1`
SERVER_SERVICES=`samba-tool testparm --parameter-name="server services" 2>/dev/null | tail -1`
DCERPC_ENDPOINT_SERVERS=`samba-tool testparm --parameter-name="dcerpc endpoint servers" 2>/dev/null | tail -1`
if [ "$SERVER_ROLE" != "active directory domain controller" ] \
&& ( echo "$SERVER_SERVICES" | grep -qv '\(^\|, \)smb\(,\|$\)' ) \
&& ( echo "$DCERPC_ENDPOINT_SERVERS" | grep -qv '\(^\|, \)remote\(,\|$\)' ) \
&& ( echo "$DCERPC_ENDPOINT_SERVERS" | grep -qv '\(^\|, \)mapiproxy\(,\|$\)' ) \
; then
if [ ! -e /etc/systemd/system/samba-ad-dc.service ]; then
mkdir -p /etc/systemd/system
echo "Samba is not being run as an AD Domain Controller, masking samba-ad-dc-service."
echo "Please ignore the following error about deb-systemd-helper not finding samba-ad-dc-service."
ln -s /dev/null /etc/systemd/system/samba-ad-dc.service
# In case this system is running systemd, we make systemd reload the unit files
# to pick up changes.
if [ -d /run/systemd/system ] ; then
systemctl --system daemon-reload >/dev/null || true
fi
fi
fi
(...)
# Automatically added by dh_systemd_enable
# This will only remove masks created by d-s-h on package removal.
deb-systemd-helper unmask samba-ad-dc.service >/dev/null || true
# was-enabled defaults to true, so new installations run enable.
if deb-systemd-helper --quiet was-enabled samba-ad-dc.service; then
# Enables the unit on first installation, creates new
# symlinks on upgrades if the unit file has changed.
deb-systemd-helper enable samba-ad-dc.service >/dev/null || true
else
# Update the statefile to add new symlinks (if any), which need to be
# cleaned up on purge. Also remove old symlinks.
deb-systemd-helper update-state samba-ad-dc.service >/dev/null || true
fi
# End automatically added section
(...)
# Automatically added by dh_installinit
if [ "$1" = "configure" ] || [ "$1" = "abort-upgrade" ]; then
if [ -x "/etc/init.d/samba-ad-dc" ]; then
update-rc.d samba-ad-dc defaults >/dev/null
invoke-rc.d samba-ad-dc start || exit $?
fi
fi
# End automatically added section
# Automatically added by dh_installinit
if [ "$1" = "configure" ] || [ "$1" = "abort-upgrade" ]; then
if [ -x "/etc/init.d/reload-smbd" ]; then
update-rc.d reload-smbd defaults >/dev/null || exit $?
fi
fi
# End automatically added section
# Automatically added by dh_installdeb
dpkg-maintscript-helper rm_conffile /etc/network/if-up.d/samba 2:3.6.5-6~ samba -- "$@"
# End automatically added section
exit 0