1 |
on 08/12/2011 12:58 PM dhk wrote the following: |
2 |
> I have a Gentoo Box that is a standalone with no internet access. Is |
3 |
> there a way I can update it by using my laptop? |
4 |
> |
5 |
> It would be nice to be able to sync a copy of my world list on my laptop |
6 |
> without clobbering my laptop's world list. Then do a fetch for the |
7 |
> standalone world and when on the console pf the standalone do the update |
8 |
> to the fetched packages on the laptop. The idea is not to have the |
9 |
> laptop as an image of the standalone, but as a server to sync to while |
10 |
> keeping the laptop's world separate. |
11 |
|
12 |
Keep an updated image of the standalone on laptop, update it via chroot, |
13 |
and sync back to the standalone. |
14 |
|
15 |
ie: |
16 |
|
17 |
fix CFLAGS="-march=..." in etc/make.conf to reflect your cpu in |
18 |
standalone pc. |
19 |
|
20 |
rsync the standalone file system (excluding the virtual dirs, and /dev |
21 |
and tmp dirs) to a <standalone> directory on laptop's disk or to an |
22 |
external (usb) disk. |
23 |
|
24 |
mount appropriate dirs in <standalone> |
25 |
|
26 |
Better make an init script (like /etc/init.d/standalone), so you can |
27 |
easily start/stop the mounts like: |
28 |
|
29 |
#!/sbin/runscript |
30 |
|
31 |
depend() { |
32 |
need localmount |
33 |
need bootmisc |
34 |
} |
35 |
|
36 |
start() { |
37 |
ebegin "Mounting chroot dirs" |
38 |
mount -o bind /dev /mnt/standalone/dev >/dev/null |
39 |
mount -o bind /dev/pts /mnt/standalone/dev/pts >/dev/null & |
40 |
mount -o bind /dev/shm /mnt/standalone/dev/shm >/dev/null & |
41 |
mount -o bind /proc /mnt/standalone/proc >/dev/null |
42 |
mount -o bind /proc/bus/usb /mnt/standalone/proc/bus/usb >/dev/null & |
43 |
mount -o bind /sys /mnt/standalone/sys >/dev/null & |
44 |
mount -o bind /tmp /mnt/standalone/tmp >/dev/null & |
45 |
mount -o bind /usr/portage /mnt/standalone/usr/portage/ >/dev/null & |
46 |
mount -o bind /usr/distfiles /mnt/standalone/usr/distfiles >/dev/null & |
47 |
eend $? "An error occured while attempting to mount chroot directories" |
48 |
ebegin "Copying chroot files" |
49 |
cp -pf /etc/resolv.conf /mnt/standalone/etc >/dev/null & |
50 |
cp -Ppf /etc/localtime /mnt/standalone/etc >/dev/null & |
51 |
eend $? "An error occured while attempting to copy chroot files." |
52 |
} |
53 |
|
54 |
stop() { |
55 |
ebegin "Unmounting chroot dirs" |
56 |
umount -f /mnt/standalone/dev/pts >/dev/null |
57 |
umount -f /mnt/standalone/dev/shm >/dev/null |
58 |
umount -f /mnt/standalone/dev >/dev/null & |
59 |
umount -f /mnt/standalone/proc/bus/usb >/dev/null |
60 |
umount -f /mnt/standalone/proc >/dev/null & |
61 |
umount -f /mnt/standalone/sys >/dev/null & |
62 |
umount -f /mnt/standalone/tmp >/dev/null & |
63 |
umount -f /mnt/standalone/usr/portage/ >/dev/null & |
64 |
umount -f /mnt/standalone/usr/distfiles/ >/dev/null & |
65 |
eend $? "An error occured while attempting to unmount chroot |
66 |
directories" |
67 |
} |
68 |
|
69 |
then in laptop: |
70 |
|
71 |
/etc/init.d/standalone start && |
72 |
linux64 chroot <standalone> /bin/bash |
73 |
or (if standalone is 32bit) |
74 |
linux32 chroot <standalone> /bin/bash |
75 |
|
76 |
then once inside the chroot update the environment like: |
77 |
cd && env-update && source /etc/profile && export PS1='(standalone) \W # ' |
78 |
|
79 |
Then update as normal (emerge -DNuv world) ...etc (*) |
80 |
|
81 |
Once finished, exit chroot and unmount: |
82 |
exit && /etc/init.d/standalone stop |
83 |
|
84 |
connect laptop (or external disk) to standalone and sync the filesystem |
85 |
back, but _taking_care_not_to_delete_directories_you_need_to_keep_ like |
86 |
/home/... |
87 |
|
88 |
eg, make a script like: |
89 |
|
90 |
#!/bin/bash |
91 |
( mount |grep standalone ) && /etc/init.d/standalone stop |
92 |
cd /mnt/standalone && \ |
93 |
rsync -aHvx --exclude lost+found --delete boot/ standalone:/boot/ && \ |
94 |
rsync -aHvx --exclude lost+found --delete bin/ standalone:/bin/ && \ |
95 |
rsync -aHvx --exclude lost+found --delete sbin/ standalone:/sbin/ && \ |
96 |
rsync -aHvx --exclude lost+found --delete usr/ standalone:/usr/ && \ |
97 |
rsync -aHvx --exclude lost+found --delete lib/ standalone:/lib/ && \ |
98 |
rsync -aHvx --exclude lost+found --delete mnt/ standalone:/mnt/ && \ |
99 |
rsync -aHvx --exclude lost+found --delete net/ standalone:/net/ && \ |
100 |
rsync -aHvx --exclude lost+found --delete misc/ standalone:/misc/ && \ |
101 |
rsync -aHvx --exclude lost+found --delete var/ standalone:/var/ && \ |
102 |
rsync -aHvx --exclude lost+found --delete media/ standalone:/media/ && \ |
103 |
rsync -aHvx --exclude lost+found --delete opt/ standalone:/opt/ && \ |
104 |
rsync -aHvx --exclude lost+found --delete etc/ standalone:/etc/ && \ |
105 |
rsync -aHvx --exclude lost+found --delete root/ standalone:/root/ && \ |
106 |
echo "ALL DONE" |
107 |
|
108 |
|
109 |
(*) OR maybe this is safer, once in chroot environment, fetch the needed |
110 |
distfiles only: |
111 |
emerge -DNuvf world |
112 |
then rsync the /usr/distfiles/ and portage dirs to the standalone's |
113 |
machine dirs, and build the packages (update) on standalone. |
114 |
And rsync the standalone fs to the <standalone> dir on laptop/disk when |
115 |
you want to update again. |
116 |
|
117 |
Hope you got the idea. ;) |