├── repos.conf └── gentoo.conf ├── repo.postsync.d ├── sync_gentoo_projects_xml ├── sync_gentoo_dtd ├── sync_overlay_cache ├── sync_gentoo_glsa ├── sync_gentoo_news └── sync_gentoo_cache └── README.md /repos.conf/gentoo.conf: -------------------------------------------------------------------------------- 1 | [DEFAULT] 2 | main-repo = gentoo 3 | 4 | [gentoo] 5 | location = /usr/portage 6 | sync-type = git 7 | sync-uri = https://github.com/gentoo/gentoo.git 8 | auto-sync = yes 9 | 10 | # for daily squashfs snapshots 11 | #sync-type = squashdelta 12 | #sync-uri = mirror://gentoo/../snapshots/squashfs 13 | -------------------------------------------------------------------------------- /repo.postsync.d/sync_gentoo_projects_xml: -------------------------------------------------------------------------------- 1 | #!/bin/bash 2 | 3 | repository_name="${1}" 4 | repository_path="${3}" 5 | 6 | [[ ${repository_name} == "gentoo" ]] || exit 0 7 | 8 | source /lib/gentoo/functions.sh 9 | 10 | ebegin "Updating projects.xml" 11 | wget -q -P "${repository_path}"/metadata/ -N https://api.gentoo.org/metastructure/projects.xml 12 | eend $? 13 | -------------------------------------------------------------------------------- /repo.postsync.d/sync_gentoo_dtd: -------------------------------------------------------------------------------- 1 | #!/bin/bash 2 | 3 | repository_name="${1}" 4 | repository_path="${3}" 5 | 6 | [[ ${repository_name} == "gentoo" ]] || exit 0 7 | 8 | source /lib/gentoo/functions.sh 9 | 10 | DTDDIR="${repository_path}"/metadata/dtd 11 | ebegin "Updating DTDs" 12 | if [[ -e ${DTDDIR} ]]; then 13 | git -C "${DTDDIR}" pull -q --ff-only 14 | else 15 | git clone -q https://anongit.gentoo.org/git/data/dtd.git "${DTDDIR}" 16 | fi 17 | eend "$?" 18 | -------------------------------------------------------------------------------- /repo.postsync.d/sync_overlay_cache: -------------------------------------------------------------------------------- 1 | #!/bin/bash 2 | 3 | repository_name="${1}" 4 | 5 | [[ ${repository_name} == "gentoo" ]] && exit 0 6 | 7 | source /lib/gentoo/functions.sh 8 | 9 | # Number of jobs for egencache, default is number or processors. 10 | parallel_jobs="$(nproc)" 11 | 12 | ebegin "Updating metadata cache for ${repository_name}" 13 | egencache --jobs="${parallel_jobs}" --repo="${repository_name}" --update --update-use-local-desc 14 | eend $? 15 | -------------------------------------------------------------------------------- /repo.postsync.d/sync_gentoo_glsa: -------------------------------------------------------------------------------- 1 | #!/bin/bash 2 | 3 | repository_name="${1}" 4 | repository_path="${3}" 5 | 6 | [[ ${repository_name} == "gentoo" ]] || exit 0 7 | 8 | source /lib/gentoo/functions.sh 9 | 10 | GLSADIR="${repository_path}"/metadata/glsa 11 | ebegin "Updating GLSAs" 12 | if [[ -e ${GLSADIR} ]]; then 13 | git -C "${GLSADIR}" pull -q --ff-only 14 | else 15 | git clone -q https://anongit.gentoo.org/git/data/glsa.git "${GLSADIR}" 16 | fi 17 | eend "$?" 18 | -------------------------------------------------------------------------------- /repo.postsync.d/sync_gentoo_news: -------------------------------------------------------------------------------- 1 | #!/bin/bash 2 | 3 | repository_name="${1}" 4 | repository_path="${3}" 5 | 6 | [[ ${repository_name} == "gentoo" ]] || exit 0 7 | 8 | source /lib/gentoo/functions.sh 9 | 10 | NEWSDIR="${repository_path}"/metadata/news 11 | ebegin "Updating news items" 12 | if [[ -e ${NEWSDIR} ]]; then 13 | git -C "${NEWSDIR}" pull -q --ff-only 14 | else 15 | git clone -q https://anongit.gentoo.org/git/data/gentoo-news.git "${NEWSDIR}" 16 | fi 17 | eend $? "Try to remove ${NEWSDIR}" 18 | -------------------------------------------------------------------------------- /README.md: -------------------------------------------------------------------------------- 1 | This is not a full portage configuration. It contains only those parts that are 2 | necessary to set up a gentoo github mirror based sync system: 3 | 4 | * Configures Portage to sync via https://github.com/gentoo/gentoo.git URL. 5 | * Updates metadata-cache. 6 | * Updates the dtd directory. 7 | * Updates the glsa directory. 8 | * Updates `projects.xml` file 9 | * Updates the news directory. 10 | 11 | ## Notes ## 12 | 13 | If you want your overlay metadata caches to be automatically regenerated 14 | as well, do: 15 | ```sh 16 | chmod +x /etc/portage/repo.postsync.d/sync_overlay_cache 17 | ``` 18 | -------------------------------------------------------------------------------- /repo.postsync.d/sync_gentoo_cache: -------------------------------------------------------------------------------- 1 | #!/bin/bash 2 | 3 | repository_name="${1}" 4 | repository_path="${3}" 5 | 6 | [[ ${repository_name} == "gentoo" ]] || exit 0 7 | 8 | source /lib/gentoo/functions.sh 9 | 10 | # Number of jobs for egencache, default is number or processors. 11 | parallel_jobs="$(nproc)" 12 | 13 | if [[ -f ${repository_path}/metadata/timestamp.x ]]; then 14 | portage_current_timestamp=$(cut -f 1 -d " " "${repository_path}/metadata/timestamp.x" ) 15 | else 16 | portage_current_timestamp=0 17 | fi 18 | 19 | ebegin "Fetching metadata timestamp for ${repository_name}" 20 | rsync -aq rsync://rsync.gentoo.org/gentoo-portage/metadata/timestamp.x "${repository_path}"/metadata/timestamp.x 21 | eend $? 22 | portage_new_timestamp=$(cut -f 1 -d " " "${repository_path}/metadata/timestamp.x" ) 23 | 24 | if [[ ${portage_current_timestamp} -lt ${portage_new_timestamp} ]]; then 25 | ebegin "Fetching pre-generated metadata cache for ${repository_name}" 26 | rsync -aq rsync://rsync.gentoo.org/gentoo-portage/metadata/md5-cache/ "${repository_path}"/metadata/md5-cache/ 27 | eend $? 28 | else 29 | einfo "Metadata cache for ${repository_name} already recent, no need to fetch it :-)" 30 | fi 31 | 32 | ebegin "Updating metadata cache for ${repository_name}" 33 | egencache --jobs="${parallel_jobs}" --repo="${repository_name}" --update --update-use-local-desc 34 | eend $? 35 | --------------------------------------------------------------------------------