1 |
################################################## |
2 |
# $Id$ |
3 |
# |
4 |
################################################## |
5 |
# |
6 |
# $Log:$ |
7 |
# |
8 |
# |
9 |
################################################## |
10 |
|
11 |
=pod |
12 |
|
13 |
|
14 |
=head2 Implements a "trash can" under GNU/Linux with 'libtrash' |
15 |
|
16 |
|
17 |
=head3 Description |
18 |
|
19 |
All stuff here is mainly copied from the libtrash doc. |
20 |
|
21 |
libtrash is a shared library which, when preloaded, implements a trash can under GNU/Linux. |
22 |
This way, your mistakes (at least those of the "rm -rf dir /" class :-)) will no longer cause |
23 |
the loss of a week's work or your system's binaries. |
24 |
|
25 |
|
26 |
=head4 install libtrash |
27 |
|
28 |
apt-get install libtrash |
29 |
|
30 |
|
31 |
or for those of you that aren't running Debian GNU/Linux: |
32 |
|
33 |
wget http://www.m-arriaga.net/software/libtrash/libtrash-latest.tgz |
34 |
tar xzf libtrash-latest.tgz |
35 |
cd libtrash-1.7/ |
36 |
|
37 |
edit Makefile for common settings |
38 |
|
39 |
make install (as root) |
40 |
|
41 |
|
42 |
=head4 test |
43 |
|
44 |
export LD_PRELOAD=/usr/lib/libtrash/libtrash.so |
45 |
rm -r <some_test_file> |
46 |
|
47 |
|
48 |
=head4 enable libtrash at login |
49 |
|
50 |
Include this in your ~/.bash_profile(or for system-wide usage in /etc/profile) |
51 |
to enable libtrash every time you log in (or otherwise start a login shell) |
52 |
|
53 |
#-------------- snip --------------------------- |
54 |
LIBTRASH=/usr/lib/libtrash/libtrash.so |
55 |
|
56 |
LIBTRASH_dest=$LIBTRASH |
57 |
if test -L $LIBTRASH ; then |
58 |
LIBTRASH_dest="$(dirname $LIBTRASH)/$(ls -l "$LIBTRASH" | \ |
59 |
sed -e 's/^.\+ -> //')" |
60 |
fi |
61 |
|
62 |
if test x${LD_PRELOAD+set} = x -a -f "$LIBTRASH_dest" ; then |
63 |
LD_PRELOAD="$LIBTRASH" |
64 |
export LD_PRELOAD |
65 |
if test x$0 = x-bash ; then |
66 |
exec bash ${1+"$@"} |
67 |
else |
68 |
exec $0 ${1+"$@"} |
69 |
fi |
70 |
fi |
71 |
#-------------- end snip --------------------------- |
72 |
|
73 |
|
74 |
|
75 |
=head4 create user specify config |
76 |
|
77 |
- READ /etc/libtrash.conf !! |
78 |
- overwrite default values by setting up a ~/.libtrash for each user: |
79 |
|
80 |
# sample ~/.libtrash: |
81 |
#-------------- snip --------------------------- |
82 |
GLOBAL_PROTECTION = YES |
83 |
INTERCEPT_FOPEN = YES |
84 |
INTERCEPT_FREOPEN = YES |
85 |
INTERCEPT_OPEN = YES |
86 |
IGNORE_HIDDEN = NO |
87 |
IGNORE_EXTENSIONS= o;exe |
88 |
#-------------- end snip --------------------------- |
89 |
|
90 |
|
91 |
|
92 |
=head4 use 'cleanTrash' for cleaning Trash via cronjob |
93 |
|
94 |
- gunzip & copy '/usr/share/doc/libtrash/examples/cleanTrash/ct2.pl.gz' |
95 |
to '/usr/local/bin/cleanTrash' e.g: |
96 |
|
97 |
'zcat /usr/share/doc/libtrash/examples/cleanTrash/ct2.pl.gz > /usr/local/bin/cleanTrash' |
98 |
|
99 |
|
100 |
- edit '/usr/local/bin/cleanTrash' for local configuration |
101 |
|
102 |
|
103 |
|
104 |
=head5 insert cronjob for root |
105 |
|
106 |
- crontab -e (as root) |
107 |
- insert: 3,13,23,33,43,53 * * * * root /usr/local/bin/cleanTrash |
108 |
|
109 |
|
110 |
|
111 |
=head3 Important Notes |
112 |
|
113 |
|
114 |
=over |
115 |
|
116 |
=item Gerneral |
117 |
|
118 |
READ /etc/libtrash.conf !! |
119 |
If libtrash.so is global enabled via /etc/profile, a DEFAULT or WRONG ~/.libtrash configuration would |
120 |
causes gdm, root writes(if root writes are also protected by lintrash), kde etc. stops working !! |
121 |
|
122 |
solution to disable libtrash in enviroment immediately: |
123 |
- export LD_PRELOAD="" |
124 |
|
125 |
|
126 |
|
127 |
=item XTerm |
128 |
|
129 |
to get a login shell, start XTerm with '-ls' (~/.profile will not be execute if not) |
130 |
|
131 |
|
132 |
=back |
133 |
|
134 |
|
135 |
=head3 Resources |
136 |
|
137 |
=over |
138 |
|
139 |
=item Libtrash - Implements a "trash can" under GNU/Linux |
140 |
|
141 |
http://www.m-arriaga.net/software/libtrash/ |
142 |
|
143 |
=back |
144 |
|
145 |
|
146 |
=head3 Authors |
147 |
|
148 |
Sebastian Utz seut@tunemedia.de |
149 |
|
150 |
|
151 |
=head3 Last changes |
152 |
|
153 |
Revision 1.1 2003/01/24 17:47:49: |
154 |
+ create new |
155 |
|
156 |
|
157 |
=cut |
158 |
|