1 |
On Tue, 19 Apr 2011 15:07:46 +0300, Thanasis wrote: |
2 |
|
3 |
> > That's the gist of it, although it also emails the output from emerge |
4 |
> > -pvDN world, so I can see what needs to be done. It runs a few other |
5 |
> > bits, like glsa-check. |
6 |
> > |
7 |
> > |
8 |
> Neil, do you mind posting it (after changing any private bits to |
9 |
> generic)? |
10 |
> |
11 |
Here it is, as an attachment too to avoid screwing up the lines |
12 |
|
13 |
|
14 |
#!/bin/bash |
15 |
|
16 |
export PORTAGE_ECLASS_WARNING_ENABLE="0" |
17 |
WORLD_MERGE="emerge --update --deep --reinstall changed-use --with-bdeps y --verbose @system @world" |
18 |
|
19 |
[[ -d /etc/portage/presync.d ]] && for s in /etc/portage/presync.d/*[!~]; do |
20 |
$s || exit |
21 |
done |
22 |
|
23 |
SYNCED="false" |
24 |
if [[ ! -f /etc/portage/noautosync ]] && ! mount | grep -q ' /usr/portage type nfs '; then |
25 |
SYNCED="" |
26 |
for i in {0..12}; do |
27 |
echo "$(date): syncing portage" |
28 |
emerge --sync && SYNCED="true" && break |
29 |
sleep 5m |
30 |
done |
31 |
fi |
32 |
|
33 |
if [[ "${SYNCED}" ]]; then |
34 |
if [[ "${SYNCED}" == "true" ]]; then |
35 |
echo "Portage synced" 1>&2 |
36 |
else |
37 |
echo "Portage not synced" 1>&2 |
38 |
fi |
39 |
TEMPFILE=$(mktemp) |
40 |
${WORLD_MERGE} --changelog --pretend >|${TEMPFILE} |
41 |
Mail -s "$(hostname): Updated packages" neil <${TEMPFILE} |
42 |
rm -f ${TEMPFILE} |
43 |
else |
44 |
echo "Failure syncing portage" >&2 |
45 |
fi |
46 |
|
47 |
GLSAs=$(glsa-check --test all 2>/dev/null) |
48 |
if [[ -n "${GLSAs}" ]]; then |
49 |
for GLSA in ${GLSAs}; do |
50 |
glsa-check --dump ${GLSA} | grep -B88 Unaffected |
51 |
echo -e "\n" |
52 |
done | Mail -s "GLSA warnings for $(hostname)" neil |
53 |
fi |
54 |
|
55 |
if [[ -x "$(which eix-update 2>/dev/null)" ]]; then |
56 |
eix-update --quiet |
57 |
[[ -f /etc/portage/no-eix-remote ]] || LOCAL_LAYMAN=/mnt/portage/layman eix-remote -q update |
58 |
fi |
59 |
|
60 |
for i in /etc/portage/postupdate.d/*[!~]; do |
61 |
[[ $i == ${i/\~} ]] && [[ -x $i ]] && $i |
62 |
done |
63 |
|
64 |
exit 0 |
65 |
|
66 |
|
67 |
|
68 |
-- |
69 |
Neil Bothwick |
70 |
|
71 |
Biology is the only science in which multiplication means the same thing |
72 |
as division. |