mirror of
https://git.FreeBSD.org/ports.git
synced 2025-01-31 10:46:16 +00:00
mail/squirrelmail - Port Docs in wrong location
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
This commit is contained in:
parent
bd55e93b9c
commit
5140d21c9d
Notes:
svn2git
2021-03-31 03:12:20 +00:00
svn path=/head/; revision=98051
@ -7,6 +7,7 @@
|
||||
|
||||
PORTNAME= squirrelmail
|
||||
PORTVERSION= 1.4.2
|
||||
PORTREVISION= 1
|
||||
CATEGORIES?= mail www
|
||||
MASTER_SITES= ${MASTER_SITE_SOURCEFORGE}
|
||||
MASTER_SITE_SUBDIR= squirrelmail
|
||||
@ -23,18 +24,78 @@ RUN_DEPENDS+= ${LOCALBASE}/libexec/apache/libphp4.so:${PORTSDIR}/www/mod_php4
|
||||
.endif
|
||||
|
||||
USE_BZIP2= yes
|
||||
NO_BUILD= yes
|
||||
|
||||
.ifndef WITHOUT_WWWDIR
|
||||
SQUIRRELDIR?= ${PREFIX}/www/squirrelmail
|
||||
.else
|
||||
SQUIRRELDIR?= ${PREFIX}/squirrelmail
|
||||
.endif
|
||||
|
||||
PKGDEINSTALL= ${WRKDIR}/pkg-deinstall
|
||||
PKGINSTALL= ${WRKDIR}/pkg-install
|
||||
PKGMESSAGE= ${WRKDIR}/pkg-message
|
||||
|
||||
PLIST_SUB+= PORTVERSION=${PORTVERSION} \
|
||||
SQUIRRELDIR="${SQUIRRELDIR:S,^${PREFIX}/,,}"
|
||||
|
||||
pre-everything::
|
||||
@${ECHO_CMD} "SquirrelMail is installed into ${SQUIRRELDIR}"
|
||||
@${ECHO_CMD} "To use the old location ${PREFIX}/squirrelmail define"
|
||||
@${ECHO_CMD} "WITHOUT_WWWDIR when patching or installing"
|
||||
@${ECHO_CMD}
|
||||
|
||||
post-patch:
|
||||
.ifndef PATCH_DEBUG
|
||||
@${RM} ${WRKSRC}/config/config_default.php.orig
|
||||
.endif
|
||||
@${SED} -e "s;%%SQUIRRELDIR%%;${SQUIRRELDIR};g" \
|
||||
${.CURDIR}/pkg-install > ${PKGINSTALL}
|
||||
@${SED} -e "s;%%SQUIRRELDIR%%;${SQUIRRELDIR};g" \
|
||||
${.CURDIR}/pkg-deinstall > ${PKGDEINSTALL}
|
||||
@${SED} -e "s;%%SQUIRRELDIR%%;${SQUIRRELDIR};g" \
|
||||
${.CURDIR}/pkg-message > ${PKGMESSAGE}
|
||||
|
||||
# Rearrange the documentation
|
||||
do-build:
|
||||
.for file in AUTHORS ChangeLog COPYING INSTALL README UPGRADE
|
||||
@${MV} ${WRKSRC}/${file} ${WRKSRC}/doc/
|
||||
.endfor
|
||||
@${MV} ${WRKSRC}/ReleaseNotes ${WRKSRC}/doc/ReleaseNotes-${PORTVERSION}
|
||||
@${MV} ${WRKSRC}/themes/README.themes ${WRKSRC}/doc/
|
||||
@cd ${WRKSRC} ; for f in `find plugins -name "README*" -or \
|
||||
-name INSTALL -or -name CHANGES -or -name HISTORY`; \
|
||||
do \
|
||||
${MKDIR} doc/`dirname $$f` ; \
|
||||
${MV} $$f doc/`dirname $$f` ; \
|
||||
done; \
|
||||
${MV} doc/plugins/squirrelspell/doc/README doc/plugins/squirrelspell ; \
|
||||
${RM} -rf doc/plugins/squirrelspell/doc ; \
|
||||
${MV} plugins/squirrelspell/doc/* doc/plugins/squirrelspell ; \
|
||||
${RM} -f doc/plugins/squirrelspell/index.php ; \
|
||||
${RM} -rf plugins/squirrelspell/doc
|
||||
@${ECHO} "left_refresh=300" >> ${WRKSRC}/data/default_pref
|
||||
|
||||
pre-install:
|
||||
@${ECHO} "Your umask should be lax while installing this. Like, 022 or something."
|
||||
@${SH} ${PKGINSTALL} ${PKGNAME} PRE-INSTALL
|
||||
|
||||
do-install:
|
||||
${MKDIR} ${PREFIX}/squirrelmail
|
||||
${CP} -R ${WRKSRC}/* ${PREFIX}/squirrelmail
|
||||
${CHOWN} -R www:www ${PREFIX}/squirrelmail/data
|
||||
${MKDIR} ${PREFIX}/etc/periodic/daily
|
||||
${INSTALL_SCRIPT} ${FILESDIR}/111.clean-squirrelmail ${PREFIX}/etc/periodic/daily
|
||||
${MKDIR} ${SQUIRRELDIR}
|
||||
${CP} -p ${WRKSRC}/index.php ${SQUIRRELDIR}
|
||||
${CP} -p ${WRKSRC}/configure ${SQUIRRELDIR}
|
||||
.for DIR in class config data functions help images include locale plugins po src themes
|
||||
${CP} -rp ${WRKSRC}/${DIR} ${SQUIRRELDIR}
|
||||
.endfor
|
||||
${CHOWN} -R ${WWWOWN}:${WWWGRP} ${SQUIRRELDIR}/data
|
||||
.if !defined(NOPORTDOCS)
|
||||
${MKDIR} ${DOCSDIR}
|
||||
${CP} -R ${WRKSRC}/doc/* ${DOCSDIR}
|
||||
.endif
|
||||
|
||||
post-install:
|
||||
@${SED} -e 's,%%PREFIX%%,${PREFIX},g' ${PKGMESSAGE}
|
||||
#@${SH} ${PKGINSTALL} ${PKGNAME} POST-INSTALL
|
||||
@${CAT} ${PKGMESSAGE}
|
||||
|
||||
.include <bsd.port.mk>
|
||||
|
69
mail/squirrelmail/files/111.clean-squirrelmail
Normal file
69
mail/squirrelmail/files/111.clean-squirrelmail
Normal file
@ -0,0 +1,69 @@
|
||||
#!/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
|
20
mail/squirrelmail/files/patch-config-config_default.php
Normal file
20
mail/squirrelmail/files/patch-config-config_default.php
Normal file
@ -0,0 +1,20 @@
|
||||
--- config/config_default.php.orig Thu Aug 21 03:14:08 2003
|
||||
+++ config/config_default.php Tue Jan 13 00:57:57 2004
|
||||
@@ -220,7 +220,7 @@
|
||||
* $data_dir = SM_PATH . 'data/';
|
||||
*/
|
||||
global $data_dir;
|
||||
-$data_dir = SM_PATH . 'data/';
|
||||
+$data_dir = '/var/spool/squirrelmail/pref/';
|
||||
|
||||
/**
|
||||
* Path to directory used for storing attachments while a mail is
|
||||
@@ -236,7 +236,7 @@
|
||||
* + It should probably be another directory than data_dir.
|
||||
*/
|
||||
global $attachment_dir;
|
||||
-$attachment_dir = "$data_dir";
|
||||
+$attachment_dir = '/var/spool/squirrelmail/attach/';
|
||||
|
||||
/* Hash level used for data directory. */
|
||||
global $dir_hash_level;
|
@ -1,4 +1,12 @@
|
||||
#!/bin/sh
|
||||
#
|
||||
# $FreeBSD$
|
||||
#
|
||||
|
||||
PKG_BATCH=${BATCH:=NO}
|
||||
PKG_PREFIX=${PKG_PREFIX:=/usr/local}
|
||||
|
||||
SQUIRRELDIR=%%SQUIRRELDIR%%
|
||||
|
||||
case $2 in
|
||||
PRE-INSTALL)
|
||||
@ -28,10 +36,21 @@ PRE-INSTALL)
|
||||
fi
|
||||
fi
|
||||
|
||||
install -d -o www -g www -m 0755 /var/spool/squirrelmail
|
||||
|
||||
exit 0
|
||||
;;
|
||||
POST-INSTALL)
|
||||
if [ "${PKG_BATCH}" = "NO" ]; then
|
||||
install -d -o www -g www -m 0755 /var/spool/squirrelmail
|
||||
install -d -o www -g www -m 0730 /var/spool/squirrelmail/attach
|
||||
install -d -o www -g www -m 0750 /var/spool/squirrelmail/pref
|
||||
if [ ! -f /var/spool/squirrelmail/pref/default_pref ]; then
|
||||
cp -rp ${SQUIRRELDIR}/data/default_pref \
|
||||
/var/spool/squirrelmail/pref/default_pref
|
||||
else
|
||||
echo "An older version of default_pref exists in"
|
||||
echo "/var/spool/squirrelmail/pref, you may want to"
|
||||
echo "compare it with the one in ${SQUIRRELDIR}/data"
|
||||
fi
|
||||
fi
|
||||
;;
|
||||
esac
|
||||
|
@ -1,8 +1,8 @@
|
||||
|
||||
You now need to add an alias to apache's httpd.conf pointing to
|
||||
%%PREFIX%%/squirrelmail/ in order to access SquirrelMail from your
|
||||
web browser, or create a VirtualHost with DocumentRoot set to that
|
||||
directory.
|
||||
%%SQUIRRELDIR%% in order to access SquirrelMail from
|
||||
your web browser, or create a VirtualHost with DocumentRoot set
|
||||
to that directory.
|
||||
|
||||
For SquirrelMail to work properly you will need to make sure the
|
||||
following option is set in your php.ini file:
|
||||
@ -13,5 +13,5 @@ you just have, the following php.ini option may help:
|
||||
session.auto_start = 1
|
||||
|
||||
In order to do your administrative configuration you need to
|
||||
cd %%PREFIX%%/squirrelmail && ./configure
|
||||
cd %%SQUIRRELDIR%% && ./configure
|
||||
SquirrelMail will not work until this has been done.
|
||||
|
File diff suppressed because it is too large
Load Diff
Loading…
Reference in New Issue
Block a user