type portageq > /dev/null || exit $?
eval $(portageq envvar -v CONFIG_PROTECT \
- CONFIG_PROTECT_MASK PORTAGE_CONFIGROOT PORTAGE_TMPDIR EROOT USERLAND)
+ CONFIG_PROTECT_MASK PORTAGE_CONFIGROOT PORTAGE_INST_GID PORTAGE_INST_UID \
+ PORTAGE_TMPDIR EROOT USERLAND)
export PORTAGE_TMPDIR
TMP="${PORTAGE_TMPDIR}/etc-update-$$"
mkdir "${TMP}" || die "failed to create temp dir" 1
# make sure we have a secure directory to work in
chmod 0700 "${TMP}" || die "failed to set perms on temp dir" 1
-chown ${UID:-0}:${GID:-0} "${TMP}" || die "failed to set ownership on temp dir" 1
+chown ${PORTAGE_INST_UID:-0}:${PORTAGE_INST_GID:-0} "${TMP}" || \
+ die "failed to set ownership on temp dir" 1
# I need the CONFIG_PROTECT value
#CONFIG_PROTECT=$(/usr/lib/portage/bin/portageq envvar CONFIG_PROTECT)