The newer versions of sudo let the user only inherit a limited set of the environment variables.
However, you can add environment variables you want to inherit through the
/etc/sudoers file.
From my OpenBSD box (sudo is maintained by OpenBSD developers):
Code:
# $OpenBSD: sudoers,v 1.12 2007/08/09 16:12:08 ajacoutot Exp $
#
# sudoers file.
#
# This file MUST be edited with the 'visudo' command as root.
#
# See the sudoers man page for the details on how to write a sudoers file.
#
# Host alias specification
# User alias specification
# Cmnd alias specification
# Defaults specification
Defaults env_keep +="DESTDIR FETCH_CMD FLAVOR FTPMODE MAKE MULTI_PACKAGES OKAY_FILES PKG_DBDIR PKG_D
ESTDIR PKG_CACHE PKG_PATH PKG_TMPDIR PORTSDIR RELEASEDIR SUBPACKAGE"
You see here some OpenBSD specific environment variables for the OpenBSD ports and package system like PKG_PATH and PKG_CACHE.
By adding PACKAGESITE to your FreeBSD
sudoers file you will have solved this nasty issue