This file is indexed.

postinst is in samba 2:4.7.6+dfsg~ubuntu-0ubuntu2.

This file is a maintainer script. It is executed when installing (*inst) or removing (*rm) the package.

The actual contents of the file can be viewed below.

  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
 27
 28
 29
 30
 31
 32
 33
 34
 35
 36
 37
 38
 39
 40
 41
 42
 43
 44
 45
 46
 47
 48
 49
 50
 51
 52
 53
 54
 55
 56
 57
 58
 59
 60
 61
 62
 63
 64
 65
 66
 67
 68
 69
 70
 71
 72
 73
 74
 75
 76
 77
 78
 79
 80
 81
 82
 83
 84
 85
 86
 87
 88
 89
 90
 91
 92
 93
 94
 95
 96
 97
 98
 99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
#!/bin/sh
#
# Post-installation script for the Samba package for Debian GNU/Linux
#
#

set -e

# We generate several files during the postinst, and we don't want
#	them to be readable only by root.
umask 022

# add the sambashare group
if ! getent group sambashare > /dev/null 2>&1
then
	addgroup --system sambashare
	# Only on Ubuntu, use the "admin" group as a template for the
	# initial users for this group; Debian has no equivalent group,
	# so leaving the sambashare group empty is the more secure default
	if [ -x "`which lsb_release 2>/dev/null`" ] \
	   && [ "`lsb_release -s -i`" = "Ubuntu" ]
	then
		OLDIFS="$IFS"
		IFS=","
		for USER in `getent group admin | cut -f4 -d:`; do
			adduser "$USER" sambashare \
			|| ! getent passwd "$USER" >/dev/null
		done
		IFS="$OLDIFS"
	fi
fi

if [ ! -e /var/lib/samba/usershares ]
then
	install -d -m 1770 -g sambashare /var/lib/samba/usershares
fi

# 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
    elif [ -h /etc/systemd/system/samba-ad-dc.service ] \
        && [ "`realpath /etc/systemd/system/samba-ad-dc.service`" = /dev/null ] \
    ; then
        echo "Samba is not being run as an AD Domain Controller."
        echo "Please ignore the following error about deb-systemd-helper not finding samba-ad-dc.service."
    fi
fi
# Automatically added by dh_installdeb/11.1.6ubuntu1
dpkg-maintscript-helper rm_conffile /etc/init/nmbd.conf 2:4.6.5\+dfsg-5\~ -- "$@"
dpkg-maintscript-helper rm_conffile /etc/init/reload-smbd.conf 2:4.6.5\+dfsg-5\~ -- "$@"
dpkg-maintscript-helper rm_conffile /etc/init/samba-ad-dc.conf 2:4.6.5\+dfsg-5\~ -- "$@"
dpkg-maintscript-helper rm_conffile /etc/init/smbd.conf 2:4.6.5\+dfsg-5\~ -- "$@"
dpkg-maintscript-helper rm_conffile /etc/init.d/samba 2:4.6.5\+dfsg-5\~ -- "$@"
# End automatically added section
# Automatically added by dh_installinit/11.1.6ubuntu1
if [ "$1" = "configure" ] || [ "$1" = "abort-upgrade" ] || [ "$1" = "abort-deconfigure" ] || [ "$1" = "abort-remove" ] ; then
	if [ -x "/etc/init.d/smbd" ]; then
		update-rc.d smbd defaults >/dev/null
		if [ -n "$2" ]; then
			_dh_action=restart
		else
			_dh_action=start
		fi
		invoke-rc.d smbd $_dh_action || exit 1
	fi
fi
# End automatically added section
# Automatically added by dh_installinit/11.1.6ubuntu1
if [ "$1" = "configure" ] || [ "$1" = "abort-upgrade" ] || [ "$1" = "abort-deconfigure" ] || [ "$1" = "abort-remove" ] ; then
	if [ -x "/etc/init.d/nmbd" ]; then
		update-rc.d nmbd defaults >/dev/null
		if [ -n "$2" ]; then
			_dh_action=restart
		else
			_dh_action=start
		fi
		invoke-rc.d nmbd $_dh_action || exit 1
	fi
fi
# End automatically added section
# Automatically added by dh_installinit/11.1.6ubuntu1
if [ "$1" = "configure" ] || [ "$1" = "abort-upgrade" ] || [ "$1" = "abort-deconfigure" ] || [ "$1" = "abort-remove" ] ; then
	if [ -x "/etc/init.d/samba-ad-dc" ]; then
		update-rc.d samba-ad-dc defaults >/dev/null
		if [ -n "$2" ]; then
			_dh_action=restart
		else
			_dh_action=start
		fi
		invoke-rc.d samba-ad-dc $_dh_action || exit 1
	fi
fi
# End automatically added section
# Automatically added by dh_installsystemd/11.1.6ubuntu1
if [ "$1" = "configure" ] || [ "$1" = "abort-upgrade" ] || [ "$1" = "abort-deconfigure" ] || [ "$1" = "abort-remove" ] ; then
	# This will only remove masks created by d-s-h on package removal.
	deb-systemd-helper unmask 'nmbd.service' >/dev/null || true

	# was-enabled defaults to true, so new installations run enable.
	if deb-systemd-helper --quiet was-enabled 'nmbd.service'; then
		# Enables the unit on first installation, creates new
		# symlinks on upgrades if the unit file has changed.
		deb-systemd-helper enable 'nmbd.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 'nmbd.service' >/dev/null || true
	fi
fi
# End automatically added section
# Automatically added by dh_installsystemd/11.1.6ubuntu1
if [ "$1" = "configure" ] || [ "$1" = "abort-upgrade" ] || [ "$1" = "abort-deconfigure" ] || [ "$1" = "abort-remove" ] ; then
	# 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
fi
# End automatically added section
# Automatically added by dh_installsystemd/11.1.6ubuntu1
if [ "$1" = "configure" ] || [ "$1" = "abort-upgrade" ] || [ "$1" = "abort-deconfigure" ] || [ "$1" = "abort-remove" ] ; then
	# This will only remove masks created by d-s-h on package removal.
	deb-systemd-helper unmask 'smbd.service' >/dev/null || true

	# was-enabled defaults to true, so new installations run enable.
	if deb-systemd-helper --quiet was-enabled 'smbd.service'; then
		# Enables the unit on first installation, creates new
		# symlinks on upgrades if the unit file has changed.
		deb-systemd-helper enable 'smbd.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 'smbd.service' >/dev/null || true
	fi
fi
# End automatically added section


exit 0