1
0
mirror of https://git.FreeBSD.org/ports.git synced 2024-11-26 00:55:14 +00:00
freebsd-ports/mail/mailman/files/pkg-install.in
Matthias Andree 608099abc5 Avoid leftovers on pkg_add-based systems by running a
depth-first remove of empty directories under the Mailman directory.

Submitted by:	jenkins/swills@
2014-05-16 15:56:24 +00:00

48 lines
1.3 KiB
Bash

#! /bin/sh
#
# $FreeBSD$
PATH=/bin:/usr/bin:/usr/sbin
case $2 in
POST-INSTALL)
echo "---> Starting post-install script"
MYTMP="$(mktemp -d "${TMPDIR-/tmp}/mminstall.XXXXXXXXXX")" || exit 1
trap "rm -rf \"$MYTMP\"" EXIT
/bin/chmod g+s "%%MAILMANDIR%%" || exit 1
echo "---> Running update"
LC_ALL=C "%%MAILMANDIR%%/bin/update" || exit 1
echo "---> Checking crontab(5) file for user \"%%USER%%\""
if [ -e /var/cron/allow ]; then
grep -q "^%%USER%%\$" /var/cron/allow || \
printf '%s\n' "%%USER%%" >> /var/cron/allow
fi
if /usr/bin/crontab -u "%%USER%%" -l >"$MYTMP/crontab" 2>&1 ; then
if test -s "$MYTMP/crontab"; then
echo "---> \"%%USER%%\" already has a crontab. Not overwriting it"
echo "---> Please merge any changes from the standard crontab file"
echo "---> %%MAILMANDIR%%/cron/crontab.in"
else
echo "---> Installing crontab(5) file for user \"%%USER%%\""
/usr/bin/crontab -u "%%USER%%" "%%MAILMANDIR%%/cron/crontab.in" || exit 1
fi
else
echo "---> Creating crontab(5) file for user \"%%USER%%\""
/usr/bin/crontab -u "%%USER%%" "%%MAILMANDIR%%/cron/crontab.in" || exit 1
fi
rm -f "$MYTMP/crontab"
echo "---> Checking (and fixing) file and directory permissions"
"%%MAILMANDIR%%/bin/check_perms" -f >/dev/null
;;
esac