#!/usr/bin/env bash fetch_portage_tree() { if [[ ! -d /usr/portage/.git ]] ; then cd /usr/portage && git init > /dev/null 2>&1 git remote add origin git://anongit.gentoo.org/repo/gentoo.git git config core.sparsecheckout true echo "profiles/*" >> .git/info/sparse-checkout echo "metadata/*" >> .git/info/sparse-checkout echo "eclass/*" >> .git/info/sparse-checkout echo ".gitignore" >> .git/info/sparse-checkout git pull --depth=1 origin master > /dev/null 2>&1 git branch -u origin/master master > /dev/null 2>&1 rm -rf /usr/portage/profiles/updates > /dev/null 2>&1 fi } main() { fetch_portage_tree } main