This file is indexed.

postinst is in yaws 1.98-2.

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
#! /bin/sh
# postinst script for yaws
#
# 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>
#        * <deconfigured's-postinst> `abort-deconfigure' `in-favour'
#          <failed-install-package> <version> `removing'
#          <conflicting-package> <version>
# for details, see /usr/doc/packaging-manual/
#
# quoting from the policy:
#     Any necessary prompting should almost always be confined to the
#     post-installation script, and should be protected with a conditional
#     so that unnecessary prompting doesn't happen if a package's
#     installation fails and the `postinst' is called with `abort-upgrade',
#     `abort-remove' or `abort-deconfigure'.

case "$1" in
    configure)
	# Create yaws user
	adduser --quiet --system --shell /bin/sh --group --home /var/cache/yaws yaws
	# Moving home directory if it's still in /var/run
	usermod --home /var/cache/yaws --move-home yaws >/dev/null 2>/dev/null

	# Fixing config directory permissions
	for d in yaws yaws/conf.avail yaws/conf.d ; do
	    if ! dpkg-statoverride --list /etc/$d >/dev/null; then
		chown root:yaws /etc/$d
		chmod 750 /etc/$d
	    fi
	done

	# Yaws configs may contain sensitive information (passwords)
	for f in /etc/yaws/yaws.conf /etc/yaws/conf.avail/*.conf ; do
	    if ! dpkg-statoverride --list $f >/dev/null; then
		chown root:yaws $f
		chmod 640 $f
	    fi
	done

	# Create config symlinks
	# Do it only if it's a fresh install or upgrade from version
	# less than 1.66-2 (which is the first version with multiple
	# configs), allowing admin to safely remove it.

	if dpkg --compare-versions "$2" lt "1.66-2" ; then
	    for f in localhost.conf localhost-ssl.conf ; do
		if [ ! -f /etc/yaws/conf.d/$f ] ; then
		    ln -s ../conf.avail/$f /etc/yaws/conf.d/
		fi
	    done
	fi


	# Adding yaws user to the ssl-cert group to use the snakeoil
	# SSL certificate

	if getent group ssl-cert >/dev/null ; then
	    adduser --quiet yaws ssl-cert
	fi

	# Create the homedir if it doesn't exist for some reason
	mkdir -p /var/cache/yaws

	# Only user yaws and root are allowed to create yaws control files
	chown -R yaws:yaws /var/cache/yaws
	chmod 750 /var/cache/yaws

	install -o yaws -g adm  -m 750 -d /var/log/yaws
    ;;

    abort-upgrade|abort-remove|abort-deconfigure)
    ;;

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

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

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


exit 0