This file is indexed.

postinst is in dms-core 1.0.8.1-1ubuntu1.

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
#!/bin/sh
# postinst script for dms
#
# see: dh_installdeb(1)

set -e

# summary of how this script can be called:
#        * <postinst> `configure' <most-recently-configured-version>
#        * <old-postinst> `abort-upgrade' <new version>
#        * <conflictor's-postinst> `abort-remove' `in-favour' <package>
#          <new-version>
#        * <postinst> `abort-remove'
#        * <deconfigured's-postinst> `abort-deconfigure' `in-favour'
#          <failed-install-package> <version> `removing'
#          <conflicting-package> <version>
# for details, see http://www.debian.org/doc/debian-policy/ or
# the debian-policy package

case "$1" in
    configure)
	# Add users and groups
	if ! getent passwd dmsdmd >/dev/null; then
		adduser --quiet --system --group --no-create-home --home / --shell /bin/false dmsdmd
	fi
	if ! getent passwd dmsdms >/dev/null; then
		adduser --quiet --system --group --no-create-home --home / --shell /bin/false dms
	fi
	if ! getent passwd postgres > /dev/null; then
		adduser --system --quiet --home /var/lib/postgresql \
			--no-create-home --shell /bin/bash --group \
			--gecos "PostgreSQL administrator" postgres
	fi
	if ! getent group bind > /dev/null; then
		addgroup --quiet --system bind
	fi
	if ! getent group bind | grep -q dmsdmd; then
		adduser dmsdmd bind
	fi
	if ! getent group dms | grep -q dmsdmd; then
		adduser dmsdmd dms
	fi

	# Setup permissions on various files and dirs
	chown root:bind /etc/dms/bind
	chmod 2755 /etc/dms/bind
	for f in named.conf.options named.conf named.conf.local; do
		chgrp bind /etc/dms/bind/$f
	done
	chown dmsdmd:bind /var/lib/dms/master-config
	chmod 2755 /var/lib/dms/master-config
	for f in server-acl.conf zones.conf; do
		touch /var/lib/dms/master-config/$f
		chown dmsdmd:bind /var/lib/dms/master-config/$f
	done
	chown bind:dmsdmd /var/lib/bind/dynamic
	chmod 2775 /var/lib/bind/dynamic
	chown bind:dmsdmd /var/lib/bind/keys
	chmod 2775 /var/lib/bind/keys
	chown dmsdmd:dmsdmd /var/lib/dms/dms-sg
	chown dmsdmd:dmsdmd /var/log/dms
	chown root:bind /var/cache/bind/slave
	chmod 775 /var/cache/bind/slave
	# Files
	chown root:dms /etc/dms/dms.conf
	chmod 640 /etc/dms/dms.conf
	chown root:dms /etc/dms/rsync-dnsconf-password
	chmod 640 /etc/dms/rsync-dnsconf-password
	chown root:dms /etc/dms/rsync-dnssec-password
	chmod 640 /etc/dms/rsync-dnssec-password

	# Set up kernel SHM
	service procps reload
	NEWPGVER=`/usr/share/postgresql-common/supported-versions| tail -1`
	PGVER=`dms_pgversion`
	if ! pg_lsclusters -h | perl -pe 's/^\S+\s+(\S+)\s+.*$/\1/' | grep -q dms; then
		# Create PG dms cluster
		dms_createdb || {
		        echo "Error: could not create dms cluster. Please create it manually with

			  dms_createdb

using the -f switch if required.";
		} >&2
	elif [ "$PGVER" != "$NEWPGVER" ]; then
		# Upgrade PG dms cluster
		dms_upgradedb -f || {
		        echo "Error: could not upgrade dms cluster. Please upgrade it manually with

			  dms_upgradedb

";
		} >&2
	else
		# Revert cluster settings of removal
		DMSPGCONFDIR="/etc/postgresql/$PGVER/dms"
		if grep -q ^manual ${DMSPGCONFDIR}/start.conf; then
			perl -pe 's~^manual~auto~' -i ${DMSPGCONFDIR}/start.conf
			pg_ctlcluster $PGVER dms start
		fi
			
	fi
	;;
    abort-upgrade|abort-remove|abort-deconfigure)
    ;;

    *)
        echo "postinst called with unknown argument \`$1'" >&2
        exit 1
    ;;
esac

# dh_installdeb will replace this with shell code automatically
# generated by other debhelper scripts.

# Automatically added by dh_systemd_enable/11.1.4ubuntu1
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 'dmsdmd.service' >/dev/null || true

	# was-enabled defaults to true, so new installations run enable.
	if deb-systemd-helper --quiet was-enabled 'dmsdmd.service'; then
		# Enables the unit on first installation, creates new
		# symlinks on upgrades if the unit file has changed.
		deb-systemd-helper enable 'dmsdmd.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 'dmsdmd.service' >/dev/null || true
	fi
fi
# End automatically added section
# Automatically added by dh_installinit/11.1.4ubuntu1
if [ "$1" = "configure" ] || [ "$1" = "abort-upgrade" ] || [ "$1" = "abort-deconfigure" ] || [ "$1" = "abort-remove" ] ; then
	if [ -x "/etc/init.d/dmsdmd" ]; then
		update-rc.d dmsdmd defaults >/dev/null
		if [ -n "$2" ]; then
			_dh_action=restart
		else
			_dh_action=start
		fi
		invoke-rc.d dmsdmd $_dh_action || exit 1
	fi
fi
# End automatically added section


exit 0