-
Notifications
You must be signed in to change notification settings - Fork 15
/
check-find.plugin
47 lines (41 loc) · 1.56 KB
/
check-find.plugin
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
#!/bin/bash
#############################################################
# #
# check-find.plugin - plugin that performs file presence #
# checking of installed modules #
# #
#############################################################
# #
# Copyright 2005 by Auke Kok under GPLv2 #
# #
#############################################################
plugin_module_check_find() {
local MODULE VERSION I_LOG FIND_STATUS IFS_OLD IFS LOG ITEM
if [ "$FIND_CHECK" == "off" ]; then
return 2
fi
debug_msg "plugin_module_check_find ($@)"
MODULE=$1
VERSION=$(installed_version $MODULE)
I_LOG=$INSTALL_LOGS/$MODULE-$VERSION
FIND_STATUS=2
if [ -e "$I_LOG" ]; then
IFS_OLD="$IFS"
export IFS=$'\n'
LOG=$(grep -E "/(bin|games|include|lib(32|64)?|sbin)/" $I_LOG | grep -E -v "/(doc|etc|fonts|man|var)/")
for ITEM in $LOG; do
if [ ! -e "$ITEM" ]; then
(
export IFS="$IFS_OLD"
message "${FILE_COLOR}${ITEM}${DEFAULT_COLOR} of ${MODULE_COLOR}${MODULE}${PROBLEM_COLOR} is missing.${DEFAULT_COLOR}"
)
FIND_STATUS=1
fi
done
else
message "${MODULE_COLOR}${MODULE}${PROBLEM_COLOR} is missing an install log.${DEFAULT_COLOR}"
FIND_STATUS=1
fi
return $FIND_STATUS
}
plugin_register MODULE_CHECK plugin_module_check_find