diff options
author | garga <garga@FreeBSD.org> | 2006-08-09 03:33:04 +0800 |
---|---|---|
committer | garga <garga@FreeBSD.org> | 2006-08-09 03:33:04 +0800 |
commit | 5915a5cd8b72c050fc518ef6a29af0e520d32a01 (patch) | |
tree | 989e32d0616d00d3fd1c3de0645c233aa6f473c0 /security/clamav | |
parent | a7d300e16131e12fc449521e7ef24e8546f1b7a1 (diff) | |
download | freebsd-ports-gnome-5915a5cd8b72c050fc518ef6a29af0e520d32a01.tar.gz freebsd-ports-gnome-5915a5cd8b72c050fc518ef6a29af0e520d32a01.tar.zst freebsd-ports-gnome-5915a5cd8b72c050fc518ef6a29af0e520d32a01.zip |
Respect DESTDIR
Reworked by: gabor
Tested by: gabor
Diffstat (limited to 'security/clamav')
-rw-r--r-- | security/clamav/Makefile | 25 | ||||
-rw-r--r-- | security/clamav/files/pkg-install.in | 57 |
2 files changed, 46 insertions, 36 deletions
diff --git a/security/clamav/Makefile b/security/clamav/Makefile index e4f1e8684678..7a611b93a3be 100644 --- a/security/clamav/Makefile +++ b/security/clamav/Makefile @@ -39,7 +39,7 @@ PLIST_SUB+= DBDIR=${DBDIR} LOGDIR=${LOGDIR} RUNDIR=${RUNDIR} CONFIGURE_ARGS= --with-dbdir=${DBDIR} \ --with-zlib=/usr \ - --mandir=${MANPREFIX}/man \ + --mandir=${MANPREFIX:S/^${DESTDIR}//}/man \ --disable-zlib-vcheck \ --disable-clamuko \ --disable-clamav \ @@ -66,7 +66,8 @@ CLAMAV_CLAMD_SOCKET?= ${RUNDIR}/clamd CLAMAV_MILTER_SOCKET?= ${RUNDIR}/clmilter.sock SUB_FILES= pkg-install pkg-deinstall -SUB_LIST= DBDIR=${DBDIR} \ +SUB_LIST+= DESTDIR=${DESTDIR} \ + DBDIR=${DBDIR} \ LOGDIR=${LOGDIR} \ RUNDIR=${RUNDIR} \ CLAMAVUSER=${CLAMAVUSER} \ @@ -152,24 +153,24 @@ post-build: @${REINPLACE_CMD} ${SED_CONF} ${BUILD_WRKSRC}/etc/freshclam.conf pre-install: - @${SETENV} PKG_PREFIX=${PREFIX} PKG_DESTDIR=${DESTDIR} \ - ${SH} ${PKGINSTALL} ${PREFIX} PRE-INSTALL + @${SETENV} PKG_PREFIX=${PREFIX} \ + ${SH} ${PKGINSTALL} ${PKGNAME} PRE-INSTALL post-install: @${CHOWN} -R ${CLAMAVUSER}:${CLAMAVGROUP} ${DESTDIR}${DBDIR} .for c in clamd freshclam - @[ -f ${DESTDIR}${PREFIX}/etc/${c}.conf ] || \ - ${CP} ${DESTDIR}${PREFIX}/etc/${c}.conf.default ${DESTDIR}${PREFIX}/etc/${c}.conf + @[ -f ${TARGETDIR}/etc/${c}.conf ] || \ + ${CP} ${TARGETDIR}/etc/${c}.conf.default ${TARGETDIR}/etc/${c}.conf .endfor .if !defined(NOPORTDOCS) - @${MKDIR} ${DESTDIR}${DOCSDIR} + @${MKDIR} ${DOCSDIR} @${INSTALL_DATA} ${INSTALL_WRKSRC}/NEWS ${INSTALL_WRKSRC}/ChangeLog \ - ${DESTDIR}${DOCSDIR} - @${MKDIR} ${DESTDIR}${DOCSDIR}/html + ${DOCSDIR} + @${MKDIR} ${DOCSDIR}/html @${INSTALL_DATA} ${INSTALL_WRKSRC}/docs/html/*.* \ - ${DESTDIR}${DOCSDIR}/html + ${DOCSDIR}/html .endif - @${SETENV} PKG_PREFIX=${PREFIX} PKG_DESTDIR=${DESTDIR} \ - ${SH} ${PKGINSTALL} ${PREFIX} POST-INSTALL + @${SETENV} PKG_PREFIX=${PREFIX} \ + ${SH} ${PKGINSTALL} ${PKGNAME} POST-INSTALL .include <bsd.port.post.mk> diff --git a/security/clamav/files/pkg-install.in b/security/clamav/files/pkg-install.in index 3a5a36371c91..729a0036f07c 100644 --- a/security/clamav/files/pkg-install.in +++ b/security/clamav/files/pkg-install.in @@ -1,60 +1,69 @@ #!/bin/sh -# $FreeBSD: /tmp/pcvs/ports/security/clamav/files/pkg-install.in,v 1.1 2005-05-13 08:16:40 jylefort Exp $ +# $FreeBSD: /tmp/pcvs/ports/security/clamav/files/pkg-install.in,v 1.2 2006-08-08 19:33:04 garga Exp $ PREFIX=${PKG_PREFIX:-%%PREFIX%%} -DESTDIR=${PKG_DESTDIR:-} CLAMAVUSER=%%CLAMAVUSER%% CLAMAVGROUP=%%CLAMAVGROUP%% UID=106 GID=$UID -DBDIR=$DESTDIR%%DBDIR%% -LOGDIR=$DESTDIR%%LOGDIR%% -RUNDIR=$DESTDIR%%RUNDIR%% +DBDIR=%%DBDIR%% +LOGDIR=%%LOGDIR%% +RUNDIR=%%RUNDIR%% + +if [ -n "%%DESTDIR%%" ]; then + PW="/usr/sbin/chroot %%DESTDIR%% pw" + CHOWN="/usr/sbin/chroot %%DESTDIR%% chown" + MKDIR="/usr/sbin/chroot %%DESTDIR%% mkdir -p" +else + PW="pw" + CHOWN="chown" + MKDIR="mkdir -p" +fi if [ "$2" = "PRE-INSTALL" ]; then - if ! pw groupshow "$CLAMAVGROUP" 2>/dev/null 1>&2; then - if pw groupadd $CLAMAVGROUP -g $GID; then - echo "=> Added group \"$CLAMAVGROUP\"." + if ! ${PW} groupshow ${CLAMAVGROUP} 2>/dev/null 1>&2; then + if ${PW} groupadd ${CLAMAVGROUP} -g $GID; then + echo "=> Added group \"${CLAMAVGROUP}\"." else - echo "=> Adding group \"$CLAMAVGROUP\" failed..." + echo "=> Adding group \"${CLAMAVGROUP}\" failed..." exit 1 fi fi - if ! pw usershow "$CLAMAVUSER" 2>/dev/null 1>&2; then - if pw useradd $CLAMAVUSER -u $UID -g $CLAMAVGROUP -h - \ + if ! ${PW} usershow ${CLAMAVUSER} 2>/dev/null 1>&2; then + if ${PW} useradd ${CLAMAVUSER} -u $UID -g ${CLAMAVGROUP} -h - \ -s "/sbin/nologin" -d "/nonexistent" \ -c "Clam Antivirus"; \ then - pw groupmod mail -m $CLAMAVUSER - echo "=> Added user \"$CLAMAVUSER\"." + ${PW} groupmod mail -m ${CLAMAVUSER} + echo "=> Added user \"${CLAMAVUSER}\"." else - echo "=> Adding user \"$CLAMAVUSER\" failed..." + echo "=> Adding user \"${CLAMAVUSER}\" failed..." exit 1 fi fi elif [ "$2" = "POST-INSTALL" ]; then - if [ ! -d "$DBDIR" ]; then - mkdir -p "$DBDIR" || exit 1 - chown "$CLAMAVUSER:$CLAMAVGROUP" "$DBDIR" || exit 1 + if [ ! -d "${DESTDIR}${DBDIR}" ]; then + ${MKDIR} ${DBDIR} || exit 1 + ${CHOWN} ${CLAMAVUSER}:${CLAMAVGROUP} ${DBDIR} || exit 1 fi - if [ ! -d "$LOGDIR" ]; then - mkdir -p "$LOGDIR" || exit 1 - chown "$CLAMAVUSER:$CLAMAVGROUP" "$LOGDIR" || exit 1 + if [ ! -d "${DESTDIR}${LOGDIR}" ]; then + ${MKDIR} ${LOGDIR} || exit 1 + ${CHOWN} ${CLAMAVUSER}:${CLAMAVGROUP} ${LOGDIR} || exit 1 fi - if [ ! -d "$RUNDIR" ]; then - mkdir -p "$RUNDIR" || exit 1 - chown "$CLAMAVUSER:$CLAMAVGROUP" "$RUNDIR" || exit 1 + if [ ! -d "${DESTDIR}${RUNDIR}" ]; then + ${MKDIR} ${RUNDIR} || exit 1 + ${CHOWN} ${CLAMAVUSER}:${CLAMAVGROUP} ${RUNDIR} || exit 1 fi - if [ -f "$DESTDIR$PREFIX/etc/clamav.conf" ]; then + if [ -f "${TARGETDIR}/etc/clamav.conf" ]; then echo echo "**************** WARNING ****************" echo "* *" |