All pastes #255712 Raw Edit

Untitled

public text v1 · immutable
#255712 ·published 2006-11-23 08:15 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/.*] (\w.*\w-)[0-9].*\[(.*)\].*/=\1\2/g' > $OLD && \
grep '\]' $WORLD  | sed -r 's/.*] (\w.*\w) *(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.
#grep '\*' $WORLD |  sed -r 's/.*] (\w.*\w)-[0-9].*/\1/g' > $USE