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