/[cvs]/nfo/doc/computing/sysadmin/linux/mini-howto-shell-Trashcan-with-libtrash.txt
ViewVC logotype

Contents of /nfo/doc/computing/sysadmin/linux/mini-howto-shell-Trashcan-with-libtrash.txt

Parent Directory Parent Directory | Revision Log Revision Log


Revision 1.2 - (show annotations)
Sat Jan 25 08:32:51 2003 UTC (21 years, 7 months ago) by jonen
Branch: MAIN
CVS Tags: HEAD
Changes since 1.1: +5 -2 lines
File MIME type: text/plain
FILE REMOVED
+ moved to perlpod format

1 ##################################################
2 # $Id: mini-howto-shell-Trashcan-with-libtrash.txt,v 1.1 2003/01/22 17:47:49 jonen Exp $
3 #
4 ##################################################
5 #
6 # libtrash.so / Implements a Trashcan for linux shell and progs
7 # - short Debian Installation Guide -
8 #
9 ##################################################
10 #
11 # $Log: mini-howto-shell-Trashcan-with-libtrash.txt,v $
12 # Revision 1.1 2003/01/22 17:47:49 jonen
13 # + first init
14 #
15 #
16 ##################################################
17
18
19 #####################################
20 # notes:
21 #
22 libtrash is a shared library which, when preloaded, implements a trash can under GNU/Linux.
23 This way, your mistakes (at least those of the "rm -rf dir /" class :-)) will no longer cause
24 the loss of a week's work or your system's binaries.
25
26 #####################################
27 # install libtrash:
28 #
29 apt-get install libtrash
30
31 #####################################
32 # test:
33 #
34 export LD_PRELOAD=/usr/lib/libtrash/libtrash.so
35 rm -r <some_test_file>
36
37
38 #####################################
39 # enable libtrash at login:
40 #
41 Include this in your ~/.bash_profile(or for system-wide usage in /etc/profile)
42 to enable libtrash every time you log in (or otherwise start a login shell)
43
44 #-------------- snip ---------------------------
45 LIBTRASH=/usr/lib/libtrash/libtrash.so
46
47 LIBTRASH_dest=$LIBTRASH
48 if test -L $LIBTRASH ; then
49 LIBTRASH_dest="$(dirname $LIBTRASH)/$(ls -l "$LIBTRASH" | \
50 sed -e 's/^.\+ -> //')"
51 fi
52
53 if test x${LD_PRELOAD+set} = x -a -f "$LIBTRASH_dest" ; then
54 LD_PRELOAD="$LIBTRASH"
55 export LD_PRELOAD
56 if test x$0 = x-bash ; then
57 exec bash ${1+"$@"}
58 else
59 exec $0 ${1+"$@"}
60 fi
61 fi
62 #-------------- end snip ---------------------------
63
64
65 #####################################
66 # create user specify config
67 #
68 - READ /etc/libtrash.conf !!
69 - overwrite default values by setting up a ~/.libtrash for each user:
70
71 # sample ~/.libtrash:
72 #-------------- snip ---------------------------
73 GLOBAL_PROTECTION = YES
74 INTERCEPT_FOPEN = YES
75 INTERCEPT_FREOPEN = YES
76 INTERCEPT_OPEN = YES
77 IGNORE_HIDDEN = NO
78 IGNORE_EXTENSIONS= o;exe
79 #-------------- end snip ---------------------------
80
81
82 #####################################
83 # use 'cleanTrash' for cleaning Trash via cronjob
84 #
85 - gunzip & copy '/usr/share/doc/libtrash/examples/cleanTrash/ct2.pl.gz'
86 to '/usr/local/bin/cleanTrash' e.g:
87
88 'zcat /usr/share/doc/libtrash/examples/cleanTrash/ct2.pl.gz > /usr/local/bin/cleanTrash'
89
90 - edit '/usr/local/bin/cleanTrash' for local configuration
91
92 # insert cronjob for root:
93 - crontab -e (as root)
94 - insert: 3,13,23,33,43,53 * * * * root /usr/local/bin/cleanTrash
95
96
97
98 #####################################
99 # Additional Notes
100 #
101
102 # XTerm
103 to get a login shell, start XTerm with '-ls' (~/.profile will not be execute if not)

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