#!/bin/bash

RCFILE="/usr/lib/supportconfig/resources/scplugin.rc"
: ${PLOG_LINES:=500}
[ -s $RCFILE ] && . $RCFILE || { echo "ERROR: Initializing resource file: $RCFILE"; exit 1; }
plugin_message "CSP..."
validate_rpm csp
validate_rpm csp-airgap-images
validate_rpm hacloud
validate_rpm hacloud-airgap-images
validate_rpm centralmgmt
validate_rpm centralmgmt-airgap-images
validate_rpm rweb
validate_rpm rweb-airgap-images
validate_rpm mss

#Check if the log path was set by cspctl or by the OS Tool. 
#If set by the OS tool, then we still need to run the cspctl support tool
#Otherwise, it's already ran, do nothing and finish.
if [[ "${LOG}" == "/var/log/scc"* ]]; then
    plugin_command /opt/opentext/csp/bin/cspctl support --skip
    cp /tmp/csp-support*.zip "${LOG}"
fi