Debian Codegraph @

README.tclfilter

raw
1 TCL Filter
2 ==========
3
4 Since version 0.5.9, apt-dater can be configured with TCL filter support.
5 This feature is disabled by default, enable it with configure:
6
7 $ ./configure --enable-tclfilter
8
9 You need a recent TCL version installed to succeed, the Debian packages have
10 TCL filter support enabled.
11
12
13 Usage
14 =====
15
16 TCL filters can be used to group hosts by your own filter definition. For each
17 host configured, apt-dater evals your TCL filter and adds the host to the category
18 "Filtered" in the main screen if the return value is non-zero.
19
20 If you have a large number of hosts, it becomes hard i.e. to find out which hosts
21 have a certain package installed/running an obsolete release... . TCL filter helps
22 to filter alle hosts by such conditions.
23
24
25 Variables
26 =========
27
28 Before evaluating a TCL filter expression for a host, apt-dater sets the following
29 variables in the TCL environment:
30
31 -------------+-------------------------------------------------------
32 Variable | Description
33 -------------+-------------------------------------------------------
34 $cat | category index (0=Updates pending, 1=Up to date, ...)
35 $group | name of the group the hosts belongs to
36 $hostname | hostname
37 $comment | host comment
38 $kernel | kernel release (uname -r)
39 $lsb_cname | "Codename"-field of lsb_release -a
40 $lsb_rel | "Release"-field of lsb_release -a
41 $lsb_distri | "Distributer ID"-field of lsb_release -a
42 $extras | array of extra packages
43 $flags | array of host flags (h x R K)
44 $holds | array of packages hold back
45 $installed | array of installed packages
46 $updates | array of packages w/ update available
47 $clusters | array of cluster names
48 -------------+-------------------------------------------------------
49
50 The filter has the full power of TCL.
51
52
53 Examples
54 ========
55
56 Filter all Debian hosts:
57
58 return [expr [string compare $lsb_distri "Debian"] == 0]
59
60 Filter all Debian hosts running a release older than Etch:
61
62 return [expr [string compare $lsb_distri "Debian"] == 0 && $lsb_rel < 4.0]
63
64 Filter add hosts which have bind installed:
65
66 return [llength [array names installed "bind*"]]
67
68 Advanced examples
69 =================
70
71 Filter all Ubuntu 12.04 hosts wihout linux-generic-lts-trusty installed:
72
73 return [[expr [string compare $lsb_rel "12.04"] == 0] && \
74 [expr [llength [array names installed "linux-generic-lts-trusty"]] == 0]]
75
76 Filter all Ubuntu 12.04 hosts with kernel versions different from 3.2 or 3.13 and wihout linux-generic-lts-trusty installed at the same time:
77
78 return [expr [expr [string compare $lsb_rel "12.04"] == 0] && \
79 [expr [string first "3.2." $kernel] != 0] && \
80 [expr [string first "3.13." $kernel] != 0] && \
81 [expr [llength [array names installed "linux-generic-lts-trusty"]] == 0]]