#! /bin/sh # # $FreeBSD$ PATH=/bin:/usr/bin:/usr/sbin check_rcfile_fix_perms() { ( . /etc/rc.subr name="mailman" rcvar=mailman_enable load_rc_config $name : ${mailman_fix_perms="YES"} checkyesno mailman_fix_perms ) } set -e case "$2" in POST-INSTALL) echo "---> Starting post-install script" LC_ALL=C export LC_ALL MYTMP="$(mktemp -d "${TMPDIR-/tmp}/mminstall.XXXXXXXXXX")" trap "rm -rf \"$MYTMP\"" EXIT # fix up permissions - this is under investigation; pkg or libarchive # goof up the group writable and/or setgid bits /usr/bin/find "%%MAILMANDIR%%/qfiles" -maxdepth 1 -type d -exec \ /bin/chmod u+rwx,g+rwsx,o-w "{}" + /bin/chmod 02775 "%%MAILMANDIR%%" \ "%%MAILMANDIR%%/Mailman" \ "%%MAILMANDIR%%/bin" \ "%%MAILMANDIR%%/cgi-bin" \ "%%MAILMANDIR%%/icons" \ "%%MAILMANDIR%%/mail" \ "%%MAILMANDIR%%/scripts" \ "%%MAILMANDIR%%/tests" \ "%%MAILMANDIR%%/pythonlib" \ "%%MAILMANDIR%%/spam" \ "%%MAILMANDIR%%/locks" \ "%%MAILMANDIR%%/Mailman/Archiver" \ "%%MAILMANDIR%%/Mailman/Bouncers" \ "%%MAILMANDIR%%/Mailman/Cgi" \ "%%MAILMANDIR%%/Mailman/Commands" \ "%%MAILMANDIR%%/Mailman/Gui" \ "%%MAILMANDIR%%/Mailman/Handlers" \ "%%MAILMANDIR%%/Mailman/Logging" \ "%%MAILMANDIR%%/Mailman/MTA" \ "%%MAILMANDIR%%/Mailman/Queue" \ "%%MAILMANDIR%%/tests/bounces" \ "%%MAILMANDIR%%/tests/msgs" \ "%%MAILMANDIR%%/cron" \ "%%MAILMANDIR%%/data" \ "%%MAILMANDIR%%/lists" \ "%%MAILMANDIR%%/archives" \ "%%MAILMANDIR%%/archives/public" # this can be 2770 or 2771 but should not be stomped over test -d "%%MAILMANDIR%%/archives/private" \ || /usr/bin/install -m 02771 -g "%%GROUP%%" \ -d "%%MAILMANDIR%%/archives/private" /bin/chmod u+rwx,g+srwx "%%MAILMANDIR%%/archives/private" /bin/chmod u+rwx,g+srwx,o+rx "%%MAILMANDIR%%/logs" /usr/bin/find "%%MAILMANDIR%%/messages" "%%MAILMANDIR%%/templates" -type d \ -exec chmod 02775 '{}' + echo "---> Running update" LC_ALL=C "%%MAILMANDIR%%/bin/update" 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" fi else echo "---> Creating crontab(5) file for user \"%%USER%%\"" /usr/bin/crontab -u "%%USER%%" "%%MAILMANDIR%%/cron/crontab.in" fi rm -f "$MYTMP/crontab" if check_rcfile_fix_perms ; then echo "---> Checking (and fixing) file and directory permissions" output="$("%%MAILMANDIR%%/bin/check_perms" -f 2>&1)" || : printf '%s\n' "$output" | egrep -v '^Re-run' || : else echo "---> rcfile sets mailman_fix_perms to no, skipping check_perms" fi echo "---> Running assorted other checks" if egrep -q "^[ \t]*MTA.*=.*Postfix" "%%MAILMANDIR%%/Mailman/mm_cfg.py" ; then # run Postfix-specific checks POSTCONF=$(PATH="${PKG_PREFIX}/sbin:/usr/sbin:/sbin:$PATH" which postconf) if [ "x`${POSTCONF} -h myhostname`" != "xlocalhost" ] \ && ! egrep -q "^[ \t]*SMTPHOST.*=.*`${POSTCONF} -h myhostname`" \ "%%MAILMANDIR%%/Mailman/mm_cfg.py" then echo "" echo "Your Postfix hostname is non-default." echo -n "You must add \"SMTPHOST = '`${POSTCONF} -h myhostname`'" echo "\" to the bottom of mm_cfg.py (without quotes)." echo "" fi fi ;; esac