1 |
(sorry for posting this message on a new thread but |
2 |
I had some problems with the headers of the original message) |
3 |
|
4 |
Gregg wrote: |
5 |
> So... |
6 |
> |
7 |
> Something along these lines is in order: |
8 |
> |
9 |
> rm /root/before |
10 |
> rm /root/after |
11 |
> rm /root/new |
12 |
> find /usr/portage -type d | grep -i -v files >/root/before |
13 |
> emerge rsync |
14 |
> find /usr/portage -type d | grep -i -v files >/root/after |
15 |
> diff /root/before /root/after | tee /root/new |
16 |
> |
17 |
> |
18 |
> That cleans up the old files, buids the before list, emerged, builds the |
19 |
> after (both ignoring the files directory,) and then outputs the diff to |
20 |
> screen and file |
21 |
|
22 |
good. This is a script based on your idea. |
23 |
It it configurable and sends colorized output with package description |
24 |
to the screen, while mainaining the log in the file. |
25 |
The log file contains only /usr/portage/... files (no diff trash) |
26 |
|
27 |
The base directory is configurable (default /root) and the files |
28 |
are called emerge-rsync.before|after|new. However I think it would |
29 |
be better to store them somewhere in /var (/var/db/pkg/portage/... |
30 |
/var/log) because I don't like messing in the home directory, |
31 |
and if we are going to make it a system utility it should be |
32 |
well integrated. |
33 |
|
34 |
Marko |
35 |
|
36 |
script (cannot send attachments): |
37 |
<snip> |
38 |
!/bin/sh |
39 |
BASE=/root |
40 |
USE_COLORS=yes |
41 |
|
42 |
# end user configuration section |
43 |
|
44 |
BEFORE=$BASE/ebuild-rsync.before |
45 |
AFTER=$BASE/ebuild-rsync.after |
46 |
NEW=$BASE/ebuild-rsync.new |
47 |
|
48 |
if [ "$USE_COLORS" == "yes" ]; then |
49 |
GREEN="\033[;32m" |
50 |
NORMAL="\033[m" |
51 |
fi |
52 |
|
53 |
find /usr/portage -type d | grep -i -v files >$BEFORE |
54 |
emerge rsync |
55 |
find /usr/portage -type d | grep -i -v files >$AFTER |
56 |
diff $BEFORE $AFTER | grep /usr/portage | sed "s/> //g" > $NEW |
57 |
|
58 |
# cleanup |
59 |
rm $BEFORE $AFTER |
60 |
|
61 |
# display |
62 |
echo |
63 |
echo New ebuilds: |
64 |
for i in $(cat $NEW); do |
65 |
. $(ls $i/*.ebuild --sort=time | head -n 1) |
66 |
|
67 |
echo -e $GREEN${i##/usr/portage/}$NORMAL: $DESCRIPTION |
68 |
done |
69 |
|
70 |
</snip> |