preinst is in ejabberd 18.01-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 | #!/bin/sh
set -e
case "$1" in
install)
# Create /etc/ejabberd if it doesn't already exist
mkdir -p /etc/ejabberd
# Ejabberd config dir may contain sensitive data, so making it unreadable by
# the world.
if ! dpkg-statoverride --list /etc/ejabberd >/dev/null; then
chmod 750 /etc/ejabberd
fi
# Create a certificate and store it in /etc/ejabberd
echo "Generating SSL certificate /etc/ejabberd/ejabberd.pem..."
EHOSTNAME=$(hostname -s 2>/dev/null || echo localhost)
EDOMAINNAME=$(hostname -d 2>/dev/null || echo localdomain)
openssl req -new -x509 -days 365 -nodes -out /etc/ejabberd/ejabberd.pem \
-keyout /etc/ejabberd/ejabberd.pem > /dev/null 2>&1 <<+++
.
.
.
$EDOMAINNAME
$EHOSTNAME
ejabberd
root@$EHOSTNAME.$EDOMAINNAME
+++
# Ejabberd cert should have appropriate permissions so as to not be readable
# by the world.
if [ -f /etc/ejabberd/ejabberd.pem ]
then
if ! dpkg-statoverride --list /etc/ejabberd/ejabberd.pem >/dev/null; then
chmod 640 /etc/ejabberd/ejabberd.pem
fi
fi
;;
upgrade|abort-upgrade)
;;
*)
echo "postinst called with unknown argument \`$1'" >&2
exit 0
;;
esac
exit 0
|