On Tue, 19 Apr 2011 15:07:46 +0300, Thanasis wrote:

> > That's the gist of it, although it also emails the output from emerge
> > -pvDN world, so I can see what needs to be done. It runs a few other
> > bits, like glsa-check.
> >
> >  
> Neil, do you mind posting it (after changing any private bits to
> generic)?
> 
Here it is, as an attachment too to avoid screwing up the lines


#!/bin/bash

export PORTAGE_ECLASS_WARNING_ENABLE="0"
WORLD_MERGE="emerge --update --deep --reinstall changed-use --with-bdeps y 
--verbose @system @world"

[[ -d /etc/portage/presync.d ]] && for s in /etc/portage/presync.d/*[!~]; do
        $s || exit
        done

SYNCED="false"
if [[ ! -f /etc/portage/noautosync ]] && ! mount | grep -q ' /usr/portage type 
nfs '; then
        SYNCED=""
        for i in {0..12}; do
                echo "$(date): syncing portage"
                emerge --sync && SYNCED="true" && break
                sleep 5m
                done
        fi

if [[ "${SYNCED}" ]]; then
        if [[ "${SYNCED}" == "true" ]]; then
                echo "Portage synced" 1>&2
        else
                echo "Portage not synced" 1>&2
                fi
        TEMPFILE=$(mktemp)
        ${WORLD_MERGE} --changelog --pretend >|${TEMPFILE}
        Mail -s "$(hostname): Updated packages" neil <${TEMPFILE}
        rm -f ${TEMPFILE}
else
        echo "Failure syncing portage" >&2
        fi

GLSAs=$(glsa-check --test all 2>/dev/null)
if [[ -n "${GLSAs}" ]]; then
        for GLSA in ${GLSAs}; do
                glsa-check --dump ${GLSA} | grep -B88 Unaffected
                echo -e "\n"
                done | Mail -s "GLSA warnings for $(hostname)" neil
        fi

if [[ -x "$(which eix-update 2>/dev/null)" ]]; then
        eix-update --quiet
        [[ -f /etc/portage/no-eix-remote ]] || LOCAL_LAYMAN=/mnt/portage/layman 
eix-remote -q update
        fi

for i in /etc/portage/postupdate.d/*[!~]; do
        [[ $i == ${i/\~} ]] && [[ -x $i ]] && $i
        done

exit 0



-- 
Neil Bothwick

Biology is the only science in which multiplication means the same thing
as division.

Attachment: emerge-update
Description: Binary data

Attachment: signature.asc
Description: PGP signature

Reply via email to