postinst is in partimage-server 0.6.8-2.2ubuntu1.
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 | #!/bin/sh
set -e
[ ! "$1" = "configure" ] && exit 0
opensslpath=/usr/bin/openssl
target=/var/lib/partimaged
clean()
{
rm -f /etc/partimaged/privkey.pem
rm -f /etc/partimaged/partimaged.rand
}
create_user()
{
if ! getent group partimag >/dev/null; then
addgroup --system partimag >/dev/null
fi
if ! getent passwd partimag >/dev/null; then
adduser --system \
--disabled-password \
--shell /bin/false \
--gecos "Partimage Server" \
--ingroup partimag \
--no-create-home \
--home /var/lib/partimaged/ \
partimag >/dev/null
fi
}
create_certificates()
{
$opensslpath req -new -x509 -nodes -config \
/etc/partimaged/partimage-certs.cnf \
-out /etc/partimaged/partimaged.cert -keyout \
/etc/partimaged/partimaged.key
rm -f /etc/partimaged/partimaged.csr
chmod 750 /etc/partimaged
chown partimag:partimag /etc/partimaged
chmod 600 /etc/partimaged/partimaged.key
chmod 600 /etc/partimaged/partimaged.cert
chown partimag:partimag /etc/partimaged/partimaged.key
chown partimag:partimag /etc/partimaged/partimaged.cert
}
fix_permissions()
{
chown partimag:partimag $target
chmod 750 $target
chown partimag:partimag /etc/partimaged/partimagedusers
chmod 0600 /etc/partimaged/partimagedusers
chown partimag:partimag /var/log/partimage
}
# Create a system user/group partimag
create_user
# Now that we have a user/group partimag set the appropriate access rights
fix_permissions
# SSL Certs
if [ -s "/etc/partimaged/partimaged.key" ]; then
echo "OpenSSL certificate already exists. Leaving..."
else
if [ ! -s "/etc/partimaged/partimage-certs.cnf" ]; then
echo "I cannot find the /etc/partimaged/partimage-certs.cnf file."
echo "SSL certificate will not be created!"
else
echo "Creating certificates for partimage-server"
create_certificates
fi
fi
# Automatically added by dh_installinit
if [ -x "/etc/init.d/partimaged" ] || [ -e "/etc/init/partimaged.conf" ]; then
if [ ! -e "/etc/init/partimaged.conf" ]; then
update-rc.d partimaged defaults >/dev/null
fi
invoke-rc.d partimaged start || exit $?
fi
# End automatically added section
exit 0
|