freebsd-ports/mail/squirrelmail/pkg-install
Edwin Groothuis 5140d21c9d 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
2004-01-13 09:14:24 +00:00

56 lines
1.2 KiB
Bash

#!/bin/sh
#
# $FreeBSD$
#
PKG_BATCH=${BATCH:=NO}
PKG_PREFIX=${PKG_PREFIX:=/usr/local}
SQUIRRELDIR=%%SQUIRRELDIR%%
case $2 in
PRE-INSTALL)
USER=www
GROUP=${USER}
UID=80
GID=${UID}
if ! pw groupshow "${GROUP}" 2>/dev/null 1>&2; then
if pw groupadd ${GROUP} -g ${GID}; then
echo "Added group \"${GROUP}\"."
else
echo "Adding group \"${GROUP}\" failed..."
exit 1
fi
fi
if ! pw usershow "${USER}" 2>/dev/null 1>&2; then
if pw useradd ${USER} -u ${UID} -g ${GROUP} -h - \
-s "/sbin/nologin" -d "/nonexistent" \
-c "World Wide Web Owner"; \
then
echo "Added user \"${USER}\"."
else
echo "Adding user \"${USER}\" failed..."
exit 1
fi
fi
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