/[cvs]/nfo/doc/computing/sysadmin/linux/mini-howto_trashcan-under-Linux_libtrash.html
ViewVC logotype

Contents of /nfo/doc/computing/sysadmin/linux/mini-howto_trashcan-under-Linux_libtrash.html

Parent Directory Parent Directory | Revision Log Revision Log


Revision 1.2 - (show annotations)
Sat Jan 25 09:06:51 2003 UTC (21 years, 8 months ago) by jonen
Branch: MAIN
Changes since 1.1: +1 -1 lines
File MIME type: text/html
+ minor changes

1 <!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Strict//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-strict.dtd">
2 <html xmlns="http://www.w3.org/1999/xhtml">
3 <head>
4 <title>trashcan under GNU/Linux with 'libtrash' mini-HowTo</title>
5 <link rev="made" href="mailto:root@localhost" />
6 </head>
7
8 <body style="background-color: white">
9
10 <p><a name="__index__"></a></p>
11 <!-- INDEX BEGIN -->
12
13 <ul>
14
15 <ul>
16
17 <li><a href="#implements_a_trash_can_under_gnu/linux_with_'libtrash'">Implements a ``trash can'' under GNU/Linux with 'libtrash'</a></li>
18 <ul>
19
20 <li><a href="#description">Description</a></li>
21 <ul>
22
23 <li><a href="#install_libtrash">install libtrash</a></li>
24 <li><a href="#test">test</a></li>
25 <li><a href="#enable_libtrash_at_login">enable libtrash at login</a></li>
26 <li><a href="#create_user_specify_config">create user specify config</a></li>
27 <li><a href="#use_'cleantrash'_for_cleaning_trash_via_cronjob">use 'cleanTrash' for cleaning Trash via cronjob</a></li>
28 <ul>
29
30 <li><a href="#insert_cronjob_for_root">insert cronjob for root</a></li>
31 </ul>
32
33 </ul>
34
35 <li><a href="#important_notes">Important Notes</a></li>
36 <li><a href="#resources">Resources</a></li>
37 <li><a href="#authors">Authors</a></li>
38 <li><a href="#last_changes">Last changes</a></li>
39 </ul>
40
41 </ul>
42
43 </ul>
44 <!-- INDEX END -->
45
46 <hr />
47 <p>
48 </p>
49 <h2><a name="implements_a_trash_can_under_gnu/linux_with_'libtrash'">Implements a ``trash can'' under GNU/Linux with 'libtrash'</a></h2>
50 <p>
51 </p>
52 <h3><a name="description">Description</a></h3>
53 <pre>
54 All stuff here is mainly copied from the libtrash doc.</pre>
55 <pre>
56 libtrash is a shared library which, when preloaded, implements a trash can under GNU/Linux.
57 This way, your mistakes (at least those of the &quot;rm -rf dir /&quot; class :-)) will no longer cause
58 the loss of a week's work or your system's binaries.</pre>
59 <p>
60 </p>
61 <h4><a name="install_libtrash">install libtrash</a></h4>
62 <pre>
63 apt-get install libtrash</pre>
64 <pre>
65 or for those of you that aren't running Debian GNU/Linux:
66
67 wget <a href="http://www.m-arriaga.net/software/libtrash/libtrash-latest.tgz">http://www.m-arriaga.net/software/libtrash/libtrash-latest.tgz</a>
68 tar xzf libtrash-latest.tgz
69 cd libtrash-1.7/
70
71 edit Makefile for common settings
72
73 make install (as root)</pre>
74 <p>
75 </p>
76 <h4><a name="test">test</a></h4>
77 <pre>
78 export LD_PRELOAD=/usr/lib/libtrash/libtrash.so
79 rm -r &lt;some_test_file&gt;</pre>
80 <p>
81 </p>
82 <h4><a name="enable_libtrash_at_login">enable libtrash at login</a></h4>
83 <pre>
84 Include this in your ~/.bash_profile(or for system-wide usage in /etc/profile)
85 to enable libtrash every time you log in (or otherwise start a login shell)</pre>
86 <pre>
87 #-------------- snip ---------------------------
88 LIBTRASH=/usr/lib/libtrash/libtrash.so</pre>
89 <pre>
90 LIBTRASH_dest=$LIBTRASH
91 if test -L $LIBTRASH ; then
92 LIBTRASH_dest=&quot;$(dirname $LIBTRASH)/$(ls -l &quot;$LIBTRASH&quot; | \
93 sed -e 's/^.\+ -&gt; //')&quot;
94 fi</pre>
95 <pre>
96 if test x${LD_PRELOAD+set} = x -a -f &quot;$LIBTRASH_dest&quot; ; then
97 LD_PRELOAD=&quot;$LIBTRASH&quot;
98 export LD_PRELOAD
99 if test x$0 = x-bash ; then
100 exec bash ${1+&quot;$@&quot;}
101 else
102 exec $0 ${1+&quot;$@&quot;}
103 fi
104 fi
105 #-------------- end snip ---------------------------</pre>
106 <p>
107 </p>
108 <h4><a name="create_user_specify_config">create user specify config</a></h4>
109 <pre>
110 - READ /etc/libtrash.conf !!
111 - overwrite default values by setting up a ~/.libtrash for each user:</pre>
112 <pre>
113 # sample ~/.libtrash:
114 #-------------- snip ---------------------------
115 GLOBAL_PROTECTION = YES
116 INTERCEPT_FOPEN = YES
117 INTERCEPT_FREOPEN = YES
118 INTERCEPT_OPEN = YES
119 IGNORE_HIDDEN = NO
120 IGNORE_EXTENSIONS= o;exe
121 #-------------- end snip ---------------------------</pre>
122 <p>
123 </p>
124 <h4><a name="use_'cleantrash'_for_cleaning_trash_via_cronjob">use 'cleanTrash' for cleaning Trash via cronjob</a></h4>
125 <pre>
126 - gunzip &amp; copy '/usr/share/doc/libtrash/examples/cleanTrash/ct2.pl.gz'
127 to '/usr/local/bin/cleanTrash' e.g:
128
129 'zcat /usr/share/doc/libtrash/examples/cleanTrash/ct2.pl.gz &gt; /usr/local/bin/cleanTrash'</pre>
130 <pre>
131 - edit '/usr/local/bin/cleanTrash' for local configuration</pre>
132 <p>
133 </p>
134 <h5><a name="insert_cronjob_for_root">insert cronjob for root</a></h5>
135 <pre>
136 - crontab -e (as root)
137 - insert: 3,13,23,33,43,53 * * * * root /usr/local/bin/cleanTrash</pre>
138 <p>
139 </p>
140 <h3><a name="important_notes">Important Notes</a></h3>
141 <dl>
142 <dt><strong><a name="item_gerneral">Gerneral</a></strong><br />
143 </dt>
144 <dd>
145 <pre>
146 READ /etc/libtrash.conf !!
147 If libtrash.so is global enabled via /etc/profile, a DEFAULT or WRONG ~/.libtrash configuration would
148 causes gdm, root writes(if root writes are also protected by lintrash), kde etc. stops working !!
149
150 solution to disable libtrash in enviroment immediately:
151 - export LD_PRELOAD=&quot;&quot;</pre>
152 </dd>
153 <dt><strong><a name="item_xterm">XTerm</a></strong><br />
154 </dt>
155 <dd>
156 <pre>
157 to get a login shell, start XTerm with '-ls' (~/.profile will not be executed if not)</pre>
158 </dd>
159 </dl>
160 <p>
161 </p>
162 <h3><a name="resources">Resources</a></h3>
163 <dl>
164 <dt><strong><a name="item_libtrash_%2d_implements_a_%22trash_can%22_under_gn">Libtrash - Implements a ``trash can'' under GNU/Linux</a></strong><br />
165 </dt>
166 <dd>
167 <pre>
168 <a href="http://www.m-arriaga.net/software/libtrash/">http://www.m-arriaga.net/software/libtrash/</a></pre>
169 </dd>
170 </dl>
171 <p>
172 </p>
173 <h3><a name="authors">Authors</a></h3>
174 <pre>
175 Sebastian Utz seut@tunemedia.de</pre>
176 <p>
177 </p>
178 <h3><a name="last_changes">Last changes</a></h3>
179 <pre>
180 Revision 1.1 2003/01/24 17:47:49:
181 + create new</pre>
182
183 </body>
184
185 </html>

MailToCvsAdmin">MailToCvsAdmin
ViewVC Help
Powered by ViewVC 1.1.26 RSS 2.0 feed