Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

emerge-webrsync: Create repo location with $PORTAGE_USERNAME:$PORTAGE_GRPNAME ownership #1390

Draft
wants to merge 6 commits into
base: master
Choose a base branch
from
12 changes: 10 additions & 2 deletions bin/emerge-webrsync
Original file line number Diff line number Diff line change
Expand Up @@ -83,6 +83,7 @@ eval "$("${portageq}" envvar -v DISTDIR EPREFIX FEATURES \
PORTAGE_BIN_PATH PORTAGE_CONFIGROOT PORTAGE_GPG_DIR \
PORTAGE_NICENESS PORTAGE_REPOSITORIES PORTAGE_RSYNC_EXTRA_OPTS \
PORTAGE_RSYNC_OPTS PORTAGE_TEMP_GPG_DIR PORTAGE_TMPDIR \
PORTAGE_USERNAME PORTAGE_GRPNAME \
USERLAND http_proxy https_proxy ftp_proxy)"
export http_proxy https_proxy ftp_proxy

Expand Down Expand Up @@ -410,7 +411,7 @@ sync_local() {

[[ ${PORTAGE_QUIET} -eq 1 ]] || einfo "Syncing local repository ..."

local ownership="portage:portage"
local ownership="${PORTAGE_USERNAME}:${PORTAGE_GRPNAME}"
if has usersync ${FEATURES} ; then
case "${USERLAND}" in
BSD)
Expand Down Expand Up @@ -696,7 +697,14 @@ main() {

handle_pgp_setup

[[ -d ${repo_location} ]] || mkdir -p "${repo_location}"
if [[ ! -d ${repo_location} ]]; then
mkdir -p "${repo_location}" || die

if has usersync ${FEATURES} ; then
chown "${PORTAGE_USERNAME}":"${PORTAGE_GRPNAME}" "${repo_location}" || die
fi
fi

if [[ ! -w ${repo_location} ]] ; then
die "Repository '${repo_name}' is not writable: ${repo_location}"
fi
Expand Down