1 |
With proxy's help on the forums we had this one already. Yours is cleaner |
2 |
and I like the color output. This one shows whats been removed also. |
3 |
Possiby you could merge that ability in as well? |
4 |
|
5 |
Gregg |
6 |
|
7 |
|
8 |
#!/bin/sh |
9 |
|
10 |
# directories in portage to ignore (not used yet) |
11 |
EXCLUDE="distfiles:files:eclass:licenses:profiles:scripts:metadata:packages" |
12 |
|
13 |
#check if this is first run |
14 |
if [ ! -f /var/cache/package.cache ] ; then |
15 |
echo "initializing package cache..." |
16 |
find /usr/portage/ -type d -mindepth 2 -maxdepth 2 | sort 2>/dev/null |
17 |
> /va$ |
18 |
|
19 |
else |
20 |
# move old cache (to compare to later) |
21 |
mv -f /var/cache/package.cache /var/cache/package.old 2>/dev/null |
22 |
|
23 |
# create new cache |
24 |
echo "Creating cache..." |
25 |
find /usr/portage/ -type d -mindepth 2 -maxdepth 2 | sort 2>/dev/null |
26 |
> /v$ |
27 |
echo "New:" |
28 |
diff /var/cache/package.old /var/cache/package.cache | grep \> |
29 |
echo |
30 |
echo "Removed:" |
31 |
diff /var/cache/package.old /var/cache/package.cache | grep \< |
32 |
echo |
33 |
echo "Done." |
34 |
fi |
35 |
|
36 |
|
37 |
|
38 |
|
39 |
> Gregg wrote: |
40 |
>> So... |
41 |
>> |
42 |
>> Something along these lines is in order: |
43 |
>> |
44 |
>> rm /root/before |
45 |
>> rm /root/after |
46 |
>> rm /root/new |
47 |
>> find /usr/portage -type d | grep -i -v files >/root/before |
48 |
>> emerge rsync |
49 |
>> find /usr/portage -type d | grep -i -v files >/root/after |
50 |
>> diff /root/before /root/after | tee /root/new |
51 |
>> |
52 |
>> |
53 |
>> That cleans up the old files, buids the before list, emerged, builds |
54 |
>> the after (both ignoring the files directory,) and then outputs the |
55 |
>> diff to screen and file |
56 |
> |
57 |
> good. This is a script based on your idea. |
58 |
> It it configurable and sends colorized output with package description |
59 |
> to the screen, while mainaining the log in the file. |
60 |
> The log file contains only /usr/portage/... files (no diff trash) |
61 |
> |
62 |
> The base directory is configurable (default /root) and the files |
63 |
> are called emerge-rsync.before|after|new. However I think it would be |
64 |
> better to store them somewhere in /var (/var/db/pkg/portage/... |
65 |
> /var/log) because I don't like messing in the home directory, |
66 |
> and if we are going to make it a system utility it should be |
67 |
> well integrated. |
68 |
> |
69 |
> Marko |