diff --git a/chroot_version_hooks.d/38_host_userpriv b/chroot_version_hooks.d/38_host_userpriv index 8178f88069..9b297056db 100644 --- a/chroot_version_hooks.d/38_host_userpriv +++ b/chroot_version_hooks.d/38_host_userpriv @@ -2,16 +2,6 @@ # Use of this source code is governed by a BSD-style license that can be # found in the LICENSE file. -# Migrate to userpriv for building things. We need to clean out old -# dirs that might have files owned by root:root. - -eval $(portageq envvar -v PORTAGE_{TMPDIR,USERNAME,GRPNAME} DISTDIR PKGDIR) -: ${PORTAGE_TMPDIR:=/var/tmp/portage} -: ${PORTAGE_USERNAME:=${USER}} -: ${PORTAGE_GRPNAME:=portage} -: ${DISTDIR:=/var/cache/distfiles/host} -: ${PKGDIR:=/var/lib/portage/pkgs} - -exec sudo find "${PORTAGE_TMPDIR}" "${DISTDIR}" "${PKGDIR}" \ - '(' -uid 0 -o -gid 0 ')' \ - -exec chown -h "${PORTAGE_USERNAME}:${PORTAGE_GRPNAME}" {} + +# The previous one had a bug, so we moved it to 39 and fixed the bug +# (missing -H flag to find). +exit 0 diff --git a/chroot_version_hooks.d/39_host_userpriv_better b/chroot_version_hooks.d/39_host_userpriv_better new file mode 100644 index 0000000000..056c9cf6f4 --- /dev/null +++ b/chroot_version_hooks.d/39_host_userpriv_better @@ -0,0 +1,17 @@ +# Copyright (c) 2012 The Chromium OS Authors. All rights reserved. +# Use of this source code is governed by a BSD-style license that can be +# found in the LICENSE file. + +# Migrate to userpriv for building things. We need to clean out old +# dirs that might have files owned by root:root. + +eval $(portageq envvar -v PORTAGE_{TMPDIR,USERNAME,GRPNAME} DISTDIR PKGDIR) +: ${PORTAGE_TMPDIR:=/var/tmp/portage} +: ${PORTAGE_USERNAME:=${USER}} +: ${PORTAGE_GRPNAME:=portage} +: ${DISTDIR:=/var/cache/distfiles/host} +: ${PKGDIR:=/var/lib/portage/pkgs} + +exec sudo find -H "${PORTAGE_TMPDIR}" "${DISTDIR}" "${PKGDIR}" \ + '(' -uid 0 -o -gid 0 ')' \ + -exec chown -h "${PORTAGE_USERNAME}:${PORTAGE_GRPNAME}" {} +