on 04/21/2011 01:01 AM Neil Bothwick wrote the following:
> On Thu, 21 Apr 2011 00:23:01 +0300, Thanasis wrote:
>
>> Thanks! Can you add some comments, like what the directories presync.d
>> and postupdate.d are supposed to be ... as I don't have those.
>>
>> I have postsync.d and don't know what is it about ... It contains a file
>> named q-reinitialize :
>
> Scripts/programs in postsync.d are executed by portage after a sync. The
> other two are ones I added, before portage had postsync support, to run
> anything I wanted before and after a sync. The only thing  used them for
> now is to turn rsyncd off and on on my server, to prevent other machines
> syncing from it while its portage tree is being updated.
>
> BTW - I read the list, no need to send me an extra copy of the mail
> directly.
So, I understand that normally (in my case) there is no need for these
presync.d and postupdate.d directories, right?
The script could be stripped from these like so:
###########################################################################

#!/bin/bash

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

SYNCED=""
for i in {0..12}; do
    echo "$(date): syncing portage"
    emerge --sync && SYNCED="true" && break
    sleep 5m
done

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

exit 0
###########################################################################

Is that correct?


Reply via email to