#!/usr/bin/env bash
SOS_REPORT_LOG="/tmp/sos-report-test.log"
DISTRONAME="Scientific Linux"
SUPPORT_URL="https://scientificlinux.org"

tests(){
  MY_ID="${RANDOM}-$$"
  yes "$MY_ID"| sosreport  | tee  $SOS_REPORT_LOG
  set -x
  grep -qvi 'red hat' $SOS_REPORT_LOG
  grep -qvi 'redhat' $SOS_REPORT_LOG
  grep -qi $DISTRONAME $SOS_REPORT_LOG
  grep -qi $SUPPORT_URL $SOS_REPORT_LOG
  set +x
  rm -v $1/sosreport*${MY_ID}*tar* 
  rm -v "$SOS_REPORT_LOG"
}

if [ $sys_ver -gt 6 ]; then 
  tests /var/tmp
else 
  tests /tmp
fi
