postinst is in minidlna 1.1.5+dfsg-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 | #!/bin/sh
# postinst script for minidlna
set -e
USER=minidlna
HOME_DIR=/var/lib/minidlna
CACHE_DIR=/var/cache/minidlna
setup_user() {
if ! getent passwd "${USER}" >/dev/null; then
adduser --quiet\
--system \
--group \
--gecos "MiniDLNA server" \
--home "${HOME_DIR}" \
${USER}
fi
}
setup_cache() {
if [ ! -d "${CACHE_DIR}" ];then
mkdir -p "${CACHE_DIR}"
chown ${USER}:${USER} "${CACHE_DIR}"
chmod 750 "${CACHE_DIR}"
fi
}
fix_statoverride() {
# Previous versions create some dumb overrides and do not clean them on
# removal, so we should remove them here.
for file in /var/lib/minidlna /var/cache/minidlna /etc/minidlna.conf;do
if dpkg-statoverride --list "${file}" >/dev/null; then
dpkg-statoverride --remove "${file}"
fi
done
}
fix_permissions() {
# Previous versions use some strange and even not secure permissions,
# so we shold fix them here.
chown root:root /etc/minidlna.conf
chown ${USER}:${USER} "${CACHE_DIR}"
chmod 750 "${CACHE_DIR}"
}
ACTION="$1"
OLD_VERSION="$2"
if [ "$ACTION" = configure ];then
setup_user
if dpkg --compare-versions "$OLD_VERSION" lt-nl 1.1.5; then
fix_statoverride
fix_permissions
fi
setup_cache
fi
# Automatically added by dh_installinit
if [ "$1" = "configure" ] || [ "$1" = "abort-upgrade" ]; then
if [ -x "/etc/init.d/minidlna" ]; then
update-rc.d minidlna defaults >/dev/null
fi
if [ -x "/etc/init.d/minidlna" ] || [ -e "/etc/init/minidlna.conf" ]; then
invoke-rc.d minidlna start || exit $?
fi
fi
# End automatically added section
exit 0
|