cronie/debian/postinst
2017-05-08 15:30:04 +02:00

38 lines
929 B
Bash

#!/bin/sh
set -e
# Analogous to Debian's ISC cron postinst script (for compatibility reasons)
tabsdir="/var/spool/cron/crontabs"
# Make sure group "crontab" exists (needed for running SGID)
getent group crontab > /dev/null 2>&1 || addgroup --system crontab
# Make crontab(1) SGID
if ! dpkg-statoverride --list /usr/bin/crontab > /dev/null
then
dpkg-statoverride --update --add root crontab 2755 /usr/bin/crontab
fi
# Adjust permissions for spool dir
# Can't use dpkg-statoverride for this because it doesn't cooperate nicely
# with cron alternatives such as bcron
if [ -d $tabsdir ] ; then
chown root:crontab $tabsdir
# This must be in sync with misc.c:check_spool_dir()
chmod 1730 $tabsdir
cd $tabsdir
if [ -n "`ls -A $tabsdir`" ]
then
for tabname in *
do
chown $tabname:crontab $tabname && chmod 600 $tabname || continue
done
fi
fi
#DEBHELPER#
exit 0