Here's a set of scripts I use to automatically sync/fetch/emerge all
packages over a modem. Works great (for me at least).

Note that you'll need gentoolkit installed. Intended usage is to run
prepare-updates (as root) with an optional argument (which gets passed to
sleep) to update your system. The scripts *should* fail gracefully if
something is wrong (blocking packages, failed downloads, broken
dependencies, etc). You'll also need zsh, though it'd probably work under
bash with a few changes.

Without further ado:

---- /usr/local/bin/prepare-updates
#!/bin/zsh
[ $# -gt 0 ] && { echo "Sleeping for $1..."; sleep $1 }
echo -n "Loading package list..."
PACKAGES=`qpkg -I -nc`
echo " done!"
emerge sync && exec /usr/local/bin/do-updates

---- /usr/local/bin/do-updates
#!/bin/zsh
echo -n "Loading package list..."
PKGS=`qpkg -I -nc`
echo " done!"
echo -n "Finding dependencies..."
EMERGEOUT=`echo $PKGS|xargs emerge -up --columns`
if echo $EMERGEOUT|grep '\[blocks'; then
        echo Blockage: $EMERGEOUT
        exit
fi
if echo $EMERGEOUT|grep "masked or unmasked"; then
        exit
fi
UPGRADES=`echo $EMERGEOUT|gawk 'BEGIN{FS="[][]"}/^\[/{print $3}'`
echo " done!"
if [ "x$UPGRADES" = x ]; then
        echo Nothing to upgrade\!
        exit
fi
echo Going to fetch:
echo $UPGRADES
echo Type Control-C to abort, Enter to continue
read x
echo $UPGRADES|xargs emerge -uf
echo
echo Fetch complete.
echo Type Control-C to stop, Enter to perform upgrades.
read x
echo $UPGRADES|xargs emerge

---- /usr/local/bin/list-updates
#!/bin/zsh
echo -n "Loading package list..."
PACKAGES=`qpkg -I -nc`
echo " done!"
echo $PACKAGES|xargs emerge -up --columns

-- 
Andrew Farmer
[EMAIL PROTECTED]

Attachment: pgp00000.pgp
Description: PGP signature

Reply via email to