Gentoo Archives: gentoo-user

From: Dave Nebinger <dnebinger@××××.com>
To: gentoo-user@l.g.o
Cc: news@×××××××××.org
Subject: RE: [gentoo-user] Re: rsync internal mirror configuration
Date: Tue, 12 Jul 2005 13:10:39
Message-Id: 002201c586e2$7930cf60$5f01010a@jnetlab.lcl
In Reply to: [gentoo-user] Re: rsync internal mirror configuration by James
1 > OK on the local rsync server I added this to automate the daily
2 > task of rsync(ing)
3 > # Rsync entries
4 > #
5 > 30 1 * * * root emerge sync
6
7 Unless you want to receive the daily email full of all kinds of funky
8 characters, I'd redirect the output from emerge to a file. On my boxen I
9 call 'dailysync.sh' from cron. The script has this:
10
11 cornholio ~ # cat bin/dailysync.sh
12 #!/bin/sh
13 #
14 # sync.sh: Script to handle the portage syncing.
15 #
16
17 emerge --sync 1>>/var/log/autosync.log 2>&1
18
19 # Update eix and edb...
20 if [ -e /usr/portage/profiles/default-linux/x86/2005.0/make.defaults ]
21 then
22 echo Not recreating make.defaults, it exists... >>/var/log/autosync.log
23 else
24 echo Recreating make.defaults... >>/var/log/autosync.log
25 ln -sf ../make.defaults
26 /usr/portage/profiles/default-linux/x86/2005.0/make.defaults
27 1>>/var/log/autosync.log 2>&1
28 fi
29
30 eix -u 1>>/var/log/autosync.log 2>&1
31 eupdatedb 1>>/var/log/autosync.log 2>&1
32
33 cornholio ~ #
34
35 The if/then logic is needed because eix expects a <version>/make.defaults
36 file, but the make.defaults has been pushed up one directory level. The
37 emerge --sync wipes the file out so I have to recreate it before updating
38 eix. And the output from the script goes to a log file rather than
39 stdout/stderr (so when run via cron no email is generated).
40
41 > OK, now I use document (C) to create the proxy entry on each client:
42 > Editing File: /etc/env.d/99local to look like this
43 > http_proxy="192.168.2.9:8080"
44 > instead of this
45 > http_proxy="proxy.server.com:8080"
46 >
47 > I check it on the client by issuing "echo $http_proxy"
48 > which give the correct results:
49 > 192.168.2.9:8080
50 >
51 > So far so good???
52
53 Hmm, the documentation might have changed since I did my setup. My internal
54 boxes have 'http_proxy=http://192.168.0.1:8084' directly in the make.conf
55 file; I didn't make any changes to /etc/conf.d/local.start for the http
56 proxy.
57
58 > and last run this daily on the server to keep it current?
59 > emerge -uDva world && repcacheman
60
61 Well if you have the time and inclination you can do it daily. Once you get
62 into maintaining the system you'll realize that this kind of attention to
63 the box is frequently overkill - a working box is a working box and there is
64 no need to fix what isn't broken.
65
66 Rather than do this on a daily basis I generate a daily email of packages to
67 be updated; if I see one I feel is critical I'll deal with the update
68 otherwise I'll let the system go for awhile. The script I use for this is:
69
70 cornholio ~ # cat bin/updatereport.sh
71 #!/bin/sh
72 #
73 # updatereport.sh: Script to send an update report to root.
74 #
75
76 #
77 # Remove the old report file.
78 #
79 if [ -e /var/log/update.report ] ; then
80 /bin/rm -f /var/log/update.report
81 fi
82 if [ -e /var/log/update.rpt.txt ] ; then
83 /bin/rm -f /var/log/update.rpt.txt
84 fi
85
86 #
87 # Run the command to generate the output file.
88 #
89 emerge --pretend --update --deep world 1>/var/log/update.report
90
91 #
92 # Put a standard header at the top of the text file.
93 #
94 echo "Current gentoo update report." > /var/log/update.rpt.txt
95 echo "" >> /var/log/update.rpt.txt
96 date >> /var/log/update.rpt.txt
97 echo "" >> /var/log/update.rpt.txt
98
99 #
100 # Extract a clean text file
101 #
102 strings /var/log/update.report >> /var/log/update.rpt.txt
103
104 #
105 # Mail the clean text file.
106 #
107 mail -s "Cornholio Portage Update Report" root < /var/log/update.rpt.txt
108
109 cornholio ~ #
110
111 > Anything I missed?
112
113 Well sure. The part I should have mentioned is that if your systems are all
114 similar in that they have the same hardware and same use flags, package
115 installs, etc., then you might want to have one system build binary packages
116 for distribution to the internal systems. That way you only suffer the
117 build once.
118
119 Personnaly I've got different architectures (PIII, P4, and AMD) mixed in
120 and, as each system has a different purpose they typically don't have
121 similar use flags or package installations, so a binary package distribution
122 doesn't work for me.
123
124 > Surely parts of all (4) documents belong in one master howto?
125
126 I'm sure it could but there's probably folks on the other side of the fence
127 that only want a local rsync mirror or a local portage download cache and
128 not both.
129
130 > Is there a script to update workstation systems, automatically,
131 > say 10 minutes after booting? How best to do this?
132
133 Sure. Generate a script that sleeps for 10 minutes then kicks off the
134 emerge process. Call the script from /etc/conf.d/local.start (be sure to
135 include the & to spawn it in the background) and you're golden.
136
137 However, you need to consider if this is something that you really want to
138 do. Automated updates are frowned upon by folks on the list.
139
140 I tend to stagger my system emerges because I use distcc. The individual
141 boxes have a smaller time impact handling the package recompiles.
142
143
144
145 --
146 gentoo-user@g.o mailing list

Replies

Subject Author
[gentoo-user] Re: rsync internal mirror configuration James <wireless@×××××××××××.com>