on 08/12/2011 12:58 PM dhk wrote the following:
I have a Gentoo Box that is a standalone with no internet access. Is
there a way I can update it by using my laptop?
It would be nice to be able to sync a copy of my world list on my laptop
without clobbering my laptop's world list. Then do a fetch for the
standalone world and when on the console pf the standalone do the update
to the fetched packages on the laptop. The idea is not to have the
laptop as an image of the standalone, but as a server to sync to while
keeping the laptop's world separate.
Keep an updated image of the standalone on laptop, update it via chroot,
and sync back to the standalone.
ie:
fix CFLAGS=-march=... in etc/make.conf to reflect your cpu in
standalone pc.
rsync the standalone file system (excluding the virtual dirs, and /dev
and tmp dirs) to a standalone directory on laptop's disk or to an
external (usb) disk.
mount appropriate dirs in standalone
Better make an init script (like /etc/init.d/standalone), so you can
easily start/stop the mounts like:
#!/sbin/runscript
depend() {
need localmount
need bootmisc
}
start() {
ebegin Mounting chroot dirs
mount -o bind /dev /mnt/standalone/dev /dev/null
mount -o bind /dev/pts /mnt/standalone/dev/pts /dev/null
mount -o bind /dev/shm /mnt/standalone/dev/shm /dev/null
mount -o bind /proc /mnt/standalone/proc /dev/null
mount -o bind /proc/bus/usb /mnt/standalone/proc/bus/usb /dev/null
mount -o bind /sys /mnt/standalone/sys /dev/null
mount -o bind /tmp /mnt/standalone/tmp /dev/null
mount -o bind /usr/portage /mnt/standalone/usr/portage/ /dev/null
mount -o bind /usr/distfiles /mnt/standalone/usr/distfiles /dev/null
eend $? An error occured while attempting to mount chroot directories
ebegin Copying chroot files
cp -pf /etc/resolv.conf /mnt/standalone/etc /dev/null
cp -Ppf /etc/localtime /mnt/standalone/etc /dev/null
eend $? An error occured while attempting to copy chroot files.
}
stop() {
ebegin Unmounting chroot dirs
umount -f /mnt/standalone/dev/pts /dev/null
umount -f /mnt/standalone/dev/shm /dev/null
umount -f /mnt/standalone/dev /dev/null
umount -f /mnt/standalone/proc/bus/usb /dev/null
umount -f /mnt/standalone/proc /dev/null
umount -f /mnt/standalone/sys /dev/null
umount -f /mnt/standalone/tmp /dev/null
umount -f /mnt/standalone/usr/portage/ /dev/null
umount -f /mnt/standalone/usr/distfiles/ /dev/null
eend $? An error occured while attempting to unmount chroot
directories
}
then in laptop:
/etc/init.d/standalone start
linux64 chroot standalone /bin/bash
or (if standalone is 32bit)
linux32 chroot standalone /bin/bash
then once inside the chroot update the environment like:
cd env-update source /etc/profile export PS1='(standalone) \W # '
Then update as normal (emerge -DNuv world) ...etc (*)
Once finished, exit chroot and unmount:
exit /etc/init.d/standalone stop
connect laptop (or external disk) to standalone and sync the filesystem
back, but _taking_care_not_to_delete_directories_you_need_to_keep_ like
/home/...
eg, make a script like:
#!/bin/bash
( mount |grep standalone ) /etc/init.d/standalone stop
cd /mnt/standalone \
rsync -aHvx --exclude lost+found --delete boot/ standalone:/boot/ \
rsync -aHvx --exclude lost+found --delete bin/ standalone:/bin/ \
rsync -aHvx --exclude lost+found --delete sbin/ standalone:/sbin/ \
rsync -aHvx --exclude lost+found --delete usr/ standalone:/usr/ \
rsync -aHvx --exclude lost+found --delete lib/ standalone:/lib/ \
rsync -aHvx --exclude lost+found --delete mnt/ standalone:/mnt/ \
rsync -aHvx --exclude lost+found --delete net/ standalone:/net/ \
rsync -aHvx --exclude lost+found --delete misc/ standalone:/misc/ \
rsync -aHvx --exclude lost+found --delete var/ standalone:/var/ \
rsync -aHvx --exclude lost+found --delete media/ standalone:/media/ \
rsync -aHvx --exclude lost+found --delete opt/ standalone:/opt/ \
rsync -aHvx --exclude lost+found --delete etc/ standalone:/etc/ \
rsync -aHvx --exclude lost+found --delete root/ standalone:/root/ \
echo ALL DONE
(*) OR maybe this is safer, once in chroot environment, fetch the needed
distfiles only:
emerge -DNuvf world
then rsync the /usr/distfiles/ and portage dirs to the standalone's
machine dirs, and build the packages (update) on standalone.
And rsync the standalone fs to the standalone dir on laptop/disk when
you want to update again.
Hope you got the idea. ;)