Changes

Jump to: navigation, search

Portage Git Mirror

1,840 bytes added, 2 years ago
Cloning from the local git mirror
== Use case ==
This tutorial The more local funtoo instances you are maintaining, the more useful this will be about hosting to you. This -- along with a local mirror of [[Portage_Distfiles_Mirror]] -- can make maintaining multiple funtoo git based portage treeinstances much faster, much more bandwidth efficient, and much less burdensome to upstream resources===Terminology used herein===
Following terms should be adapted
<table border="1">{{TableStart}}
<tr class="header">
<th align="left">Terms</th>
<td align="left">Base path of git-daemon</td>
</tr>
</table>{{TableEnd}}
== Local mirror ==
=== Git-daemon configuration Prepare directories and get portage tree ==={{console|body=###i## mkdir /home/git-mirrors###i## chown nobody /home/git-mirrors###i## su -s /bin/sh nobody$##bl## cd /home/git-mirrors$##bl## git clone --mirror --bare git://github.com/funtoo/ports-2012.git portage.git}}For security purposes we will use the {{c|nobody}} user .
Prepare directories and clone portage=== git-mini from github::<console>daemon configuration ===root@git.lan###i## mkdir {{file|name=/homeetc/git-mirrorsroot@gitconf.lan###i## chown nobody /homed/git-mirrorsdaemon|desc=|body=root@git.lan###i## su GITDAEMON_OPTS="--syslog --verbose --enable=receive-pack --export-s /bin/sh nobodyall"nobodyGITDAEMON_OPTS="$##bl## cd {GITDAEMON_OPTS} --base-path=/home/git-mirrorsnobody$##bl## /home/git clone -mirrors -mirror -interpolated-bare git:path=/home/github.com/funtoo/portagegit-mini-2011.git portage.gitmirrors"GIT_USER=nobodyGIT_GROUP=nobody</console>}}
Configure git-=== Service configuration ===To start daemon in <code>/etc/conf.d/with a mirror machine boot add {{c|git-daemon</code>:}} to default runlevel<{{console>|body=###i## nano /etc/conf.d/rc-update add git-daemondefaultGITDAEMON_OPTS=&quot;--syslog --verbose --enable=receive-pack --export-all&quot;}}GITDAEMON_OPTS=&quot;${GITDAEMON_OPTS} --base-path=To make changes start immediately just run <code>rc</home/git-mirrors /home/git-mirrors&quot;code>GIT_USER{{console|body=&quot;nobody&quot;GIT_GROUP=&quot;nobody&quot;###i## rc</console>}}
Start the daemon:<console>root@git.lan###i## /etc/init.d/git-daemon startroot@git.lan###i## rc-update add git-daemon default</console>=== Pull from remote ===
=== Pull from remote ===If desired, the local mirror can be updated periodically using {{c|cron}}. This example updates daily:
Add the following to <code>/etc/cron.daily/funtoo-sync.sh</code>:<console>###i## nano {{file|name=/etc/cron.daily/funtoo-sync.sh |desc=|body=
#!/bin/sh
cd /home/git-mirrors/portage.git
su nobody -s &quot;"/bin/sh&quot; " -c &quot;"git fetch "}} Then make the file executable:{{console|body=###i## chmod +x /etc/cron.daily/funtoo--all&quot;sync.sh</console>}}
== Cloning from You can also update the local gitmirror using {{c|emerge -daemon ==-sync}} or {{c|eix-sync}} if you have {{c|app-portage/eix}} installed.
Local clone = Cloning from <code>the local git mirror = In order to get a funtoo instance to sync with the local gitmirror, the instance's portage directory will need some work.lan</code>:<console>###i## mv The following is used with any funtoo instance you wish to use your local git mirror for its tree. This will change the git remote origin to point to your local {{c|git.lan}} origin, and then start using it. (This is an updated method which obviates the need to create a {{c|/usr/portage .old}} copy of the existing {{C|/usr/portage}} directory.old) ###i## git Local clone git://from {{c|git.lan/portage.git /usr/portage}}:{{console|body=
###i## cd /usr/portage
###i## git checkout funtooclone --depth 1 git://git.lan/portage.git tmp###i## rm -r .git###i## mv tmp/.git .org<###i## git reset --hard###i## chown -R portage:portage /console>usr/portage###i## eix-sync}}
{{note|Use {{c|emerge --sync}} if you do not have {{c|app-portage/eix}} installed.}}
 
A less reliable method is to leverage git's ability to switch between remote repositories.
It can lead to conflicts and is generally more difficult to deal with if you're unfamiliar with git.
 
{{note|github.com/funtoo/ports-2012 uses funtoo.org as its main branch. github.com/funtoo/ports-2017 uses master.
Substitute --track funtoo.org with --track master in the below command for the ports-2017 portage tree.
}}
 
Local clone from {{c|git.lan}}:
{{console|body=
###i## cd /usr/portage
###i## git remote show origin
###i## git remote rm origin
###i## git remote add --track funtoo.org origin git://git.lan/portage.git
###i## git remote show origin
###i## git branch --set-upstream-to=origin/master master
###i## emerge --sync
}}
[[Category:HOWTO]]
wiki-staff
10
edits

Navigation menu