-
Notifications
You must be signed in to change notification settings - Fork 3
Expand file tree
/
Copy pathcheck_debsums
More file actions
executable file
·37 lines (30 loc) · 817 Bytes
/
Copy pathcheck_debsums
File metadata and controls
executable file
·37 lines (30 loc) · 817 Bytes
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
#!/bin/sh
#
# Compare installed files to hashes in their .deb package.
# Needs one or more package names as arguments
#
# Copyleft Gabriel Filion
#
# This plugin is released under the GPL v3+ license. To get a copy of the
# license text visit: https://www.gnu.org/licenses/gpl-3.0.txt
#
if [ "$#" -lt 1 ]; then
echo DEBSUMS UNKNOWN: No package name specified
exit 3
fi
if [ ! -x /usr/bin/debsums ]; then
echo DEBSUMS UNKNOWN: debsums executable not found
exit 3
fi
tmp=$(debsums $* 2>/dev/null)
if [ "$?" = "1" ]; then
echo DEBSUMS UNKNOWN: One or more specified packages not installed
exit 3
fi
output=$(printf "%s" "$tmp" | grep FAILED | awk '{ print $1; }')
if [ ! -z "$output" ]; then
echo DEBSUMS CRITICAL: failed checksum for $output
exit 1
fi
echo DEBSUMS OK: $* passed
exit 0