5140d21c9d
Installation of mail/squirrelmail places the ports documentation in PREFIX/squirrelmail, and you are not able to not install the documentation with NOPORTDOCS. - installs all documentation to the DOCSDIR directory - fixes security of the port by moving the attachment and user preferences out of the web servers document root (moves default data_dir & attachment_dir from SQUIRRELDIR/data to sub-directorys under /var/spool/squirrelmail) as recommended on the SquirrelMail web site. - adds a periodic/daily script to clean the attachment directory of abandoned files (disabled by default) - location of squirrelmail can be set by either defining SQUIRRELDIR or WITHOUT_WWWDIR when patching and installing the port. - BENTO FIX: The /var/spool/squirrelmail directory is created by pkg-install, but it wasn't being uninstalled. Connditionalized the creation of this directory depending on how the BATCH variable is set. A message in pkg-deinstall advises the port user to remove it if no longer needed. PR: ports/50840 Submitted by: Scot W. Hetzel <hetzels@westbend.net> Approved by: Maintainer timeout
69 lines
1.9 KiB
Bash
69 lines
1.9 KiB
Bash
#!/bin/sh
|
|
#
|
|
# $FreeBSD$
|
|
#
|
|
# This script copied from /etc/periodic/daily/110.clean-tmps,v 1.6.2.4 2002/10/13 19:59:01
|
|
#
|
|
# Perform attachment directory cleaning so that long-lived systems
|
|
# don't end up with excessively old files there.
|
|
#
|
|
|
|
# Define these variables in either /etc/periodic.conf or
|
|
# /etc/periodic.conf.local to override the default values.
|
|
#
|
|
# 111.clean-squirrelmail
|
|
clean_squirrelmail_enable="NO" # Delete squirrelmail attachments
|
|
clean_squirrelmail_dirs="/var/spool/squirrelmail/attach" # Delete under here
|
|
clean_squirrelmail_days="10" # If not accessed for
|
|
clean_squirrelmail_ignore="quota.user quota.group" # Don't delete these
|
|
clean_squirrelmail_verbose="YES" # Mention files deleted
|
|
|
|
# If there is a global system configuration file, suck it in.
|
|
#
|
|
if [ -r /etc/defaults/periodic.conf ]
|
|
then
|
|
. /etc/defaults/periodic.conf
|
|
source_periodic_confs
|
|
fi
|
|
|
|
case "$clean_squirrelmail_enable" in
|
|
[Yy][Ee][Ss])
|
|
if [ -z "$clean_squirrelmail_days" ]
|
|
then
|
|
echo '$clean_squirrelmail_enable is set but' \
|
|
'$clean_squirrelmail_days is not'
|
|
rc=2
|
|
else
|
|
echo ""
|
|
echo "Removing old SquirrelMail Attachment files:"
|
|
|
|
set -f noglob
|
|
args="-atime +$clean_squirrelmail_days -mtime +$clean_squirrelmail_days"
|
|
args="${args} -ctime +$clean_squirrelmail_days"
|
|
[ -n "$clean_squirrelmail_ignore" ] &&
|
|
args="$args "`echo " ${clean_squirrelmail_ignore% }" |
|
|
sed 's/[ ][ ]*/ ! -name /g'`
|
|
case "$clean_squirrelmail_verbose" in
|
|
[Yy][Ee][Ss])
|
|
print=-print;;
|
|
*)
|
|
print=;;
|
|
esac
|
|
|
|
rc=$(for dir in $clean_squirrelmail_dirs
|
|
do
|
|
[ ."${dir#/}" != ."$dir" -a -d $dir ] && cd $dir && {
|
|
find -d . -type f $args -delete $print
|
|
find -d . ! -name . -type d -empty -mtime \
|
|
+$clean_squirrelmail_days -delete $print
|
|
} | sed "s,^\\., $dir,"
|
|
done | tee /dev/stderr | wc -l)
|
|
[ -z "$print" ] && rc=0
|
|
[ $rc -gt 1 ] && rc=1
|
|
set -f glob
|
|
fi;;
|
|
|
|
*) rc=0;;
|
|
esac
|
|
|
|
exit $rc
|