From 9ed46667dbeee834f03c5f40d5231c0695bc4e7a Mon Sep 17 00:00:00 2001 From: Zac Medico Date: Sat, 18 Aug 2012 16:59:41 -0700 Subject: [PATCH] emerge-webrsync: use ${PORTAGE_TMPDIR}/portage For consistency with commit 83e677766650e73071813c0d46547647e5f66029. --- bin/emerge-webrsync | 18 +++++++++--------- 1 file changed, 9 insertions(+), 9 deletions(-) diff --git a/bin/emerge-webrsync b/bin/emerge-webrsync index 11d608ff6..5cba6b045 100755 --- a/bin/emerge-webrsync +++ b/bin/emerge-webrsync @@ -464,23 +464,23 @@ main() { exit 1 fi - TMPDIR=${PORTAGE_TMPDIR}/emerge-webrsync - ${keep} || DISTDIR=${TMPDIR} + [[ -d ${PORTAGE_TMPDIR}/portage ]] || mkdir -p "${PORTAGE_TMPDIR}/portage" + TMPDIR=$(mktemp -d "${PORTAGE_TMPDIR}/portage/webrsync-XXXXXX") + if [[ ! -w ${TMPDIR} ]] ; then + eecho "TMPDIR is not writable: ${TMPDIR}" + exit 1 + fi + trap 'cd / ; rm -rf "${TMPDIR}"' EXIT + cd "${TMPDIR}" || exit 1 - [ ! -d "${TMPDIR}" ] && mkdir -p "${TMPDIR}" + ${keep} || DISTDIR=${TMPDIR} [ ! -d "${DISTDIR}" ] && mkdir -p "${DISTDIR}" - cd "${TMPDIR}" || exit 1 if ${keep} && [[ ! -w ${DISTDIR} ]] ; then eecho "DISTDIR is not writable: ${DISTDIR}" exit 1 fi - if [[ ! -w ${TMPDIR} ]] ; then - eecho "TMPDIR is not writable: ${TMPDIR}" - exit 1 - fi - # This is a sanity check to help prevent people like funtoo users # from accidentally wiping out their git tree. if [[ -n $SYNC && ${SYNC#rsync:} = $SYNC ]] ; then -- 2.26.2