Regenerate drivedb's compatible list only if old

And add a disk to that list only if not already present.
This commit is contained in:
Jeremy Gardais 2020-03-11 11:25:06 +01:00
parent 5c8a9f9bb5
commit 83f4d52260
Signed by: jegardai
GPG Key ID: E759BAA22501AF32
1 changed files with 4 additions and 3 deletions

View File

@ -159,7 +159,7 @@ choose_correct_type() {
true > "${plugin_result}" true > "${plugin_result}"
true > "${plugin_state}" true > "${plugin_state}"
regenerate_if_too_old "${device_list}" 1440 regenerate_if_too_old "${device_list}" 1440
true > "${drivedb_list}" regenerate_if_too_old "${drivedb_list}" 1440
# Get the list of all available devices if the previous list was emptied # Get the list of all available devices if the previous list was emptied
if test ! -s "${device_list}"; then if test ! -s "${device_list}"; then
@ -215,12 +215,13 @@ https://www.smartmontools.org/wiki/FAQ#SmartmontoolsDatabase"
else else
DSELFTEST_MSG="" DSELFTEST_MSG=""
### If the device is also known from smartmontools database ### If the device is also known from smartmontools database
if printf -- '%s' "${DDRIVEDB_MSG}" | grep -q -E -- "green" ### and not already present in the list of compatible disk
if printf -- '%s' "${DDRIVEDB_MSG}" | grep -q -E -- "green" &&
! grep -q -- "${DISK}" "${drivedb_list}"
then then
echo "${DISK}" >> "${drivedb_list}" echo "${DISK}" >> "${drivedb_list}"
fi fi
fi fi
fi fi
## Test health status ## Test health status