Red color is reserved for failed update

This commit is contained in:
Jeremy Gardais 2021-01-13 16:08:31 +01:00
parent c6c1fd2bd0
commit 7b33a5947d
Signed by: jegardai
GPG Key ID: E759BAA22501AF32
1 changed files with 9 additions and 5 deletions

View File

@ -1,6 +1,10 @@
#!/bin/sh #!/bin/sh
# This script will check if upgrade is available for local Maco script # This script will check:
## if upgrade is available for local Maco script (green or yellow)
## if normal upgrade is planned (green or yellow)
## if urgent upgrade is planned (green or yellow)
## status of the last update (green, yellow or red)
# Vars {{{ # Vars {{{
readonly PROGNAME=$(basename "${0}") readonly PROGNAME=$(basename "${0}")
@ -164,8 +168,8 @@ Try to detect Maco update with ${TEMP_MACO_UPDATE} content."
echo "26${YELLOW_PIC} Maco needs upgrade" >> "${PLUGIN_STATE}" echo "26${YELLOW_PIC} Maco needs upgrade" >> "${PLUGIN_STATE}"
elif grep -qE '^Urgent.* available.*' "${TEMP_MACO_UPDATE}" elif grep -qE '^Urgent.* available.*' "${TEMP_MACO_UPDATE}"
then then
sed "s/^/\&${RED_PIC} /" "${TEMP_MACO_UPDATE}" >> "${PLUGIN_RESULT}" sed "s/^/\&${YELLOW_PIC} /" "${TEMP_MACO_UPDATE}" >> "${PLUGIN_RESULT}"
echo "16${RED_PIC} Maco needs urgent upgrade" >> "${PLUGIN_STATE}" echo "25${YELLOW_PIC} Maco needs urgent upgrade" >> "${PLUGIN_STATE}"
else else
sed "s/^/\&${CLEAR_PIC} /" "${TEMP_MACO_UPDATE}" >> "${PLUGIN_RESULT}" sed "s/^/\&${CLEAR_PIC} /" "${TEMP_MACO_UPDATE}" >> "${PLUGIN_RESULT}"
echo "46${CLEAR_PIC} Maco update state is unknown" >> "${PLUGIN_STATE}" echo "46${CLEAR_PIC} Maco update state is unknown" >> "${PLUGIN_STATE}"
@ -200,9 +204,9 @@ check_pending_urgent_update() {
debug_message "check_pending_urgent_update \ debug_message "check_pending_urgent_update \
An urgent Maco update is planned." An urgent Maco update is planned."
## Add color and message to PLUGIN_RESULT for detailed informations ## Add color and message to PLUGIN_RESULT for detailed informations
echo "${RED_PIC} An urgent update is planned (${MACO_PENDING_URGENT_UPDATE_FILE} file exists)." >> "${PLUGIN_RESULT}" echo "${YELLOW_PIC} An urgent update is planned (${MACO_PENDING_URGENT_UPDATE_FILE} file exists)." >> "${PLUGIN_RESULT}"
## Add information to PLUGIN_STATE ## Add information to PLUGIN_STATE
echo "14${RED_PIC} An urgent update is planned" >> "${PLUGIN_STATE}" echo "23${YELLOW_PIC} An urgent update is planned" >> "${PLUGIN_STATE}"
else else
debug_message "check_pending_urgent_update \ debug_message "check_pending_urgent_update \
No Maco urgent update is planned." No Maco urgent update is planned."