From: Thanasis <thanasis@asyr.hopto.org>
To: gentoo-user@lists.gentoo.org
Cc: dhk <dhkuhl@optonline.net>
Subject: Re: [gentoo-user] Updating a Standalone
Date: Fri, 12 Aug 2011 16:26:06 +0300 [thread overview]
Message-ID: <4E4529EE.6030408@asyr.hopto.org> (raw)
In-Reply-To: <4E44F92F.2000004@optonline.net>
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. ;)
next prev parent reply other threads:[~2011-08-12 13:27 UTC|newest]
Thread overview: 13+ messages / expand[flat|nested] mbox.gz Atom feed top
2011-08-12 9:58 [gentoo-user] Updating a Standalone dhk
2011-08-12 10:16 ` [gentoo-user] " Nikos Chantziaras
2011-08-12 10:25 ` Pandu Poluan
2011-08-12 10:35 ` dhk
2011-08-12 10:37 ` Mick
2011-08-12 11:53 ` James Broadhead
2011-08-12 14:21 ` Grant Edwards
2011-08-12 10:32 ` [gentoo-user] " Florian Philipp
2011-08-12 13:26 ` Thanasis [this message]
2011-08-12 14:08 ` Paul Hartman
2011-08-12 14:43 ` Thanasis
2011-08-24 21:34 ` dhk
2011-08-24 22:19 ` Neil Bothwick
Reply instructions:
You may reply publicly to this message via plain-text email
using any one of the following methods:
* Save the following mbox file, import it into your mail client,
and reply-to-all from there: mbox
Avoid top-posting and favor interleaved quoting:
https://en.wikipedia.org/wiki/Posting_style#Interleaved_style
* Reply using the --to, --cc, and --in-reply-to
switches of git-send-email(1):
git send-email \
--in-reply-to=4E4529EE.6030408@asyr.hopto.org \
--to=thanasis@asyr.hopto.org \
--cc=dhkuhl@optonline.net \
--cc=gentoo-user@lists.gentoo.org \
/path/to/YOUR_REPLY
https://kernel.org/pub/software/scm/git/docs/git-send-email.html
* If your mail client supports setting the In-Reply-To header
via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line
before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox