Commit 3dfdfa72 authored by Markus Frosch's avatar Markus Frosch 📣

Add postinst for permissions and user

parent 79c8ca58
......@@ -15,6 +15,7 @@ Homepage: https://www.icinga.com
Package: icingadb
Architecture: any
Depends:
adduser,
${shlibs:Depends},
${misc:Depends}
Built-Using: ${misc:Built-Using}
......
#!/bin/sh
set -e
setperm() {
user="$1"
group="$2"
mode="$3"
file="$4"
shift 4
# only do something when no setting exists
if ! dpkg-statoverride --list "$file" >/dev/null 2>&1; then
chown "$user":"$group" "$file"
chmod "$mode" "$file"
fi
}
case "$1" in
configure)
if ! getent passwd icingadb > /dev/null ; then
echo 'Adding system-user for icingadb' 1>&2
adduser --system --group --home / \
--disabled-login --force-badname icingadb > /dev/null
fi
setperm icingadb icingadb 0750 /etc/icingadb
setperm icingadb icingadb 0640 /etc/icingadb/config.ini
;;
abort-upgrade|abort-remove|abort-deconfigure)
;;
*)
echo "postinst called with unknown argument \`$1'" >&2
exit 1
;;
esac
#DEBHELPER#
exit 0
Markdown is supported
0% or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment