This file is indexed.

postinst is in prosody 0.8.2-1.

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
#!/bin/sh
# postinst script for prosody

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>
#        * <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)
 	if ! getent passwd prosody >/dev/null; then
 	  adduser --disabled-password --quiet --system \
 	    --home "/var/lib/prosody" --no-create-home \
 	    --gecos "Prosody XMPP Server" --group prosody
 	fi

 	# Create directory for log files
 	if [ ! -d "/var/log/prosody" ]; then
 		install -d -o prosody -g adm -m 750 "/var/log/prosody";
 	fi
	if ! dpkg-statoverride --list "/var/log/prosody" >/dev/null; then
		chown prosody:adm "/var/log/prosody"
		chmod 750 "/var/log/prosody"
	fi

 	# Create data directory
 	if [ ! -d "/var/lib/prosody" ]; then
 		install -d -o prosody -g prosody -m 750 "/var/lib/prosody";
 	fi
	if ! dpkg-statoverride --list "/var/lib/prosody" >/dev/null; then
		chown prosody:prosody "/var/lib/prosody"
		chmod 750 "/var/lib/prosody"
	fi

	# Fix config directory permissions
	if ! dpkg-statoverride --list "/etc/prosody" >/dev/null; then
		chown root:root "/etc/prosody"
		chmod 755 "/etc/prosody"
	fi

	# Fix config file permissions
	if ! dpkg-statoverride --list "/etc/prosody/prosody.cfg.lua" >/dev/null; then
		for f in "/etc/prosody/prosody.cfg.lua" \
			 /etc/prosody/prosody.cfg.lua.dpkg*; do
			if [ -f $f ]; then
			    chown root:prosody $f
			    chmod 640 $f
			fi
		done
	fi

	# Create subdirs for conf files
 	if [ ! -d "/etc/prosody/conf.d" ]; then
 		install -d -o root -g prosody -m 754 "/etc/prosody/conf.d";
 	fi
	if ! dpkg-statoverride --list "/etc/prosody/conf.d" >/dev/null; then
		chown root:prosody "/etc/prosody/conf.d"
		chmod 754 "/etc/prosody/conf.d"
	fi

 	if [ ! -d "/etc/prosody/conf.avail" ]; then
 		install -d -o root -g prosody -m 754 "/etc/prosody/conf.avail";
 	fi
	if ! dpkg-statoverride --list "/etc/prosody/conf.avail" >/dev/null; then
		chown root:prosody "/etc/prosody/conf.avail"
		chmod 754 "/etc/prosody/conf.avail"
	fi

	# Making SSL certificate and key if they do not exist
 	if [ ! -d "/etc/prosody/certs" ]; then
 		install -d -o root -g prosody -m 750 "/etc/prosody/certs";
 	fi
	if ! dpkg-statoverride --list "/etc/prosody/certs" >/dev/null; then
		chown root:prosody "/etc/prosody/certs"
		chmod 750 "/etc/prosody/certs"
	fi
	if [ ! -f "/etc/prosody/certs/localhost.cert" ] || \
	   [ ! -f "/etc/prosody/certs/localhost.key" ]; then
		HOST=$(hostname -s 2>/dev/null || echo localhost)
		DOMAIN=$(hostname -d 2>/dev/null || echo localdomain)
		openssl req -new -x509 -days 365 -nodes \
			-out "/etc/prosody/certs/localhost.cert" \
			-keyout "/etc/prosody/certs/localhost.key" \
			-subj "/C=../ST=./L=./O=$DOMAIN/OU=$HOST/CN=localhost/emailAddress=root@$HOST.$DOMAIN"
	fi

	if grep -q 'require "util.ztact"' /etc/prosody/prosody.cfg.lua; then
		# Upgrade config from pre-0.8.0 (removes util.ztact usage)
		echo "Deprecated method for including conf.d/* detected in"\
		     "prosody.cfg.lua. Fixing config file in-place, current version"\
		     "will be saved as /etc/prosody/prosody.cfg.lua.dpkg-bak" >&2;
		sed -e 's|^local ztact = require "util.ztact"$||'\
		-e 'T;: loop;N;s|^--------*$||m;t end;b loop;:end; i\' \
		-e 'Include "conf.d/*.cfg.lua"' \
		-e 'd' -i.dpkg-bak /etc/prosody/prosody.cfg.lua;
	fi
  ;;
  abort-upgrade|abort-remove|abort-deconfigure)
  ;;
  *)
    echo "postinst called with unknown argument \`$1'" >&2
    exit 1
  ;;
esac

# Automatically added by dh_installinit
if [ -x "/etc/init.d/prosody" ]; then
	update-rc.d prosody defaults >/dev/null
	invoke-rc.d prosody start || exit $?
fi
# End automatically added section