Gentoo Forums
Gentoo Forums
Gentoo Forums
Quick Search: in
Local Portage Mirror on OpenWrt
View unanswered posts
View posts from last 24 hours

Reply to topic    Gentoo Forums Forum Index Documentation, Tips & Tricks
View previous topic :: View next topic  
Author Message

Joined: 27 Jun 2004
Posts: 255

PostPosted: Fri Mar 18, 2011 7:18 am    Post subject: Local Portage Mirror on OpenWrt Reply with quote

These are instructions to set up a local rsync mirror on top of an OpenWrt device, such as a hard drive equipped router. Much of this is adapted from Gentoo's documentation, with some additional tweaks for use on OpenWrt. Hopefully this will be useful to someone else as well.

1: Create the rsyncd configuration file:

Create /etc/rsyncd.conf with this content:
pid file = /var/run/
max connections = 5
use chroot = yes
uid = nobody
gid = nogroup
# hosts allow/deny are optional
hosts allow =
hosts deny = *

comment=Gentoo Portage
exclude=distfiles/ packages/

Note: /var is symlinked to /tmp, a tmpfs mount instead of flash.

2: Start the rsync daemon on startup
An initscript has been added to the rsync package.
/etc/init.d/rsyncd enable
/etc/init.d/rsyncd start

3: Teach rsync to fetch Gentoo's portage tree:

Create (or script name of your choice) on the usbdisk
OPTS="--quiet --recursive --links --perms --times -D --delete --timeout=300"

if [ -e /mnt/usbdisk/USB_DISK_NOT_PRESENT ]; then

${RSYNC} ${OPTS} ${SRC} ${DST}


4: Sync portage with a scheduled task

Open browser Administration → Services → Scheduled Tasks
18 4 * * * /mnt/usbdisk/bin/

Click submit

In a shell:
crontab -e
18 4 * * * /mnt/usbdisk/bin/

Note: OpenWrt's default editor is vi.

5 entries separated by spaces, then the command to run. Order is:
Minutes Hour DayOfTheMonth Month DayOfTheWeek
Entry above = 04:18 each morning, every day of the year.

5: Configure workstations to use the local mirror:

Edit /etc/make.conf. Add a line that reads:

Optional: Keep scheduled task from clobbering flash if usbdisk isn't mounted
While usbdisk is NOT mounted:
touch /mnt/usbdisk/USB_DISK_NOT_PRESENT
chmod 0444 /mnt/usbdisk -R

This serves as two lines of defense. The first is the readonly mountpoint. The second is the script aborts if USB_DISK_NOT_PRESENT is found, instead of the mounted files.
Back to top
View user's profile Send private message
Display posts from previous:   
Reply to topic    Gentoo Forums Forum Index Documentation, Tips & Tricks All times are GMT
Page 1 of 1

Jump to:  
You cannot post new topics in this forum
You cannot reply to topics in this forum
You cannot edit your posts in this forum
You cannot delete your posts in this forum
You cannot vote in polls in this forum