Added HP-UX plugins check_hpux_drd_status, check_hpux_patch_version
Added routines to include_data.sh
This commit is contained in:
@@ -0,0 +1,273 @@
|
||||
#!/usr/bin/env ksh
|
||||
#******************************************************************************
|
||||
# @(#) check_hpux_drd_status.sh
|
||||
#******************************************************************************
|
||||
# @(#) Copyright (C) 2018 by KUDOS BVBA (info@kudos.be). All rights reserved.
|
||||
#
|
||||
# This program is a free software; you can redistribute it and/or modify
|
||||
# it under the same terms of the GNU General Public License as published by
|
||||
# the Free Software Foundation; either version 3 of the License, or
|
||||
# (at your option) any later version.
|
||||
#
|
||||
# This program is distributed in the hope that it will be useful, but WITHOUT
|
||||
# ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or FITNESS
|
||||
# FOR A PARTICULAR PURPOSE. See the GNU General Public License for more details
|
||||
#******************************************************************************
|
||||
#
|
||||
# DOCUMENTATION (MAIN)
|
||||
# -----------------------------------------------------------------------------
|
||||
# @(#) MAIN: check_hpux_drd_status
|
||||
# DOES: see _show_usage()
|
||||
# EXPECTS: see _show_usage()
|
||||
# REQUIRES: data_space2comma(), data_get_lvalue_from_config(), data_date2epoch(),
|
||||
# data_lc(), data_strip_space(), data_strip_outer_space(),
|
||||
# init_hc(), log_hc(), warn()
|
||||
#
|
||||
# @(#) HISTORY:
|
||||
# @(#) 2018-05-11: initial version [Patrick Van der Veken]
|
||||
# -----------------------------------------------------------------------------
|
||||
# DO NOT CHANGE THIS FILE UNLESS YOU KNOW WHAT YOU ARE DOING!
|
||||
#******************************************************************************
|
||||
|
||||
# -----------------------------------------------------------------------------
|
||||
function check_hpux_drd_status
|
||||
{
|
||||
# ------------------------- CONFIGURATION starts here -------------------------
|
||||
typeset _CONFIG_FILE="${CONFIG_DIR}/$0.conf"
|
||||
typeset _DRD_BIN="/opt/drd/bin/drd"
|
||||
typeset _VERSION="2018-05-11" # YYYY-MM-DD
|
||||
typeset _SUPPORTED_PLATFORMS="HP-UX" # uname -s match
|
||||
# ------------------------- CONFIGURATION ends here ---------------------------
|
||||
|
||||
# set defaults
|
||||
(( ARG_DEBUG != 0 && ARG_DEBUG_LEVEL > 0 )) && set ${DEBUG_OPTS}
|
||||
init_hc "$0" "${_SUPPORTED_PLATFORMS}" "${_VERSION}"
|
||||
typeset _ARGS=$(data_space2comma "$*")
|
||||
typeset _ARG=""
|
||||
typeset _MSG=""
|
||||
typeset _STC=0
|
||||
typeset _RC=0
|
||||
typeset _CHECK_CLONE=""
|
||||
typeset _CHECK_SYNC=""
|
||||
typeset _CLONE_MAX_AGE=30
|
||||
typeset _SYNC_MAX_AGE=30
|
||||
typeset _CLONE_DISK=""
|
||||
typeset _ORIGINAL_DISK=""
|
||||
typeset _ACTIVE_DISK=""
|
||||
typeset _BOOTED_DISK=""
|
||||
typeset _NOW_EPOCH=""
|
||||
typeset _EFI_CLONE=""
|
||||
typeset _EFI_ORIGINAL=""
|
||||
typeset _CLONE_DATE=""
|
||||
typeset _CLONE_YEAR=""
|
||||
typeset _CLONE_MONTH=""
|
||||
typeset _CLONE_DAY=""
|
||||
typeset _CLONE_HOUR=""
|
||||
typeset _CLONE_MINUTE=""
|
||||
typeset _CLONE_SECOND=""
|
||||
typeset _CLONE_EPOCH=""
|
||||
typeset _SYNC_DATE=""
|
||||
typeset _SYNC_YEAR=""
|
||||
typeset _SYNC_MONTH=""
|
||||
typeset _SYNC_DAY=""
|
||||
typeset _SYNC_HOUR=""
|
||||
typeset _SYNC_MINUTE=""
|
||||
typeset _SYNC_SECOND=""
|
||||
typeset _SYNC_EPOCH=""
|
||||
|
||||
# handle arguments (originally comma-separated)
|
||||
for _ARG in ${_ARGS}
|
||||
do
|
||||
case "${_ARG}" in
|
||||
help)
|
||||
_show_usage $0 ${_VERSION} ${_CONFIG_FILE} && return 0
|
||||
;;
|
||||
esac
|
||||
done
|
||||
|
||||
# handle configuration file
|
||||
[[ -n "${ARG_CONFIG_FILE}" ]] && _CONFIG_FILE="${ARG_CONFIG_FILE}"
|
||||
if [[ ! -r ${_CONFIG_FILE} ]]
|
||||
then
|
||||
warn "unable to read configuration file at ${_CONFIG_FILE}"
|
||||
return 1
|
||||
fi
|
||||
# read required configuration values
|
||||
_CHECK_CLONE=$(_CONFIG_FILE="${_CONFIG_FILE}" data_get_lvalue_from_config 'check_clone')
|
||||
if [[ -z "${_CHECK_CLONE}" ]]
|
||||
then
|
||||
# default
|
||||
_CHECK_CLONE="yes"
|
||||
fi
|
||||
_CLONE_MAX_AGE=$(_CONFIG_FILE="${_CONFIG_FILE}" data_get_lvalue_from_config 'clone_age')
|
||||
_CHECK_SYNC=$(_CONFIG_FILE="${_CONFIG_FILE}" data_get_lvalue_from_config 'check_sync')
|
||||
if [[ -z "${_CHECK_SYNC}" ]]
|
||||
then
|
||||
# default
|
||||
_CHECK_SYNC="yes"
|
||||
fi
|
||||
_SYNC_MAX_AGE=$(_CONFIG_FILE="${_CONFIG_FILE}" data_get_lvalue_from_config 'sync_age')
|
||||
|
||||
# get drd status
|
||||
if [[ ! -x ${_DRD_BIN} ]]
|
||||
then
|
||||
warn "${_DRD_BIN} is not installed here"
|
||||
return 1
|
||||
else
|
||||
log "executing {${_DRD_BIN}} ..."
|
||||
# drd outputs on STDERR
|
||||
${_DRD_BIN} status >${HC_STDOUT_LOG} 2>&1
|
||||
_RC=$?
|
||||
fi
|
||||
|
||||
# check drd status
|
||||
if (( _RC == 0 )) && (( $(grep -c -E -e ".*Displaying.*succeeded" ${HC_STDOUT_LOG} 2>/dev/null) > 0 ))
|
||||
then
|
||||
# convert NOW to epoch (pass date values as unquoted parameters)
|
||||
#_NOW_EPOCH=$(data_date2epoch "$(date '+%Y')" "$(date '+%m')" "$(date '+%d')" "$(date '+%H')" "$(date '+%M')" "$(date '+%S')")
|
||||
_NOW_EPOCH=$(data_date2epoch $(date '+%Y %m %d %H %M %S'))
|
||||
|
||||
# get devices
|
||||
_ORIGINAL_DISK=$(data_strip_space "$(grep "Original Disk:" ${HC_STDOUT_LOG} 2>/dev/null | cut -f2 -d':')")
|
||||
_CLONE_DISK=$(data_strip_space "$(grep 'Clone Disk:' ${HC_STDOUT_LOG} 2>/dev/null | cut -f2 -d':')")
|
||||
|
||||
_BOOTED_DISK=$(grep "Booted Disk:" ${HC_STDOUT_LOG} 2>/dev/null | cut -f2 -d'(' | cut -f1 -d ')')
|
||||
_ACTIVE_DISK=$(grep "Activated Disk:" ${HC_STDOUT_LOG} 2>/dev/null | cut -f2 -d'(' | cut -f1 -d ')')
|
||||
|
||||
# check clone status: after a fresh clone -> booted == activated == original
|
||||
if [[ "${_ORIGINAL_DISK}" = "${_BOOTED_DISK}" ]] &&
|
||||
[[ "${_ORIGINAL_DISK}" = "${_ACTIVE_DISK}" ]] &&
|
||||
[[ "${_BOOTED_DISK}" = "${_ACTIVE_DISK}" ]]
|
||||
then
|
||||
_MSG="clone disk ${_CLONE_DISK} was correctly created"
|
||||
log_hc "$0" 0 "${_MSG}"
|
||||
else
|
||||
_MSG="clone disk ${_CLONE_DISK} was probably not correctly created"
|
||||
log_hc "$0" 1 "${_MSG}"
|
||||
fi
|
||||
|
||||
# check EFI status
|
||||
_EFI_CLONE=$(data_strip_outer_space "$(grep 'Clone EFI Partition:' ${HC_STDOUT_LOG} 2>/dev/null | cut -f2 -d':')")
|
||||
if [[ "${_EFI_CLONE}" = "AUTO file present, Boot loader present" ]]
|
||||
then
|
||||
_MSG="clone disk ${_CLONE_DISK} has a bootable EFI partition"
|
||||
log_hc "$0" 0 "${_MSG}"
|
||||
else
|
||||
_MSG="clone disk ${_CLONE_DISK} does not have a bootable EFI partition"
|
||||
log_hc "$0" 1 "${_MSG}"
|
||||
fi
|
||||
_EFI_ORIGINAL=$(data_strip_outer_space "$(grep 'Original EFI Partition:' ${HC_STDOUT_LOG} 2>/dev/null | cut -f2 -d':')")
|
||||
if [[ "${_EFI_ORIGINAL}" = "AUTO file present, Boot loader present" ]]
|
||||
then
|
||||
_MSG="original disk ${_ORIGINAL_DISK} has a bootable EFI partition"
|
||||
log_hc "$0" 0 "${_MSG}"
|
||||
else
|
||||
_MSG="original disk ${_ORIGINAL_DISK} does not have a bootable EFI partition"
|
||||
log_hc "$0" 1 "${_MSG}"
|
||||
fi
|
||||
|
||||
# check clone age
|
||||
if [[ $(data_lc "${_CHECK_CLONE}") = "yes" ]]
|
||||
then
|
||||
# e.g.: 05/10/18 16:52:21 METDST (always in US format)
|
||||
_CLONE_DATE=$(data_strip_outer_space "$(grep 'Clone Creation Date:' ${HC_STDOUT_LOG} 2>/dev/null | cut -f2- -d':')")
|
||||
|
||||
if [[ "${_CLONE_DATE}" != "None" ]]
|
||||
then
|
||||
# split into year/month/day/hour/minute/second
|
||||
_CLONE_YEAR=$(print "${_CLONE_DATE}" | awk '{ print $1 }' 2>/dev/null | cut -f3 -d'/')
|
||||
_CLONE_MONTH=$(print "${_CLONE_DATE}" | awk '{ print $1 }' 2>/dev/null | cut -f1 -d'/')
|
||||
_CLONE_DAY=$(print "${_CLONE_DATE}" | awk '{ print $1 }' 2>/dev/null | cut -f2 -d'/')
|
||||
|
||||
_CLONE_HOUR=$(print "${_CLONE_DATE}" | awk '{ print $2 }' 2>/dev/null | cut -f1 -d':')
|
||||
_CLONE_MINUTE=$(print "${_CLONE_DATE}" | awk '{ print $2 }' 2>/dev/null | cut -f2 -d':')
|
||||
_CLONE_SECOND=$(print "${_CLONE_DATE}" | awk '{ print $2 }' 2>/dev/null | cut -f3 -d':')
|
||||
|
||||
# convert _CLONE_DATE to epoch
|
||||
_CLONE_EPOCH=$(data_date2epoch "20${_CLONE_YEAR}" "${_CLONE_MONTH}" "${_CLONE_DAY}" "${_CLONE_HOUR}" "${_CLONE_MINUTE}" "${_CLONE_SECOND}")
|
||||
|
||||
# check age
|
||||
if (( _CLONE_EPOCH > (_NOW_EPOCH - (_CLONE_MAX_AGE * 24 * 60 * 60)) ))
|
||||
then
|
||||
_MSG="clone age is younger than ${_CLONE_MAX_AGE} days [${_CLONE_DATE}]"
|
||||
log_hc "$0" 0 "${_MSG}"
|
||||
else
|
||||
_MSG="clone age is older than ${_CLONE_MAX_AGE} days [${_CLONE_DATE}]"
|
||||
log_hc "$0" 1 "${_MSG}"
|
||||
fi
|
||||
else
|
||||
_MSG="clone has not yet been created"
|
||||
log_hc "$0" 1 "${_MSG}"
|
||||
fi
|
||||
else
|
||||
log "not checking age of clone (see ${_CONFIG_FILE})"
|
||||
fi
|
||||
|
||||
# check sync age
|
||||
if [[ $(data_lc "${_CHECK_SYNC}") = "yes" ]]
|
||||
then
|
||||
# e.g.: 05/10/18 16:52:21 METDST (always in US format)
|
||||
_SYNC_DATE=$(data_strip_outer_space "$(grep 'Last Sync Date:' ${HC_STDOUT_LOG} 2>/dev/null | cut -f2- -d':')")
|
||||
|
||||
if [[ "${_SYNC_DATE}" != "None" ]]
|
||||
then
|
||||
# split into year/month/day/hour/minute/second
|
||||
_SYNC_YEAR=$(print "${_SYNC_DATE}" | awk '{ print $1 }' 2>/dev/null | cut -f3 -d'/')
|
||||
_SYNC_MONTH=$(print "${_SYNC_DATE}" | awk '{ print $1 }' 2>/dev/null | cut -f1 -d'/')
|
||||
_SYNC_DAY=$(print "${_SYNC_DATE}" | awk '{ print $1 }' 2>/dev/null | cut -f2 -d'/')
|
||||
|
||||
_SYNC_HOUR=$(print "${_SYNC_DATE}" | awk '{ print $2 }' 2>/dev/null | cut -f1 -d':')
|
||||
_SYNC_MINUTE=$(print "${_SYNC_DATE}" | awk '{ print $2 }' 2>/dev/null | cut -f2 -d':')
|
||||
_SYNC_SECOND=$(print "${_SYNC_DATE}" | awk '{ print $2 }' 2>/dev/null | cut -f3 -d':')
|
||||
|
||||
# convert _SYNC_DATE to epoch
|
||||
_SYNC_EPOCH=$(data_date2epoch "20${_SYNC_YEAR}" "${_SYNC_MONTH}" "${_SYNC_DAY}" "${_SYNC_HOUR}" "${_SYNC_MINUTE}" "${_SYNC_SECOND}")
|
||||
|
||||
# check age
|
||||
if (( _SYNC_EPOCH > (_NOW_EPOCH - (_SYNC_MAX_AGE * 24 * 60 * 60)) ))
|
||||
then
|
||||
_MSG="sync age is younger than ${_SYNC_MAX_AGE} days [${_SYNC_DATE}]"
|
||||
log_hc "$0" 0 "${_MSG}"
|
||||
else
|
||||
_MSG="sync age is older than ${_SYNC_MAX_AGE} days [${_SYNC_DATE}]"
|
||||
log_hc "$0" 1 "${_MSG}"
|
||||
fi
|
||||
else
|
||||
_MSG="sync has not yet been executed"
|
||||
log_hc "$0" 1 "${_MSG}"
|
||||
fi
|
||||
else
|
||||
log "not checking age of sync (see ${_CONFIG_FILE})"
|
||||
fi
|
||||
else
|
||||
_MSG="unable to run command: {${_DRD_BIN}}"
|
||||
log_hc "$0" 1 "${_MSG}"
|
||||
return 0
|
||||
fi
|
||||
|
||||
return 0
|
||||
}
|
||||
|
||||
# -----------------------------------------------------------------------------
|
||||
function _show_usage
|
||||
{
|
||||
cat <<- EOT
|
||||
NAME : $1
|
||||
VERSION : $2
|
||||
CONFIG : $3 with:
|
||||
check_clone=<yes|no>
|
||||
clone_age=<max_age_of_clone_in_days>
|
||||
check_sync=<yes|no>
|
||||
sync_age=<max_age_of_sync_in_days>
|
||||
PURPOSE : Checks whether the DRD clone was correctly created
|
||||
Checks for correct EFI partitions
|
||||
Checks the age of the DRD clone and/or sync
|
||||
|
||||
EOT
|
||||
|
||||
return 0
|
||||
}
|
||||
|
||||
#******************************************************************************
|
||||
# END of script
|
||||
#******************************************************************************
|
||||
@@ -19,13 +19,15 @@
|
||||
# @(#) MAIN: check_hpux_ioscan
|
||||
# DOES: see _show_usage()
|
||||
# EXPECTS: see _show_usage()
|
||||
# REQUIRES: data_space2comma(), init_hc(), log_hc(), warn()
|
||||
# REQUIRES: data_space2comma(), data_comma2pipe(), data_dequote(),
|
||||
# init_hc(), log_hc(), warn()
|
||||
#
|
||||
# @(#) HISTORY:
|
||||
# @(#) 2013-08-28: initial version [Patrick Van der Veken]
|
||||
# @(#) 2013-08-29: more verbosity & kernel_mode setting [Patrick Van der Veken]
|
||||
# @(#) 2016-06-08: introduced _AGILE_VIEW parameter [Patrick Van der Veken]
|
||||
# @(#) 2016-12-01: more standardized error handling [Patrick Van der Veken]
|
||||
# @(#) 2018-05-11: small optimizations [Patrick Van der Veken]
|
||||
# -----------------------------------------------------------------------------
|
||||
# DO NOT CHANGE THIS FILE UNLESS YOU KNOW WHAT YOU ARE DOING!
|
||||
#******************************************************************************
|
||||
@@ -37,7 +39,7 @@ function check_hpux_ioscan
|
||||
typeset _CONFIG_FILE="${CONFIG_DIR}/$0.conf"
|
||||
typeset _IOSCAN_BIN="/usr/sbin/ioscan"
|
||||
typeset _IOSCAN_OPTS="-Fn"
|
||||
typeset _VERSION="2016-12-01" # YYYY-MM-DD
|
||||
typeset _VERSION="2018-05-11" # YYYY-MM-DD
|
||||
typeset _SUPPORTED_PLATFORMS="HP-UX" # uname -s match
|
||||
# ------------------------- CONFIGURATION ends here ---------------------------
|
||||
|
||||
@@ -80,10 +82,10 @@ _CLASS_LINE=$(_CONFIG_FILE="${_CONFIG_FILE}" data_get_lvalue_from_config 'ioscan
|
||||
if [[ -z "${_CLASS_LINE}" ]]
|
||||
then
|
||||
# default
|
||||
_IOSCAN_CLASSES="ctl|diag|disk|ext_bus|fc|fcp|i2o|ipmi|lan|lvm|olar|${DEBUG_OPTS}vm"
|
||||
_IOSCAN_CLASSES="ctl|diag|disk|ext_bus|fc|fcp|i2o|ipmi|lan|lvm|olar|vm"
|
||||
else
|
||||
# convert comma's
|
||||
_IOSCAN_CLASSES="$(print ${_CLASS_LINE} | tr -s ',' '|' | tr -d '\"')"
|
||||
# convert commas and strip quotes
|
||||
_IOSCAN_CLASSES=$(data_comma2pipe $(data_dequote "${_CLASS_LINE}"))
|
||||
fi
|
||||
_KERNEL_MODE=$(_CONFIG_FILE="${_CONFIG_FILE}" data_get_lvalue_from_config 'kernel_mode')
|
||||
if [[ -z "${_KERNEL_MODE}" ]]
|
||||
@@ -125,7 +127,7 @@ else
|
||||
${_IOSCAN_BIN} ${_IOSCAN_OPTS} >>${HC_STDOUT_LOG} 2>>${HC_STDERR_LOG}
|
||||
if (( $? != 0 ))
|
||||
then
|
||||
_MSG="unable to gather ioscan information"
|
||||
_MSG="unable to run command: {${_IOSCAN_BIN}}"
|
||||
log_hc "$0" 1 "${_MSG}"
|
||||
return 0
|
||||
fi
|
||||
@@ -156,7 +158,6 @@ do
|
||||
continue
|
||||
esac
|
||||
|
||||
# handle unit result
|
||||
log_hc "$0" ${_STC} "${_MSG}"
|
||||
_STC=0
|
||||
done
|
||||
|
||||
@@ -0,0 +1,181 @@
|
||||
#!/usr/bin/env ksh
|
||||
#******************************************************************************
|
||||
# @(#) check_hpux_patch_version.sh
|
||||
#******************************************************************************
|
||||
# @(#) Copyright (C) 2018 by KUDOS BVBA (info@kudos.be). All rights reserved.
|
||||
#
|
||||
# This program is a free software; you can redistribute it and/or modify
|
||||
# it under the same terms of the GNU General Public License as published by
|
||||
# the Free Software Foundation; either version 3 of the License, or
|
||||
# (at your option) any later version.
|
||||
#
|
||||
# This program is distributed in the hope that it will be useful, but WITHOUT
|
||||
# ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or FITNESS
|
||||
# FOR A PARTICULAR PURPOSE. See the GNU General Public License for more details
|
||||
#******************************************************************************
|
||||
#
|
||||
# DOCUMENTATION (MAIN)
|
||||
# -----------------------------------------------------------------------------
|
||||
# @(#) MAIN: check_hpux_patch_version
|
||||
# DOES: see _show_usage()
|
||||
# EXPECTS: see _show_usage()
|
||||
# REQUIRES: data_space2comma(), data_get_lvalue_from_config(), data_dequote(),
|
||||
# init_hc(), log_hc(), warn()
|
||||
#
|
||||
# @(#) HISTORY:
|
||||
# @(#) 2018-05-11: initial version [Patrick Van der Veken]
|
||||
# -----------------------------------------------------------------------------
|
||||
# DO NOT CHANGE THIS FILE UNLESS YOU KNOW WHAT YOU ARE DOING!
|
||||
#******************************************************************************
|
||||
|
||||
# -----------------------------------------------------------------------------
|
||||
function check_hpux_patch_version
|
||||
{
|
||||
# ------------------------- CONFIGURATION starts here -------------------------
|
||||
typeset _CONFIG_FILE="${CONFIG_DIR}/$0.conf"
|
||||
typeset _SWLIST_BIN="/usr/sbin/swlist"
|
||||
typeset _SWLIST_OPTS=""
|
||||
typeset _SHOW_PATCHES_BIN="/usr/contrib/bin/show_patches"
|
||||
typeset _SHOW_PATCHES_OPTS=""
|
||||
typeset _VERSION="2018-05-11" # YYYY-MM-DD
|
||||
typeset _SUPPORTED_PLATFORMS="HP-UX" # uname -s match
|
||||
# ------------------------- CONFIGURATION ends here ---------------------------
|
||||
|
||||
# set defaults
|
||||
(( ARG_DEBUG != 0 && ARG_DEBUG_LEVEL > 0 )) && set ${DEBUG_OPTS}
|
||||
init_hc "$0" "${_SUPPORTED_PLATFORMS}" "${_VERSION}"
|
||||
typeset _ARGS=$(data_space2comma "$*")
|
||||
typeset _ARG=""
|
||||
typeset _MSG=""
|
||||
typeset _STC=0
|
||||
typeset _OE_VERSION=""
|
||||
typeset _PATCH_LINE=""
|
||||
typeset _PATCHES=""
|
||||
typeset _PATCH=""
|
||||
|
||||
# handle arguments (originally comma-separated)
|
||||
for _ARG in ${_ARGS}
|
||||
do
|
||||
case "${_ARG}" in
|
||||
help)
|
||||
_show_usage $0 ${_VERSION} ${_CONFIG_FILE} && return 0
|
||||
;;
|
||||
esac
|
||||
done
|
||||
|
||||
# handle configuration file
|
||||
[[ -n "${ARG_CONFIG_FILE}" ]] && _CONFIG_FILE="${ARG_CONFIG_FILE}"
|
||||
if [[ ! -r ${_CONFIG_FILE} ]]
|
||||
then
|
||||
warn "unable to read configuration file at ${_CONFIG_FILE}"
|
||||
return 1
|
||||
fi
|
||||
# read required configuration values
|
||||
_OE_VERSION=$(_CONFIG_FILE="${_CONFIG_FILE}" data_get_lvalue_from_config 'required_oe')
|
||||
_PATCH_LINE=$(_CONFIG_FILE="${_CONFIG_FILE}" data_get_lvalue_from_config 'required_patches')
|
||||
if [[ -n "${_PATCH_LINE}" ]]
|
||||
then
|
||||
# convert commas and strip quotes
|
||||
_PATCHES=$(data_comma2space $(data_dequote "${_PATCH_LINE}"))
|
||||
fi
|
||||
|
||||
# get and check OE version
|
||||
if [[ -n "${_OE_VERSION}" ]]
|
||||
then
|
||||
if [[ ! -x ${_SWLIST_BIN} ]]
|
||||
then
|
||||
warn "${_SWLIST_BIN} is not installed here"
|
||||
return 1
|
||||
else
|
||||
if [[ -n "${_SWLIST_OPTS}" ]]
|
||||
then
|
||||
log "executing {${_SWLIST_BIN}} with options: ${_SWLIST_OPTS}"
|
||||
${_SWLIST_BIN} ${_SWLIST_OPTS} >${HC_STDOUT_LOG} 2>${HC_STDERR_LOG}
|
||||
else
|
||||
log "executing {${_SWLIST_BIN}}"
|
||||
${_SWLIST_BIN} >${HC_STDOUT_LOG} 2>${HC_STDERR_LOG}
|
||||
fi
|
||||
fi
|
||||
if (( $? == 0 ))
|
||||
then
|
||||
if (( $(grep -c -E -e "${_OE_VERSION}.*Operating Environment" ${HC_STDOUT_LOG} 2>/dev/null) > 0 ))
|
||||
then
|
||||
_MSG="required OE with version ${_OE_VERSION} is installed"
|
||||
log_hc "$0" 0 "${_MSG}"
|
||||
else
|
||||
_MSG="required OE with version ${_OE_VERSION} is not installed"
|
||||
log_hc "$0" 1 "${_MSG}"
|
||||
fi
|
||||
else
|
||||
_MSG="unable to run command: {${_SWLLST_BIN}}"
|
||||
log_hc "$0" 1 "${_MSG}"
|
||||
return 0
|
||||
fi
|
||||
else
|
||||
warn "required OE will not be checked (not configured in ${_CONFIG_FILE})"
|
||||
fi
|
||||
|
||||
# get and check patches
|
||||
if [[ -n "${_PATCHES}" ]]
|
||||
then
|
||||
if [[ ! -x ${_SHOW_PATCHES_BIN} ]]
|
||||
then
|
||||
warn "${_SHOW_PATCHES_BIN} is not installed here"
|
||||
return 1
|
||||
else
|
||||
if [[ -n "${_SHOW_PATCHES_OPTS}" ]]
|
||||
then
|
||||
log "executing {${_SHOW_PATCHES_BIN}} with options: ${_SHOW_PATCHES_OPTS}"
|
||||
print "=== show_patches ===" >>${HC_STDOUT_LOG}
|
||||
${_SHOW_PATCHES_BIN} ${_SHOW_PATCHES_OPTS} >>${HC_STDOUT_LOG} 2>>${HC_STDERR_LOG}
|
||||
else
|
||||
log "executing {${_SHOW_PATCHES_BIN}}"
|
||||
print "=== show_patches ===" >>${HC_STDOUT_LOG}
|
||||
${_SHOW_PATCHES_BIN} ${_SHOW_PATCHES_OPTS} >>${HC_STDOUT_LOG} 2>>${HC_STDERR_LOG}
|
||||
fi
|
||||
fi
|
||||
if (( $? == 0 ))
|
||||
then
|
||||
for _PATCH in ${_PATCHES}
|
||||
do
|
||||
if (( $(grep -c "${_PATCH}" ${HC_STDOUT_LOG} 2>/dev/null) > 0 ))
|
||||
then
|
||||
_MSG="required patch ${_PATCH} is installed"
|
||||
log_hc "$0" 0 "${_MSG}"
|
||||
else
|
||||
_MSG="required patch ${_PATCH} is not installed"
|
||||
log_hc "$0" 1 "${_MSG}"
|
||||
fi
|
||||
done
|
||||
else
|
||||
_MSG="unable to run command: {${_SHOW_PATCHES_BIN}}"
|
||||
log_hc "$0" 1 "${_MSG}"
|
||||
return 0
|
||||
fi
|
||||
else
|
||||
warn "required patches will not be checked (not configured in ${_CONFIG_FILE})"
|
||||
fi
|
||||
|
||||
return 0
|
||||
}
|
||||
|
||||
# -----------------------------------------------------------------------------
|
||||
function _show_usage
|
||||
{
|
||||
cat <<- EOT
|
||||
NAME : $1
|
||||
VERSION : $2
|
||||
CONFIG : $3 with:
|
||||
required_patches=<list_of_patches_to_check>
|
||||
required_oe=<OE_version>
|
||||
PURPOSE : Checks whether the required OE (Operating Environment) version is installed
|
||||
Checks whether the required patches are installed
|
||||
|
||||
EOT
|
||||
|
||||
return 0
|
||||
}
|
||||
|
||||
#******************************************************************************
|
||||
# END of script
|
||||
#******************************************************************************
|
||||
Reference in New Issue
Block a user