All pastes #268985 Raw Edit

Miscellany

public text v1 · immutable
·published 2006-12-06 05:04 UTC
rendered paste body
#!/bin/bash

TMPDIR=$HOME/tmp

mkdir -p $TMPDIR

WORLD=$TMPDIR/world.txt
OLD=$TMPDIR/world.old
NEW=$TMPDIR/world.new
QUEUE=$TMPDIR/queue
#USE=$TMPDIR/newuse.txt

rm -f $WORLD $OLD $NEW $QUEUE

echo -n "Generating lists of old and new packages ... "
emerge -uDp world | grep '\]' > $WORLD 
if ! [ -s $WORLD ]; then
	rm -f $WORLD
	echo already up to date. && exit
fi
grep '\].*\]' $WORLD | sed -r 's/.*] (\S*-)[0-9].*\[(.*)\].*/=\1\2/g' > $OLD && \
grep '\]' $WORLD  | sed -r 's/.* ] (\S*) *(U|\[| ).*/=\1/g' >  $NEW && \
echo ok.
echo Making binary backups of old packages ...
quickpkg $(<$OLD)
echo -n "Setting symbolic link to queue ... "
ln -sf $NEW $QUEUE && echo done.