Debian Codegraph @

debian/aide.conf.d/10_aide_lvm_needsroot

raw symbols SCIP
1 #!/bin/shscip-shell filesystem . . `/bin/sh`.
2
3 # this script needs root. Since the daily aide check does not run
4 # privileged, a dedicated service unit (runs as root) and invokes this
5 # script before the daily aide check is started. The output is written to
6 # a cache file that the daily aide check reads. This script is invoked again,
7 # this time producing no output since the LVM tool calls fail.
8 # If aide is directly invoked as root, the cache file is read but its values
9 # are overwritten by the output generated by the second call to this script.
10
11 undefinescip-shell shell shell-project 0.0.0 undefine().() {
12 local var="$1"
13 printfscip-shell system . . printf. "@@if defined %s\n" "${var}"
14 printfscip-shell system . . printf. "@@undef %s\n" "${var}"
15 printfscip-shell system . . printf. "@@endif\n"
16 }
17
18 # TODO: parse DIR from configuration file
19 DIR="/var/lib/aidescip-shell filesystem . . `/var/lib/aide`."
20 CACHEFILE="${DIR}/10_aide_rootrules_cache"
21
22 if [scip-shell system . . `[`. "${EUID}" != "0" ]; then
23 # we are not called from the buildcache job and are expected
24 # to spew what we have cached
25 if [scip-shell system . . `[`. -r "${CACHEFILE}" ]; then
26 catscip-shell system . . cat. "${CACHEFILE}"
27 fi
28 fi
29
30 if command -v dmsetup >/dev/nullscip-shell filesystem . . `/dev/null`.; then
31 if [scip-shell system . . `[`. "$(dmsetup info --columns --options uuid --noheadings 2>/dev/nullscip-shell filesystem . . `/dev/null`.| grepscip-shell system . . grep. -cvi 'no devices found')" != 0 ]; then
32 undefinescip-shell shell shell-project 0.0.0 undefine(). DM_UUIDS_W_P
33 undefinescip-shell shell shell-project 0.0.0 undefine(). DM_UUIDS_WO_P
34 printfscip-shell system . . printf. "@@define DM_UUIDS_W_P (%s)\\n" \
35 "$(\
36 dmsetup info --columns --options uuid --noheadings | \
37 paste --serial --delimiters='|'
38 )"
39 printfscip-shell system . . printf. "@@define DM_UUIDS_WO_P (%s)\\n" \
40 "$(\
41 dmsetup info --columns --options uuid --noheadings | \
42 sed 's/^LVM-//' | paste --serial --delimiters='|'
43 )"
44 fi
45 if [scip-shell system . . `[`. "$(dmsetup info --columns --options name --noheadings 2>/dev/nullscip-shell filesystem . . `/dev/null`.| grepscip-shell system . . grep. -cvi 'no devices found')" != 0 ]; then
46 undefinescip-shell shell shell-project 0.0.0 undefine(). DM_NAMES
47 printfscip-shell system . . printf. "@@define DM_NAMES (%s)\\n" \
48 "$(\
49 dmsetup info --columns --options name --noheadings | \
50 paste --serial --delimiters='|'
51 )"
52 printfscip-shell system . . printf. "@@define DM_NAMES_WO_D (%s)\\n" \
53 "$(\
54 dmsetup info --columns --options name --noheadings | \
55 sed -e 's/-/\\\\\\\\x2f/' | \
56 paste --serial --delimiters='|'
57 )"
58 fi
59 fi
60
61 if command -v pvs >/dev/nullscip-shell filesystem . . `/dev/null`.; then
62 if [scip-shell system . . `[`. "$(pvs --noheadings --options uuid 2>/dev/nullscip-shell filesystem . . `/dev/null`. | wcscip-shell system . . wc. -l)" != 0 ]; then
63 undefinescip-shell shell shell-project 0.0.0 undefine(). LVM_PV_UUIDS
64 undefinescip-shell shell shell-project 0.0.0 undefine(). LVM_PV_UUIDS_NODASH
65 printfscip-shell system . . printf. "@@define LVM_PV_UUIDS (%s)\\n" \
66 "$(\
67 pvs --noheadings --options uuid | \
68 sed 's/^[[:space:]]*\([^[:space:]]\+\).*/\1/' | \
69 sort --uniq | \
70 paste --serial --delimiters='|'
71 )"
72 printfscip-shell system . . printf. "@@define LVM_PV_UUIDS_NODASH (%s)\\n" \
73 "$(\
74 pvs --noheadings --options uuid | \
75 sed 's/^[[:space:]]*\([^[:space:]]\+\).*/\1/;s/-//g' | \
76 sort --uniq | \
77 paste --serial --delimiters='|' \
78 )"
79 fi
80 fi
81 if command -v vgs >/dev/nullscip-shell filesystem . . `/dev/null`.; then
82 if [scip-shell system . . `[`. "$(vgs --noheadings --options vg_name 2>/dev/nullscip-shell filesystem . . `/dev/null`. | wcscip-shell system . . wc. -l)" != 0 ]; then
83 printfscip-shell system . . printf. "@@define LVM_VGS (%s)\\n" \
84 "$(\
85 vgs --noheadings --options vg_name | \
86 sed 's/^[[:space:]]*\([^[:space:]]\+\).*/\1/' | \
87 sort --uniq | \
88 paste --serial --delimiters='|'
89 )"
90 fi
91 fi
92 if command -v lvs >/dev/nullscip-shell filesystem . . `/dev/null`.; then
93 if [scip-shell system . . `[`. "$(lvs --noheadings --options vg_name 2>/dev/nullscip-shell filesystem . . `/dev/null`. | wcscip-shell system . . wc. -l)" != 0 ]; then
94 printfscip-shell system . . printf. "@@define LVM_LVS (%s)\\n" \
95 "$(\
96 lvs --noheadings --options lv_name | \
97 sed 's/^[[:space:]]*\([^[:space:]]\+\).*/\1/' | \
98 sort --uniq | \
99 paste --serial --delimiters='|' \
100 )"
101 fi
102 fi
103 # vim:tabstop=4:expandtab:shiftwidth=4