Move the cache hook to repo.postsync.d and adjust it accordingly

This commit is contained in:
Marios Titas 2015-08-21 01:06:24 +01:00
parent d70b7b6056
commit 44070da3d7
3 changed files with 20 additions and 34 deletions

View File

@ -1,9 +0,0 @@
#!/bin/bash
source /etc/portage/util-functions.sh
if [[ -z ${PORTDIR} || "$(dirname ${PORTDIR})" == "/" ]] ; then
die "PORTDIR empty or pointing to root!"
elif [[ ! -e ${PORTDIR} ]] ; then
die "${PORTDIR} does not exist!"
fi

View File

@ -1,25 +0,0 @@
#!/bin/bash
source /etc/portage/check-portdir.sh
source /etc/init.d/functions.sh
source /etc/portage/util-functions.sh
# You may change this to only update cache of specific repositories.
# Should at least include 'gentoo'. Default is all repositories.
repository_list=( $(portageq get_repos /) )
# Number of jobs for egencache, default is number or processors.
parallel_jobs="$(nproc)"
ebegin "Fetching pre-generated metadata cache for gentoo repository"
rsync -aq rsync://rsync.gentoo.org/gentoo-portage/metadata/md5-cache/ "${PORTDIR}"/metadata/md5-cache/
eend $?
einfo "Updating metadata cache for repositories:"
for repo in "${repository_list[@]}"; do
ebegin " ${repo}"
egencache --jobs="${parallel_jobs}" --repo="${repo}" --update --update-use-local-desc
eend $?
done

View File

@ -0,0 +1,20 @@
#!/bin/bash
source /etc/init.d/functions.sh
source /etc/portage/util-functions.sh
repository_name=${1}
repository_path=${3}
# Number of jobs for egencache, default is number or processors.
parallel_jobs="$(nproc)"
if [ "${repository_name}" == "gentoo" ]; then
ebegin "Fetching pre-generated metadata cache for ${repository_name}"
rsync -aq rsync://rsync.gentoo.org/gentoo-portage/metadata/md5-cache/ "${repository_path}"/metadata/md5-cache/
eend $?
ebegin "Updating metadata cache for ${repository_name}"
egencache --jobs="${parallel_jobs}" --repo="${repository_name}" --update --update-use-local-desc
eend $?
fi