#!/bin/bash
# unset "-set -vx" fro debugging purpose, after the exec 2> statement all debug infos will go the errorlog file (*.err)
#set -vx
#*vim:numbers:ruler
#PATH=$PATH:/usr/sbin:/sbin:/etc:/bin:/opt/omni/bin:/opt/omni/sbin

VER=$(echo "$Id: cfg2html-linux,v 1.78 2010-04-26 11:58:23 ralproth Exp $"|awk '{print $3"-"$4;}')
if [ -z "$VER" ]		# no awk, e.g. my Linux router // OpenWRT
then
	VER="$Revision: 1.78 $";
fi;
VERSION="cfg2html-linux version $VER "  # this a common stream so we dont need the "Proliant stuff"

#  If you change this script, please mark your changes with for example
#  ## <username> and send your diffs from the actual version to my email
#  address: cfg2html*hotmail.com

#
# use "no" to disable a collection
#
CFG_ALTIRISAGENTFILES="yes"  # Added by jeroen kleen HP ISS CC Engineer
CFG_APPLICATIONS="yes"
CFG_CRON="yes"
CFG_ENHANCEMENTS="yes"
CFG_FILESYS="yes"
CFG_HARDWARE="yes"
CFG_HPPROLIANTSERVER="no"  # Added by jeroen kleen HP ISS CC Engineer
CFG_KERNEL="yes"
CFG_LVM="yes"
CFG_NETWORK="yes" # <-- Network security, collecting tcpd and ip filter settings
CFG_SOFTWARE="yes"
CFG_STINLINE="yes"
CFG_SYSTEM="yes"
CFG_PLUGINS="no"
GIF="yes"

if [ "$OUTDIR" = "" ] ; then
  OUTDIR="."
fi
#
#
usage() {
  echo "WARNING, use this script AT YOUR OWN RISK"
  echo
  echo "    Usage: `basename $0` [OPTIONS]"
  echo "    creates a HTML and plain ASCII host documentation"
  echo
  echo "    -o		set directory to write or use the environment"
  echo "                  variable OUTDIR=\"/path/to/dir\" (directory must exist)"
  echo "    -v		output version information and exit"
  echo "    -h		display this help and exit"


  echo "    use the following options to disable / enable collections:"
  echo
  echo "    -s		disable: System"
  echo "    -c		disable: Cron"
  echo "    -S		disable: Software"
  echo "    -f		disable: Filesystem"
  echo "    -l		disable: LVM"
  echo "    -L          disable: Screen tips inline"
  echo "    -k		disable: Kernel/Libraries"
  echo "    -e		disable: Enhancements"
  echo "    -n		disable: Network"
  echo "    -a		disable: Applications"
  echo "    -H		disable: Hardware"
  echo "    -x		don't create background images"
  echo "    -p		enable: HP Proliant Server log files and settings" # Added by jeroen kleen HP ISS CC Engineer
  echo "    -A 		disable: Altiris ADL agent log files and settings" # Added by jeroen kleen HP ISS CC Engineer
  echo "    -P          enable: cfg2html plugin architecture" # anaumann 2009/07/10
  echo
}
#
# getopt
#
#
#NO_ARGS=0
#if [ $# -eq "$NO_ARGS" ]  # Script invoked with no command line args?
#then
#  usage
#  exit 1          # Exit and explain usage, if no argument(s) given.
#fi

while getopts ":o:xshcSflkenaHLvhpPA" Option
do
  case $Option in
    o     ) OUTDIR=$OPTARG;;
    v     ) echo $VERSION; exit 0;;
    h     ) echo $VERSION; usage; exit 0;;
    x     ) GIF="no";;
    s     ) CFG_SYSTEM="no";;
    c     ) CFG_CRON="no";;
    S     ) CFG_SOFTWARE="no";;
    f     ) CFG_FILESYS="no";;
    l     ) CFG_LVM="no";;
    k     ) CFG_KERNEL="no";;
    e     ) CFG_ENHANCEMENTS="no";;
    n     ) CFG_NETWORK="no";;
    a     ) CFG_APPLICATIONS="no";;
    H     ) CFG_HARDWARE="no";;
    L     ) CFG_STINLINE="no";;
    p     ) CFG_HPPROLIANTSERVER="yes";;
    P     ) CFG_PLUGINS="yes";;
    A     ) CFG_ALTIRISAGENTFILES="no";;
    *     ) echo "Unimplemented option chosen. Try -h for help!"; exit 1;;   # DEFAULT
  esac
done

shift $(($OPTIND - 1))
# Decrements the argument pointer so it points to next argument.

#
# linux port
MAILTO="&#106;&#101;&#114;&#111;&#101;&#110;&#46;&#107;&#108;&#101;&#101;&#110;&#64;&#104;&#112;&#46;&#99;&#111;&#109;"
MAILTORALPH="cfg2html&#64;&#104;&#111;&#116;&#109;&#97;&#105;&#108;&#46;&#99;&#111;&#109;"
# changed/added 08.07.2003 (13:04) by Ralph Roth, HP


#####################################################################
# @(#)Cfg2Html (c) by ROSE SWE, Dipl.-Ing. Ralph Roth, cfg2html@hotmail.com
# HP Proliant Server Module Integrated by Jeroen.Kleen@hp.com
#####################################################################

# cfg2html-linux ported (c) by Michael Meifert, SysAdm from HP-UX version
# using debian potato, woody

# This is the "swiss army knife" for the ASE, CE, sysadmin etc.
# I wrote it to get the needed information to plan an update,
# to perform basic trouble shooting or performance analysis.
# As a bonus cfg2html creates a nice HTML and plain ASCII
# documentation. If you are missing something, let me know it!

# History
#####################################################################
# 28-jan-1999  initial creation, based on get_config, check_config
#              nickel, snapshoot, vi, winword and a idea from a similar
#              script i have seen onsite.
#              Maybe a little bit ASE knowledge is also included :)))
#####################################################################
# 11-Mar-2001  initial creation for debian GNU Linux i386
#              based on Cfg2Html Version 1.15.06/HP-UX by
#              by ROSE SWE, Dipl.-Ing. Ralph Roth
#              ported to Linux  by Michael Meifert
#####################################################################
# 15-May-2006  Common stream for cfg2html-linux and the Proliant version


line ( ) {
echo --=[ http://come.to/cfg2html ]=-----------------------------------------------
}

echo -e "\n"

## test if user = root
#
#if [ `id|cut -c5-11` != "0(root)" ] ; then
# Apparently they did away with the cut convention of interpreting -c0 the same as -c1. In fact c0 now produces an error.
# This can be found/tested on Fedora 9 and Ubuntu 8.04 if anyone cares.

if [ `id|cut -c1-6` != "uid=0(" ] ; then	# 140906 rar, 160608 johnamurf
  if [ -x /usr/bin/banner ] ; then
    banner "Sorry!"
  else
	echo " ____                        _"
	echo "/ ___|  ___  _ __ _ __ _   _| |"
	echo "\___ \ / _ \| '__| '__| | | | |"
	echo " ___) | (_) | |  | |  | |_| |_|"
	echo "|____/ \___/|_|  |_|   \__, (_)"
	echo "                       |___/"
  fi
  line
  echo $0:$VERSION
  echo -e "You must run this script as Root\n"
  exit 1
fi
#
BASEFILE=`hostname||uname -n`		# 26.01.2001  uname -n, fixed 0205-2006rr for OpenWRT
HTML_OUTFILE=$OUTDIR/$BASEFILE.html
HTML_OUTFILE_TEMP=/tmp/$BASEFILE.html.$$
TEXT_OUTFILE=$OUTDIR/$BASEFILE.txt
TEXT_OUTFILE_TEMP=/tmp/$BASEFILE.txt.$$
ERROR_LOG=$OUTDIR/$BASEFILE.err
if [ ! -d $OUTDIR ] ; then
  echo "can't create $HTML_OUTFILE, $OUTDIR does not exist - stop"
  exit 1
fi
touch $HTML_OUTFILE
#echo "Starting up $VERSION\r"
[ -s "$ERROR_LOG" ] && rm -f $ERROR_LOG 2> /dev/null
DATE=`date "+%Y-%m-%d"` # ISO8601 compliant date string
DATEFULL=`date "+%Y-%m-%d %H:%M:%S"` # ISO8601 compliant date and time string

exec 2> $ERROR_LOG

if [ ! -f $HTML_OUTFILE ]  ;
then
  if [ -x /usr/bin/banner ] ; then
        banner "Error"
  else
        echo "E R R O R"
  fi
  line
  echo -e "You have not the rights to create the file $HTML_OUTFILE! (NFS?)\n"
  exit 1
fi

logger "Start of $VERSION"
RECHNER=$(hostname)			# `hostname -f`
VERSION_=`echo $VERSION/$RECHNER|tr " " "_"`
typeset -i HEADL=0                      # Headinglevel

#
# check Linux distribution
#
distrib="unknown"

## rr, 15.12.2004 - "robertfantini"
if [ -f /etc/gentoo-release ] ; then
	distrib="`head -1 /etc/gentoo-release`"
	GENTOO="yes"
else
	GENTOO="no"
fi

if [ -f /etc/slackware-version ] ; then
	distrib="`cat /etc/slackware-version`"
	SLACKWARE="yes"
else
	SLACKWARE="no"
fi

# if [ -f /etc/debian_version ] ; then
# 	distrib="Debian GNU/Linux Version `cat /etc/debian_version`"
# 	DEBIAN="yes"
# else
# 	DEBIAN="no"
# fi

## fix suggested by  thomas bludau @ Dienstag, 19. Januar 2010
# fix suggested by MiMe/Donnerstag, 21. Januar 2010 - could you make it please easier:
# -UBUNTU_VERSION="`cat /etc/lsb-release | grep DISTRIB_DESCRIPTION | grep Ubuntu | sed \"s/DISTRIB_DESCRIPTION=//\" | sed \"s/\\\"//g\"`"
# +UBUNTU_VERSION=$(awk -F\" '/DISTRIB_DESCRIPTION/ {print $2}' /etc/lsb-release)

if [ -f /etc/debian_version ] ; then
        if [ -f /etc/lsb-release ] ; then
        	# UBUNTU_VERSION="`cat /etc/lsb-release | grep DISTRIB_DESCRIPTION | grep Ubuntu | sed \"s/DISTRIB_DESCRIPTION=//\" | sed \"s/\\\"//g\"`"
        	UBUNTU_VERSION=$(awk -F\" '/DISTRIB_DESCRIPTION/ {print $2}' /etc/lsb-release)
        fi
        if  [ "$UBUNTU_VERSION" ]; then
	        distrib=$UBUNTU_VERSION
	        UBUNTU="yes"
        else
	        distrib="Debian GNU/Linux Version `cat /etc/debian_version`"
	        UBUNTU="no"
        fi
        DEBIAN="yes"
else
        DEBIAN="no"
fi

if [ -f /etc/SuSE-release ] ; then
	distrib="`head -1 /etc/SuSE-release`"
	SUSE="yes"
else
	SUSE="no"
fi

if [ -f /etc/mandrake-release ] ; then
        distrib="`head -1 /etc/mandrake-release`"
        MANDRAKE="yes"
else
        MANDRAKE="no"
fi

if [ -f /etc/redhat-release ] ; then
        distrib="`head -1 /etc/redhat-release`"
        REDHAT="yes"
else
        REDHAT="no"
fi

# MiMe: for UnitedLinux
if [ -f /etc/UnitedLinux-release ] ; then
        distrib="`head -1 /etc/UnitedLinux-release`"
        UNITEDLINUX="yes"
else
        UNITEDLINUX="no"
fi

# i am looking for other distribution tests



####################################################################
# needs improvement!
# trap "echo Signal: Aborting!; rm $HTML_OUTFILE_TEMP"  2 13 15

####################################################################
####################################################################
#  Header of HTML file
####################################################################

open_html() {
UNAMEA=$(uname -a)
echo -e " \
<!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 3.2//EN">
<HTML> <HEAD>
 <META NAME="GENERATOR" CONTENT="Selfmade-$VERSION">
 <META NAME="AUTHOR" CONTENT="Ralph Roth, Michael Meifert">
 <META NAME="CREATED" CONTENT="Ralph Roth, Michael Meifert">
 <META NAME="CHANGED" CONTENT="`id;date` ">
 <META NAME="DESCRIPTION" CONTENT="$Header: /cygdrive/e/CVSROOT/cfg2html_linux/cfg2html-linux,v 1.78 2010-04-26 11:58:23 ralproth Exp $">
 <META NAME="subject" CONTENT="$VERSION on $RECHNER by $MAILTO and $MAILTORALPH">
<style type="text/css">
/* (c) 2001-2010 by ROSE SWE, Ralph Roth - http://come.to/rose_swe
 * CSS for cfg2html.sh, 12.04.2001, initial creation
 */

Pre		{Font-Family: Courier-New, Courier;Font-Size: 10pt}
BODY		{FONT-FAMILY: Arial, Verdana, Helvetica, Sans-serif; FONT-SIZE: 12pt;}
A		{FONT-FAMILY: Arial, Verdana, Helvetica, Sans-serif}
A:link 		{text-decoration: none}
A:visited 	{text-decoration: none}
A:hover 	{text-decoration: underline}
A:active 	{color: red; text-decoration: none}

H1		{FONT-FAMILY: Arial, Verdana, Helvetica, Sans-serif;FONT-SIZE: 20pt}
H2		{FONT-FAMILY: Arial, Verdana, Helvetica, Sans-serif;FONT-SIZE: 14pt}
H3		{FONT-FAMILY: Arial, Verdana, Helvetica, Sans-serif;FONT-SIZE: 12pt}
DIV, P, OL, UL, SPAN, TD
		{FONT-FAMILY: Arial, Verdana, Helvetica, Sans-serif;FONT-SIZE: 11pt}

</style>

<TITLE>${RECHNER} - System Documentation - $VERSION</TITLE>
</HEAD><BODY>
<BODY LINK="#0000ff" VLINK="#800080" BACKGROUND="cfg2html_back.jpg">
<H1><CENTER><FONT COLOR=blue>
<P><hr><B>$RECHNER - System Documentation</P></H1>
<hr><FONT COLOR=blue><small>Created "$DATEFULL" with " $VERSION "</font></center></B><P>
$UNAMEA
</small>

<HR><H1>Contents\n</font></H1>\n\
" >$HTML_OUTFILE

(line
if [ -x /usr/bin/banner ] ; then
  banner $RECHNER
else
  echo
  echo "                       "$RECHNER
  echo
fi;line) > $TEXT_OUTFILE
echo -e "\n" >> $TEXT_OUTFILE
echo -e "\n" > $TEXT_OUTFILE_TEMP
}

######################################################################
#  Increases the headling level
######################################################################

inc_heading_level() {
HEADL=HEADL+1
	# echo -e "<UL>\n" >> $HTML_OUTFILE
	echo -e "<UL type='square'>\n" >> $HTML_OUTFILE
}

######################################################################
#  Decreases the heading level
######################################################################

dec_heading_level() {
HEADL=HEADL-1
echo -e "</UL>" >> $HTML_OUTFILE
}

######################################################################
#  Creates an own paragraph, $1 = heading
######################################################################

paragraph() {
if [ "$HEADL" -eq 1 ] ; then
    echo -e "<HR>" >> $HTML_OUTFILE_TEMP
fi

echo "<A NAME=\"$1\">" >> $HTML_OUTFILE_TEMP
echo "<A HREF=\"#Inhalt-$1\"><H${HEADL}> $1 </H${HEADL}></A><P>" >> $HTML_OUTFILE_TEMP


echo "<IMG SRC="profbull.gif" WIDTH=14 HEIGHT=14>" >> $HTML_OUTFILE
echo "<A NAME=\"Inhalt-$1\"></A><A HREF=\"#$1\">$1</A>" >> $HTML_OUTFILE
echo -e "\nCollecting: " $1 " .\c"
echo "    $1" >> $TEXT_OUTFILE
}

######################################################################
#  Documents the single commands and their output
#  $1  = unix command,  $2 = text for the heading
######################################################################

exec_command() {

echo -e ".\c"

echo -e "\n---=[ $2 ]=----------------------------------------------------------------" | cut -c1-74 >> $TEXT_OUTFILE_TEMP
echo "       - $2" >> $TEXT_OUTFILE
######the working horse##########
TMP_EXEC_COMMAND_ERR=/tmp/exec_cmd.tmp.$$
## Modified 1/13/05 by marc.korte@oracle.com, Marc Korte, TEKsystems (150 -> 250)
EXECRES=`eval $1 2> $TMP_EXEC_COMMAND_ERR | expand | cut -c 1-250`


########### test it ############
# Gert.Leerdam@getronics.com
# Convert illegal characters for HTML into escaped ones.
#CONVSTR='
#s/</\&lt;/g
#s/>/\&gt;/g
#s/\\/\&#92;/g
#'
#EXECRES=$(eval $1 2> $TMP_EXEC_COMMAND_ERR | expand | cut -c 1-150 | sed +"$CONVSTR")

if [ -z "$EXECRES" ]
then
        EXECRES="n/a or not configured"
fi
if [ -s $TMP_EXEC_COMMAND_ERR ]
then
	echo "stderr output from \"$1\":" >> $ERROR_LOG
        cat $TMP_EXEC_COMMAND_ERR | sed 's/^/    /' >> $ERROR_LOG
fi
rm -f $TMP_EXEC_COMMAND_ERR

	## echo -e "\n" >> $HTML_OUTFILE_TEMP
	## echo -e "<A NAME=\"$2\"></A> <A HREF=\"#Inhalt-$2\"><H${HEADL}> $2 </H${HEADL}></A>\n" >>$HTML_OUTFILE_TEMP
	## echo -e "<PRE><B>$EXECRES</B></PRE>\n"  >>$HTML_OUTFILE_TEMP
	## #echo "<PRE><SMALL><B>$EXECRES</B></SMALL></PRE>\n"  >>$HTML_OUTFILE_TEMP
	## echo -e "<LI><A NAME=\"Inhalt-$2\"></A><A HREF=\"#$2\">$2</A>\n" >> $HTML_OUTFILE
	## echo -e "\n$EXECRES\n" >> $TEXT_OUTFILE_TEMP

#### new ###  #  13.08.2007, 13:28 modified by Ralph Roth

	if [ "$CFG_STINLINE" = "no" ]
	then
		## screen tips like cfg2html 1.20 when dragging mouse over link?
		echo -e "<A NAME=\"$2\"></A> <H${HEADL}><A HREF=\"#Inhalt-$2\" title=\"$1\"> $2 </A></H${HEADL}>" >>$HTML_OUTFILE_TEMP #orig screen tips by Ralph
	else
		## or more netscape friendly inline?
		echo -e "<A NAME=\"$2\"></A> <A HREF=\"#Inhalt-$2\"><H${HEADL}> $2 </H${HEADL}></A>" >>$HTML_OUTFILE_TEMP

		if [ "X$1" = "X$2" ]
			then    : #no need to duplicate, do nothing
		else
		        echo "<h6>$1</h6>">>$HTML_OUTFILE_TEMP
		fi

	fi      # screen tips inline???

        ###  Put the result out in proportional font
	echo -e "<PRE>$EXECRES</PRE>"  >>$HTML_OUTFILE_TEMP

	echo -e "<LI><A NAME=\"Inhalt-$2\"></A><A HREF=\"#$2\" title=\"$1\">$2</A>" >> $HTML_OUTFILE
	echo "$EXECRES" >> $TEXT_OUTFILE_TEMP

}

################# Schedule a job for killing commands which ###############
################# may hang under special conditions. <mortene@sim.no> #####
# Argument 1: regular expression to search process list for. Be careful
# when specifying this so you don't kill any more processes than
# those you are looking for!
# Argument 2: number of minutes to wait for process to complete.

KillOnHang() {
        TMP_KILL_OUTPUT=/tmp/kill_hang.tmp.$$
        at now + $2 minutes 1>$TMP_KILL_OUTPUT 2>&1 <<EOF
# ps -ef | grep root | grep -v grep | grep $1 | awk '{print \$2}' | sort -n -r | xargs kill
# ps -ef | grep $1 | awk '/root/ && !/grep/ {print $2}' | sort -n -r | xargs kill
ps -ef | grep $1 | awk '/root/ && !/grep/ {print $2}' | sort -n -r | xargs kill
EOF
        AT_JOB_NR=`awk ' /^job/ {print $2}' $TMP_KILL_OUTPUT`
        rm -f $TMP_KILL_OUTPUT
}

# You should always match a KillOnHang() call with a matching call
# to this function immediately after the command which could hang
# has properly finished.
CancelKillOnHang() {
        at -r $AT_JOB_NR
}

################# adds a text to the output files, rar, 25.04.99 ##########

AddText() {

        echo "<p>$*</p>" >> $HTML_OUTFILE_TEMP
        echo -e "$*\n" >> $TEXT_OUTFILE_TEMP
}
######################################################################
#  Ende des Dokumentes
######################################################################
#  end of the html document
######################################################################

close_html() {

echo "<hr>" >> $HTML_OUTFILE
echo -e "</P><P>\n<hr><FONT COLOR=blue>Created "$DATEFULL" with " $VERSION "</font>" >> $HTML_OUTFILE_TEMP
echo -e "</P><P>\n<FONT COLOR=blue>Copyright and maintained by <A HREF="mailto:$MAILTORALPH?subject=$VERSION_">Ralph Roth, ROSE SWE, </A></P></font>" >> $HTML_OUTFILE_TEMP
#echo -e " <FONT COLOR=blue>Maintained by <A HREF="mailto:$MAILTO?subject=$VERSION_">Jeroen Kleen, EMEA ISS CC Engineer</A></P></font>" >> $HTML_OUTFILE_TEMP
echo -e "<hr><center> <A HREF="http://come.to/cfg2html">[ Download cfg2html from external home page ]</b></A></center></P><hr></BODY></HTML>\n" >> $HTML_OUTFILE_TEMP
cat $HTML_OUTFILE_TEMP >>$HTML_OUTFILE
cat $TEXT_OUTFILE_TEMP >> $TEXT_OUTFILE
rm $HTML_OUTFILE_TEMP $TEXT_OUTFILE_TEMP
echo -e "\n\nCreated "$DATEFULL" with " $VERSION " \n" >> $TEXT_OUTFILE
echo -e "(c) 1998-2010 by ROSE SWE, Ralph Roth" >> $TEXT_OUTFILE
}

my_bdf() {
# bdf summary for HPUX, Ralph_Roth@hp.com, 5-feb-2001
#                 Linux, dk3hg

df -k | awk '/\// \
{
	alloc += $2;
	used  += $3;
	avail += $4;

}

END {
	print  "Allocated\tUsed \t \tAvailable\tUsed (%)";
	printf "%ld \t%ld \t%ld\t \t%3.1f\n", alloc, used, avail, (used*100.0/alloc);
	}'
}

PVDisplay ( ) {
	#function used in LVM-section
	# for disk in $(strings /etc/lvmtab.d/* |grep -e hd -e sc) ;

	for disk in $(vgdisplay -v 2> /dev/null | awk -F\ + '/PV Name/ {print $4}');    # fix by Alvaro Jimenez Cabrera, Mittwoch, 5. November 2008
	do
	        pvdisplay -v $disk; 							# due to PATH problems; A. Kumpf, 21.07.06???
	done
}

#
######################################################################
# Hauptprogramm mit Aufruf der obigen Funktionen und deren Parametern
#############################  M A I N  ##############################
#

line
echo "Starting          "$VERSION" "
echo "Path to Cfg2Html  "$0
echo "HTML Output File  "$HTML_OUTFILE
echo "Text Output File  "$TEXT_OUTFILE
echo "Partitions        "$OUTDIR/$BASEFILE.partitions.save
echo "Errors logged to  "$ERROR_LOG
echo "Started at        "$DATEFULL
echo "WARNING           USE AT YOUR OWN RISK!!! :-))"
echo
line
logger "Start of $VERSION"
open_html
inc_heading_level

#
# CFG_SYSTEM
#



if [ "$CFG_SYSTEM" != "no" ]
then # else skip to next paragraph

paragraph "Linux System $distrib"
inc_heading_level

if [ -f /etc/cfg2html/systeminfo ] ; then
  exec_command "cat /etc/cfg2html/systeminfo" "System description"
fi

exec_command "cat /proc/cpuinfo; echo" "CPU and Model info"

HostNames() {
uname -a
echo  "DNS Domainname  = "`dnsdomainname `
echo  "NIS Domainname  = "`domainname 2>/dev/null `
echo  "Hostname (short)= "`hostname`
echo  "Hostname (FQDN) = "`hostname -f`
}
exec_command  HostNames "uname & hostname"
exec_command "uname -n" "Host alias"
exec_command "uname -sr" "OS, Kernel version"
[ -x /usr/bin/lsb_release ] && exec_command "/usr/bin/lsb_release -a" "Linux Standard Base Version"
for i in /etc/*-release
do
	[ -r $i ] && exec_command "cat $i" "OS Specific Release Information ($i)"
done


posixversion() {

# wie findet man das bei Linux raus?
#echo "POSIX Version:  \c"; getconf POSIX_VERSION
#echo "POSIX Version:  \c"; getconf POSIX2_VERSION
#echo "X/OPEN Version: \c"; getconf XOPEN_VERSION
echo "LANG setting:   "$LANG
}

if [ -x /usr/bin/locale ] ; then
  exec_command posixversion "POSIX Standards/Settings"
  exec_command "locale" "locale specific information"
  export LANG="C"
  export LANG_ALL="C"
fi

exec_command "ulimit -a" "System ulimit"	#  13.08.2007, 14:24 modified by Ralph Roth

##### 19-Sept-2006, Ralph #####
# stderr output from "vmstat -dnS;vmstat -f":
#     vmstat: option requires an argument -- S
#     usage: vmstat [-V] [-n] [delay [count]]
#     unit size k:1000 K:1024 m:1000000 M:1048576 (default is K)

if [ -x /usr/bin/vmstat ] ; then        ## <c/m/a>  14.04.2009 - Ralph Roth
  exec_command "vmstat 1 10" "VM-Statistics 1 10"
  exec_command "vmstat -dn;vmstat -f" "VM-Statistics (Summary)"
fi
if [ -x /usr/bin/mpstat ] ; then
  exec_command "mpstat 1 5" "MP-Statistics"
fi
if [ -x /usr/bin/iostat ] ; then
  exec_command "iostat" "IO-Statistics"
fi

# sysutils
exec_command "uptime" "Uptime"
# exec_command "sar 1 9" "System Activity Report"
# exec_command "sar -b 1 9" "Buffer Activity"

[ -x /usr/bin/procinfo ] && exec_command "procinfo -a" "System status from /proc" #  15.11.2004, 14:09 modified by Ralph.Roth at hp.com  (HPS-TSG-MCPS)
# usage: pstree [ -a ] [ -c ] [ -h | -H pid ] [ -l ] [ -n ] [ -p ] [ -u ]
#               [ -G | -U ] [ pid | user]

if [ "$REDHAT" = "yes" ] || [ "$SUSE" = "yes" ] ; then	## 20070228 Oliver Schwabedissen, RH4/SLES9 don't support -A
	exec_command "pstree -p -a -l -G" "Active Process Overview" # 090102006
else
	exec_command "pstree -p -a  -l -G -A" "Active Process Overview" #  15.11.2004, 14:09 modified by Ralph.Roth
fi
exec_command "ps -ef | cut -c39- | sort -nr | head -25 | awk '{ printf(\"%10s   %s\\n\", \$1, \$2); }'" "Top load processes"
exec_command "ps -e -o 'vsz pid ruser cpu time args' |sort -nr|head -25" "Top memory consuming processes"

exec_command "last| grep boot" "reboots"
exec_command "alias"  "Alias"
[ -r /etc/inittab ] && exec_command "grep -vE '^#|^ *$' /etc/inittab" "inittab"
## This may report NOTHING on RHEL 3+4 ##
[ -x /sbin/chkconfig ] && exec_command "/sbin/chkconfig" "Services Startup"
[ -x /sbin/chkconfig ] && exec_command "/sbin/chkconfig --list" "Services Runlevel" # rar, fixed 2805-2005 for FC4

[ -x  /usr/sbin/sysv-rc-conf ] && exec_command " /usr/sbin/sysv-rc-conf --list" "Services Runlevel" # rr, 1002-2008

if [ "$GENTOO" = "yes" ] ; then   ## 2007-02-27 Oliver Schwabedissen
  [ -x /bin/rc-status ]  && exec_command "/bin/rc-status --list" "Defined runlevels"
  [ -x /sbin/rc-update ] && exec_command "/sbin/rc-update show --verbose" "Init scripts and their runlevels"
fi

if [ -d /etc/rc.config.d ] ; then
  exec_command " grep -v ^# /etc/rc.config.d/* | grep '=[0-9]'" "Runlevel Settings"
fi
[ -r /etc/inittab ] && exec_command "awk '!/#|^ *$/ && /initdefault/' /etc/inittab" "default runlevel"
exec_command "/sbin/runlevel" "current runlevel"

##
## we want to display the Boot Messages too
## 30Jan2003 it233 FRU
if [ -e /var/log/boot.msg ] ; then
  exec_command "grep 'Boot logging' /var/log/boot.msg" "Last Boot Date"
  exec_command "grep -v '|====' /var/log/boot.msg " "Boot Messages, last Boot"
fi

# MiMe: SUSE && UNITEDLINUX
# MiMe: until SuSE 7.3: params in /etc/rc.config and below /etc/rc.config.d/
# MiMe; since SuSE 8.0 including UL: params below /etc/sysconfig
if [ "$SUSE" = "yes" ] || [ "$UNITEDLINUX" = "yes" ] ; then
  if [ -d /etc/sysconfig ] ; then
    # MiMe:
    exec_command "find /etc/sysconfig -type f -not -path '*/scripts/*' -exec grep -vE '^#|^ *$' {} /dev/null \; | sort" "Parameter /etc/sysconfig"
  fi
  if [ -e /etc/rc.config ] ; then
    # PJC: added filters for SuSE rc_ variables
    # PJC: which were in rc.config in SuSE 6
    # PJC: and moved to /etc/rc.status in 7+
    exec_command "grep -vE -e '(^#|^ *$)' -e '^ *rc_' -e 'rc.status' /etc/rc.config | sort" "Parameter /etc/rc.config"
  fi
  if [ -d /etc/rc.config.d ] ; then
    # PJC: added filters for SuSEFirewall and indented comments
    exec_command "find /etc/rc.config.d -name '*.config' -exec grep -vE -e '(^#|^ *$)' -e '^ *true$' -e '^[[:space:] ]*#' -e '[{]|[}]' {} \; | sort" "Parameter /etc/rc.config.d"
  fi
fi

if [ "$GENTOO" = "yes" ] ; then	## 2007-02-28 Oliver Schwabedissen
  exec_command "grep -vE '^#|^ *$' /etc/rc.conf | sort" "Parameter /etc/rc.conf"
  exec_command "find /etc/conf.d -type f -exec grep -vE '^#|^ *$' {} /dev/null \;" "Parameter /etc/conf.d"
fi

if [ -e /proc/sysvipc ] ; then
  exec_command "ipcs" "IPC Status"
  exec_command "ipcs -u" "IPC Summary"
  exec_command "ipcs -l" "IPC Limits"
  ## ipcs -ma ???
fi

if [ -x /usr/sbin/pwck ] ; then
  exec_command "/usr/sbin/pwck -r && echo Okay" "integrity of password files"
fi

if [ -x /usr/sbin/grpck ] ; then
  exec_command "/usr/sbin/grpck -r && echo Okay" "integrity of group files"
fi

dec_heading_level

fi # terminates CFG_SYSTEM wrapper

#
# CFG_CRON
#
if [ "$CFG_CRON" != "no" ]
then # else skip to next paragraph
paragraph "Cron and At"
inc_heading_level

for FILE in cron.allow cron.deny
	do
		if [ -r /etc/$FILE ]
		then
		exec_command "cat /etc/$FILE" "$FILE"
		else
		exec_command "echo /etc/$FILE" "$FILE not found!"
		fi
	done

## Linux SuSE user /var/spool/cron/tabs and NOT crontabs
## 30jan2003 it233 FRU
##  SuSE has the user crontabs under /var/spool/cron/tabs
##  RedHat has the user crontabs under /var/spool/cron
##  UnitedLinux uses /var/spool/cron/tabs (MiMe)
if [ "$SUSE" == "yes" ] ; then
  usercron="/var/spool/cron/tabs"
fi
if [ "$REDHAT" == "yes" ] ; then
  usercron="/var/spool/cron"
fi
if [ "$SLACKWARE" == "yes" ] ; then
  usercron="/var/spool/cron/crontabs"
fi
if [ "$DEBIAN" == "yes" ] ; then
  usercron="/var/spool/cron/crontabs"
fi
if [ "$GENTOO" == "yes" ] ; then	## 2007-02-27 Oliver Schwabedissen
  usercron="/var/spool/cron/crontabs"
fi
if [ "$UNITEDLINUX" == "yes" ] ; then
  usercron="/var/spool/cron/tabs"
fi
##
ls $usercron/* > /dev/null 2>&1
if [ $? -eq 0 ]
then
        echo -e "\n\n<B>Crontab files:</B>" >> $HTML_OUTFILE_TEMP
        for FILE in $usercron/*
        do
                exec_command "cat $FILE | grep -v ^#" "For user `basename $FILE`"
        done
else
        echo "No crontab files for user.<br>" >> $HTML_OUTFILE_TEMP
fi

##
## we do also a listing of utility cron files
## under /etc/cron.d 30Jan2003 it233 FRU
ls /etc/cron.d/* > /dev/null 2>&1
if [ $? -eq 0 ]
then
        echo -e "\n\n<br><B>/etc/cron.d files:</B>" >> $HTML_OUTFILE_TEMP
        for FILE in /etc/cron.d/*
        do
                exec_command "cat $FILE | grep -v ^#" "For utility `basename $FILE`"
        done
else
        echo "No /etc/cron.d files for utlities." >> $HTML_OUTFILE_TEMP
fi

if [ -f /etc/crontab ] ; then
  exec_command "echo -e 'Crontab:\n';cat /etc/crontab | grep -vE '^#|^ *$'" "/etc/crontab"
fi

atconfigpath="/etc"
if [ "$GENTOO" == "yes" ] ; then	## 2007-02-27 Oliver Schwabedissen
	atconfigpath="/etc/at"
fi

for FILE in at.allow at.deny

	do
		if [ -r $atconfigpath/$FILE ]
		then
			exec_command "cat $atconfigpath/$FILE " "$atconfigpath/$FILE"
		else
			exec_command "echo $atconfigpath/$FILE" "No $atconfigpath/$FILE"
		fi
	done

## work around by Ralph for missing at
#(whereis at > /dev/null) || exec_command "at -l" "AT Scheduler"
# sorry - don't work here (Michael)
# now we try this
if [ -x /usr/bin/at ] ; then
  exec_command "at -l" "AT Scheduler"
fi

#exec_command "echo -e 'Crontab:\n';cat /etc/crontab | grep -vE '#|^ *$';echo -e '\nAT Scheduler:\n';at -l" "/etc/crontab and AT Scheduler"

dec_heading_level
fi #terminate CFG_CRON wrapper
#
# CFG_HARDWARE
#
if [ "$CFG_HARDWARE" != "no" ]
then # else skip to next paragraph

paragraph "Hardware"
inc_heading_level

RAM=`awk -F': *' '/MemTotal/ {print $2}' /proc/meminfo`
# RAM=`cat /proc/meminfo | grep MemTotal | awk -F\: '{print $2}' | awk -F\  '{print $1 " " $2}'`
exec_command "echo $RAM" "Physical Memory"

## Murray Barton, 14/4/2010
DMIDECODE=`which dmidecode`; if [ -n "$DMIDECODE" ] && [ -x $DMIDECODE ] ; then exec_command "$DMIDECODE 2> /dev/null" "DMI Table Decoder"; fi

# if [ -e /usr/sbin/dmidecode ]           ## this could be moved out to common stuff (e.g. useful to get serial number, # 26.03.2010 Ralph Roth)
# then
# 	exec_command "dmidecode" "/usr/sbin/dmidecode output"
# fi

HWINFO=`which hwinfo`; if [ -n "$HWINFO" ] && [ -x $HWINFO ] ; then exec_command "$HWINFO 2> /dev/null" "Hardware List (hwinfo)"; fi
LSHW=`which lshw`; if [ -n "$LSHW" ] && [ -x $LSHW ] ; then exec_command "$LSHW" "Hardware List (lshw)"; fi ##  13.12.2004, 15:53 modified by Ralph.Roth
LSDEV=`which lsdev`; if [ -n "$LSDEV" ] && [ -x $LSDEV ] ; then exec_command "$LSDEV" "Hardware List (lsdev)"; fi
LSHAL=`which lshal`; if [ -n "$LSHAL" ] && [ -x $LSHAL ] ; then exec_command "$LSHAL" "List of Devices (lshal)"; fi
LSUSB=`which lsusb`; if [ -n "$LSUSB" ] && [ -x $LSUSB ] ; then exec_command "$LSUSB" "USB devices"; fi	## SuSE? #  12.11.2004, 15:04 modified by Ralph.Roth at hp.com  (HPS-TSG-MCPS)

LSPCI=`which lspci`
if [ -n "$LSPCI" ] && [ -x $LSPCI ] ; then
  exec_command "$LSPCI -v" "PCI devices"
else
  if [ -f /proc/pci ] ; then
    exec_command "cat /proc/pci" "PCI devices"
  fi
fi

PCMCIA=`grep pcmcia /proc/devices | cut -d" " -f2`
if [ "$PCMCIA" = "pcmcia"  ] ; then
  if [ -x /sbin/cardctl ] ; then
    exec_command "/sbin/cardctl status;/sbin/cardctl config;/sbin/cardctl ident" "PCMCIA"
  fi
fi
[ -r /proc/acpi/info ] && exec_command "cat /proc/acpi/info" "ACPI" #  06.04.2006, 17:44 modified by Ralph Roth

if [ -f /etc/kbd/default.kmap.gz ] ; then
  exec_command "zcat /etc/kbd/default.kmap.gz | head -1 | sed s/#//" "Keymap"
fi
exec_command "cat /proc/ioports" "IoPorts"
exec_command "cat /proc/interrupts" "Interrupts"
if [ -f /proc/scsi/scsi ] ;then
  exec_command "find /proc/scsi" "SCSI Components" #  22.11.2004, 16:08 modified by Ralph.Roth at hp.com  (HPS-TSG-MCPS)
  exec_command "cat /proc/scsi/scsi" "SCSI Devices"
fi

#*#
#*# Alexander De Bernard 20100423
#*#

FDISKCMD=$( which fdisk )
SMARTCTL=$( which smartctl )
GREPCMD=$( which grep )
SEDCMD=$( which sed )
AWKCMD=$( which awk )

if [ -x "${FDISKCMD}" -a -x "${GREPCMD}" -a -x "${SEDCMD}" -a -x "${AWKCMD}" -a -x "${SMARTCTL}" ]
then
	PHYS_DRIVES=`${FDISKCMD} -l 2>&1 | \
		${GREPCMD} "^Disk " | \
		${GREPCMD} -vE "md[0-9]|identifier:" | \
		${SEDCMD} -e "s/:.*$//" | \
		${AWKCMD} '{print $2}'`

	for drive in ${PHYS_DRIVES}
	do
		exec_command "$SMARTCTL -P show $drive" "SMART features of drive $drive"
		exec_command "$SMARTCTL --info $drive" "SMART information of drive $drive"
		exec_command "$SMARTCTL --xall $drive" "SMART extended information of drive $drive"
	done
fi

## rar, 13.02.2004
## Changed 15.05.2006 (09:30) by Peter Lindblom, HP, STCC EMEA, changed title from SCSI Devices SCSI Disk Devices
[ -x /usr/sbin/lssd ] && exec_command "/usr/sbin/lssd" "SCSI Disk Devices"

## Added 15.05.2006 (09:30) by Peter Lindblom, HP, STCC EMEA
[ -x /usr/sbin/lssg ] && exec_command "/usr/sbin/lssg" "Generic SCSI Devices"

## rar, 13.02.2004
## Added 15.05.2006 (09:30) by Peter Lindblom, HP, STCC EMEA, Added the echo between the command to get a new line and move it down below lssg and lssd.
[ -x /usr/sbin/adapter_info ] && exec_command "/usr/sbin/adapter_info;echo;/usr/sbin/adapter_info -v" "Adapterinfo/WWN"
### ------------------------------------------------------------------------------

#### Start of Fibre HBA info. added 12.05.2006 (15:13) by Peter Lindblom, HP, STCC EMEA

 mcat()
 {
     echo "--- $1"
     cat $1
    # done
 }

 if [ -f /tmp/fibrehba.txt ]
 then
   rm /tmp/fibrehba.txt
 fi

 # capture /proc/scsi/qla2200

 if [ -d /proc/scsi/qla2200 ]
 then
   for file in /proc/scsi/qla2200/*
    do
      mcat $file >>/tmp/fibrehba.txt
    done
 fi

 # capture /proc/scsi/qla2300

 if [ -d /proc/scsi/qla2300 ]
 then
    for file in /proc/scsi/qla300/*
    do
      mcat $file >>/tmp/fibrehba.txt
     done
 fi

 # capture /proc/scsi/qla2xxx

 if [ -d /proc/scsi/qla2xxx ]
 then
    for file in /proc/scsi/qla2xxx/*
     do
      mcat $file >>/tmp/fibrehba.txt
     done
 fi


 # capture /proc/scsi/lpfc

 if [ -d /proc/scsi/lpfc ]
 then
    for file in /proc/scsi/lpfc/*
     do
      mcat $file >>/tmp/fibrehba.txt
     done
 fi

 if [ -f /tmp/fibrehba.txt ]
 then
   exec_command "cat /tmp/fibrehba.txt" "Fibre Channel Host Bus Adapters"
   rm /tmp/fibrehba.txt
 fi

#### End of Fibre HBA info.


## rar, 13.02.2004
[ -x /usr/sbin/spmgr ] && exec_command "/usr/sbin/spmgr display" "SecurePath - Manager"
[ -r /etc/CPQswsp/sppf ] && exec_command "cat /etc/CPQswsp/sppf" "SecurePath - Bindings"
[ -r /etc/CPQswsp/hsx.conf ] && exec_command "cat /etc/CPQswsp/hsx.conf" "SecurePath - Preferred Path Settings"
[ -r /etc/CPQswsp/swsp.conf ] && exec_command "cat /etc/CPQswsp/swsp.conf" "SecurePath - Path, Load Balance & Auto restore settings"
[ -r /etc/CPQswsp/notify.ini ] && exec_command "cat /etc/CPQswsp/notify.ini" "SecurePath - email address notification settings"
[ -r /etc/CPQswsp/spmgr_alias ] && exec_command "cat /etc/CPQswsp/spmgr_alias" "SecurePath - Alias Name file"
[ -r /etc/CPQswsp/spmgr_stop_list ] && exec_command "cat /etc/CPQswsp/spmgr_stop_list" "SecurePath - reserved key word settings file"
[ -r /etc/CPQswsp/clients ] && exec_command "cat /etc/CPQswsp/clients" "SecurePath - spmgr password information"

## Changed 15.05.2006 (09:30) by Peter Lindblom, HP, STCC EMEA, Moved from the Proliant section.
[ -f /var/log/sp_log ] && exec_command "cat /var/log/sp_log" "Secure path installation log"

## Changed 15.05.2006 (09:30) by Peter Lindblom, HP, STCC EMEA, Moved from the Proliant section.
[ -f /root/sp_install_results.log ] && exec_command "cat /root/sp_install_results.log" "Secure path installation log (backup)"
if [ -e /proc/sound ] ; then
  exec_command "cat /proc/sound" "Sound Devices"
fi
if [ -e /proc/asound ] ; then
  [ -f /proc/asound/version ] && exec_command "cat /proc/asound/version" "Asound Version"
  [ -f /proc/asound/modules ] && exec_command "cat /proc/asound/modules" "Sound modules"
  [ -f /proc/asound/cards ] && exec_command "cat /proc/asound/cards" "Sound Cards"
  [ -f /proc/asound/sndstat ] && exec_command "cat /proc/asound/sndstat" "Sound Stats"
  [ -f /proc/asound/timers ] && exec_command "cat /proc/asound/timers" "Sound Timers"
  [ -f /proc/asound/devices ] && exec_command "cat /proc/asound/devices" "Sound devices"
  [ -f /proc/asound/pcm ] && exec_command "cat /proc/asound/pcm" "Sound pcm"
fi
exec_command "cat /proc/dma" "DMA Devices"
if [ -f /proc/tty/driver/serial ] ; then
   exec_command "grep -v unknown /proc/tty/driver/serial" "Serial Devices"
fi
# test this - please report it
if [ -e /proc/rd ] ; then
  exec_command "cat /proc/rd/c*/current_status" "RAID controller"
fi

# get serial information

SETSERIAL=`which setserial`
if [ -n "$SETSERIAL" ] && [ -x $SETSERIAL ]; then
  exec_command "$SETSERIAL -a /dev/ttyS0" "Serial ttyS0"
  exec_command "$SETSERIAL -a /dev/ttyS1" "Serial ttyS1"
fi

# get IDE Disk information
HDPARM=`which hdparm`
# if hdparm is installed (DEBIAN 4.0)
# -i   display drive identification
# -I   detailed/current information directly from drive

#  -i   display drive identification (SuSE 10u1)
#  -I   detailed/current information directly from drive
#  --Istdin  reads identify data from stdin as ASCII hex
#  --Istdout writes identify data to stdout as ASCII hex

# Sep 23 19:12:47 hp02 root: Start of cfg2html-linux version 1.63-2009-08-27
# Sep 23 19:13:03 hp02 kernel: hda: drive_cmd: status=0x51 { DriveReady SeekComplete Error }
# Sep 23 19:13:03 hp02 kernel: hda: drive_cmd: error=0x04Aborted Command
# Sep 23 19:13:18 hp02 root: End of cfg2html-linux version 1.63-2009-08-27

# Anpassung auf hdparm -i wegen Fehler im Syslog (siehe oben, cfg1.63)
# Ingo Metzler 23.09.2009

if [ $HDPARM ]  && [ -x $HDPARM ]; then
  exec_command "\
	if [ -e /proc/ide/hda ] ; then echo -e -n \"read from drive\"; $HDPARM -i /dev/hda;fi;\
	if [ -e /proc/ide/hdb ] ; then echo; echo -e -n \"read from drive\"; $HDPARM -i /dev/hdb;fi;\
	if [ -e /proc/ide/hdc ] ; then echo; echo -e -n \"read from drive\"; $HDPARM -i /dev/hdc;fi;\
	if [ -e /proc/ide/hdd ] ; then echo; echo -e -n \"read from drive\"; $HDPARM -i /dev/hdd;fi;"\
  "IDE Disks"

  if [ -e /proc/ide/hda ] ; then
    if grep disk /proc/ide/hda/media > /dev/null ;then
      exec_command "$HDPARM -t -T /dev/hda" "Transfer Speed"
    fi
  fi
  if [ -e /proc/ide/hdb ] ; then
    if grep disk /proc/ide/hdb/media > /dev/null ;then
      exec_command "$HDPARM -t -T /dev/hdb" "Transfer Speed"
    fi
  fi
  if [ -e /proc/ide/hdc ] ; then
    if grep disk /proc/ide/hdc/media > /dev/null ;then
      exec_command "$HDPARM -t -T /dev/hdc" "Transfer Speed"
    fi
  fi
  if [ -e /proc/ide/hdd ] ; then
    if grep disk /proc/ide/hdd/media > /dev/null ;then
      exec_command "$HDPARM -t -T /dev/hdd" "Transfer Speed"
    fi
  fi
else
# if hdparm not available
  exec_command "\
    if [ -e /proc/ide/hda/model ] ; then echo -e -n \"hda: \";cat /proc/ide/hda/model ;fi;\
    if [ -e /proc/ide/hdb/model ] ; then echo -e -n \"hdb: \";cat /proc/ide/hdb/model ;fi;\
    if [ -e /proc/ide/hdc/model ] ; then echo -e -n \"hdc: \";cat /proc/ide/hdc/model ;fi;\
    if [ -e /proc/ide/hdd/model ] ; then echo -e -n \"hdd: \";cat /proc/ide/hdd/model ;fi;"\
 "IDE Disks"
fi

if [ -e /proc/sys/dev/cdrom/info ] ; then
  exec_command "cat /proc/sys/dev/cdrom/info" "CDROM Drive"
fi

if [ -e /proc/ide/piix ] ; then
   exec_command "cat /proc/ide/piix" "IDE Chipset info"
fi

# Test HW Health
# MiMe
if [ -x /usr/bin/sensors ] ; then
  if [ -e /proc/sys/dev/sensors/chips ] ; then
    exec_command "/usr/bin/sensors" "Sensors"
  fi
fi

if [ -x /usr/sbin/xpinfo ]
then
  XPINFOFILE=$OUTDIR/`hostname`_xpinfo.csv
  /usr/sbin/xpinfo -d";" | grep -v "Scanning" > $XPINFOFILE

  AddText "The XP-Info configuration was additionally dumped into the file <b>$XPINFOFILE</b> for further usage"

# remarked due to enhancement request by Martin Kalmbach, 25.10.2001
#  exec_command "/usr/sbin/xpinfo|grep -v Scanning" "SureStore E Disk Array XP Mapping (xpinfo)"

  exec_command "/usr/sbin/xpinfo -r|grep -v Scanning" "SureStore E Disk Array XP Disk Mechanisms"
  exec_command "/usr/sbin/xpinfo -i|grep -v Scanning" "SureStore E Disk Array XP Identification Information"
  exec_command "/usr/sbin/xpinfo -c|grep -v Scanning" "SureStore E Disk Array XP (Continuous Access and Business Copy)"
# else
# [ -x /usr/contrib/bin/inquiry256.ksh ] && exec_command "/usr/contrib/bin/inquiry256.ksh" "SureStore E Disk Array XP256 Mapping (inquiry/obsolete)"
fi

dec_heading_level

fi # terminates CFG_HARDWARE wrapper

######################################################################

##### ToDo: check for Distribution #####

if [ "$CFG_SOFTWARE" != "no" ]
then # else skip to next paragraph

  paragraph "Software"
  inc_heading_level

  # Debian
  if [ "$DEBIAN" = "yes" ] ; then
    dpkg --get-selections | awk '!/deinstall/ {print $1}' > /tmp/cfg2html-debian.$$
    exec_command "column /tmp/cfg2html-debian.$$" "Packages installed"
    rm -f /tmp/cfg2html-debian.$$
    AddText "Hint: to reinstall this list use:"
    AddText "awk '{print \$1\"\\n\"\$2}' this_list |  dpkg --set-selections"
    exec_command "dpkg -C" "Misconfigured Packages"
#   # { changed/added 25.11.2003 (14:29) by Ralph Roth }
    if [ -x /usr/bin/deborphan ] ; then
      exec_command "deborphan" "Orphaned Packages"
      AddText "Hint: deborphan | xargs aptitude -y purge"	# rar, 16.02.04
    fi
    exec_command "dpkg -l" "Detailed list of installed Packages"
    AddText "$(dpkg --version|grep program)"
    exec_command "grep -vE '^#|^ *$' /etc/apt/sources.list" "Installed from"
    [ -x /usr/bin/dpigs ] && exec_command "/usr/bin/dpigs" "Largest installed packages"
  fi
  # end Debian

  # SUSE
  # MiMe: --last tells date of installation
  if [ "$SUSE" = "yes" ] || [ "$UNITEDLINUX" = "yes" ] ; then
    exec_command "rpm -qa --last" "Packages installed (last first)"		#*#   Alexander De Bernardi //09.03.2010/rr
    exec_command "rpm -qa | sort -d -f" "Packages installed (sorted)"		#*#   Alexander De Bernardi //09.03.2010/rr
    exec_command "rpm -qa --queryformat '%{NAME}\n' | sort -d -f" "Packages installed, Name only (sorted)"		#*#   Alexander De Bernardi //21.04.2010/rr
    exec_command "rpm -qa --queryformat '%-50{NAME} %{VENDOR}\n' | sort -d -f" "Packages installed, Name and Vendor only (sorted)"		#*#   Alexander De Bernardi //21.04.2010/rr
    exec_command "rpm --querytags" "RPM Query Tags"		#*#   Alexander De Bernardi //21.04.2010/rr

  fi
  # end SUSE

  # REDHAT
  if [ "$REDHAT" = "yes" ] || [ "$MANDRAKE" = "yes" ] ; then
    exec_command "rpm -qia | grep -e Source -e Name" "Packages installed"
    exec_command "rpm -qa | sort -d -f" "Packages installed (sorted)"       #*#   Alexander De Bernardi //09.03.2010 12:31/rr
    exec_command "rpm -qa --queryformat '%{NAME}\n' | sort -d -f" "Packages installed, Name only (sorted)"		#*#   Alexander De Bernardi //21.04.2010/rr
    exec_command "rpm -qa --queryformat '%-50{NAME} %{VENDOR}\n' | sort -d -f" "Packages installed, Name and Vendor only (sorted)"		#*#   Alexander De Bernardi //21.04.2010/rr
    exec_command "rpm --querytags" "RPM Query Tags"		#*#   Alexander De Bernardi //21.04.2010/rr

  fi
  # end REDHAT

  # SLACKWARE
  if [ "$SLACKWARE" = "yes" ] ; then
    exec_command "ls /var/log/packages " "Packages installed"
  fi
  # end SLACKWARE
  # GENTOO, rr, 15.12.2004, Rob
  if [ "$GENTOO" = "yes" ] ; then
    #exec_command "qpkg -I -v|sort" "Packages installed"
    #exec_command "qpkg -I -v  --no-color |sort" "Packages installed" ## Rob Fantini, 15122004
    exec_command "qlist -I -v --nocolor |sort" "Packages installed" ## 2007-02-21 Oliver Schwabedissen
  fi
  # end GENTOO
#### programming stuff ####
# plugin for cfg2html/linux/hpux #  22.11.2005, 16:03 modified by Ralph Roth
# @(#)$Id: cfg2html-linux,v 1.78 2010-04-26 11:58:23 ralproth Exp $

ProgStuff()
{
 for i in libtoolize libtool automake autoconf autoheader g++ gcc make flex sed
 do
  (which $i 2> /dev/null) && (echo -n "$i: ";$i --version | head -1)  #  09.01.2008, 14:49 modified by Ralph Roth
 done
}
 exec_command ProgStuff "Software Development: Programs and Versions"

  dec_heading_level

fi # terminates CFG_SOFTWARE wrapper

######################################################################
if [ "$CFG_FILESYS" != "no" ]
then # else skip to next paragraph

paragraph "Filesystems, Dump- and Swapconfiguration"
inc_heading_level

exec_command "grep -v '^#' /etc/fstab" "FileSystemTab"
exec_command "df -k" "Filesystems and Usage"
exec_command "my_bdf" "All Filesystems and Usage"
exec_command "mount" "Local Mountpoints"
#
exec_command "/sbin/fdisk -l" "Disk Partitions"

#
sfdisk -d > $OUTDIR/$BASEFILE.partitions.save
exec_command "cat $OUTDIR/$BASEFILE.partitions.save" "Disk Partitions to restore from"
AddText "To restore your partitions use the saved file: $BASEFILE.partitions.save, read the man page for sfdisk for usage. (Hint: sfdisk --force /dev/device < file.save)"

#*#
#*# Alexander De Bernard 20100310
#*#

MD_FILE="/etc/mdadm.conf"
MD_CMD="/sbin/mdadm"

if [ -f ${MD_FILE} ]
then
	exec_command "grep -vE '^#|^ *$' ${MD_FILE}" "MD Configuration File"
	if [ -x ${MD_CMD} ]
	then
		MD_DEV=$(grep "ARRAY" ${MD_FILE} | awk '{print $2;}')
		for d in "$MD_DEV"
		do
			exec_command "${MD_CMD} --detail ${d}" "MD Device setup of $d"
		done
	else
		AddText "${MD_FILE} exists but no ${MD_CMD} command"
	fi
fi

# for LVM using sed
exec_command "/sbin/fdisk -l|sed 's/8e \ Unknown/8e \ LVM/g'" "Disk Partitions"

if [ -f /etc/exports ] ; then
    exec_command "grep -vE '^#|^ *$' /etc/exports" "NFS Filesystems"
fi

# In "used memory.swap" section I would add :
# free -l     (instead of free, because it gives some more useful infos, about HighMem and LowMem memory regions (zones))
# cat /proc/meminfo (in order to get some details of memory usage)

exec_command "free -l" "used memory/swap"
exec_command "cat /proc/meminfo" "Detailed memory usage"

dec_heading_level

fi # terminates CFG_FILESYS wrapper

###########################################################################
## 3/6/08 New: RedHat multipath config  by krtmrrsn@yahoo.com, Marc Korte.
if [ $REDHAT = "yes" ] && [ -n $(ps -ef | awk '/\/sbin\/multipathd/ {print $NF}') ] ; then

  paragraph "Multipath Configuration"
  inc_heading_level

  exec_command "rpm -qa | grep multipath" "Multipath Package Version"
  exec_command "chkconfig --list multipathd" "Multipath Service Status"
  exec_command "/sbin/multipath -v2 -d -ll" "Multipath Devices Basic Information"
  exec_command "/sbin/multipath -v3 -d -ll" "Multipath Devices Detailed Information"
  exec_command "grep -vE '^#|^ *$' /etc/multipath.conf" "Multipath Configuration File"
  exec_command "for MultiPath in \$(/sbin/multipath -v1 -d -l); do ls -l /dev/mapper/\${MultiPath}; done" "Device Mapper Files"
  exec_command "cat /var/lib/multipath/bindings" "Multipath Bindings"

  dec_heading_level
fi

###########################################################################
if [ "$CFG_LVM" != "no" ]
then # else skip to next paragraph

   paragraph "LVM"
   inc_heading_level

# WONT WORK WITH HP RAID!
LVMFDISK=$(/sbin/fdisk -l | grep "LVM$")

     if  [ -n "$LVMFDISK" -o -s /etc/lvmtab -o /etc/lvm/lvm.conf ] ; then # <m>  11.03.2008, 1158 -  Ralph Roth
     vgdisplay -s > /dev/null 2>&1 #  10032008 modified by Ralph.Roth
# due to LVM2 (doesn't use /etc/lvmtab anymore), but should be compatible to LVM1; A. Kumpf
	if [ "$?" = "0" ] ; then
	      AddText "The system filelayout is configured using the LVM (Logical Volume Manager)"
	# choose between LVM1 and LVM2 because of different syntaxes; A. Kumpf, 21.07.06
	     if [ -x "/sbin/lvm" ]; then
	       LVM_VER=2
	     else
	       LVM_VER=1
	     fi
	    #
		    case "$LVM_VER" in
		    "1")
			exec_command "lvscan --version" "LVM Version"
		      exec_command "ls -la /dev/*/group" "Volumegroup Device Files"
		      # { changed/added 29.01.2004 (11:15) by Ralph Roth } - sr by winfried knobloch for Serviceguard
		      exec_command "cat /proc/lvm/global" "LVM global info"
		      exec_command "vgdisplay -v | awk -F' +' '/PV Name/ {print \$4}'" "Available Physical Groups"
		      exec_command "vgdisplay -s | awk -F\\\" '{print \$2}'" "Available Volume Groups"
		      exec_command "vgdisplay -v | awk -F' +' '/LV Name/ {print \$3}'" "Available Logical Volumes"
		      ;;
		    "2")
		      exec_command "ls -al /dev/mapper/*" "Volumegroup Device Files"
		      exec_command "lvm version" "LVM global info"
		      exec_command "vgdisplay -v | awk -F' +' '/PV Name/ {print \$4}'" "Available Physical Groups"
		      exec_command "vgdisplay -s | awk -F\\\" '{print \$2}'" "Available Volume Groups"
		      exec_command "vgdisplay -v | awk -F' +' '/LV Name/ {print \$4}'" "Available Logical Volumes"
		      ;;
		    esac
	    #
	      exec_command "vgdisplay -v" "Volumegroups"
	      exec_command PVDisplay "Physical Devices used for LVM"
	      AddText "Note: Run vgcfgbackup on a regular basis to backup your volume group layout"
	    else
	      # if vgdisplay exist, but no LV configured (dk3hg 21.02.03)
	      AddText "LVM binaries found, but this system seems to be configured with whole disk layout (WDL)"
	fi
  else
    AddText "This system seems to be configured with whole disk layout (WDL)"
  fi

  # MD Tools, Ralph Roth

  if [ -r /etc/raidtab ]
  then
   exec_command "cat /proc/mdstat" "Software RAID: mdstat"
   exec_command "cat /etc/raidtab" "Software RAID: raidtab"
   [ -r /proc/devices/md ] && exec_command "cat /proc/devices/md" "Software RAID: MD Devices"
  fi

  dec_heading_level

fi # terminates CFG_LVM wrapper

###########################################################################
if [ "$CFG_NETWORK" != "no" ]
then # else skip to next paragraph

  paragraph "Network Settings"
  inc_heading_level

  exec_command "/sbin/ifconfig" "LAN Interfaces"
  #exec_command "for interface in \$(lanscan|grep 'lan. '|awk '{print \$5}'|sort) ; do ifconfig \$interface; done" "LAN Interface Configuration"

  if [ $DEBIAN = "yes" ] ; then
    if [ -f /etc/network/interfaces ] ; then
      exec_command "grep -vE '(^#|^$)' /etc/network/interfaces" "Netconf Settings"
    fi
  fi

    ## Added 3/05/08 by krtmrrsn@yahoo.com, Marc Korte, display ethernet
    ##  LAN and route config files for RedHat.
  if [ $REDHAT = "yes" ] ; then
      ## There will always be at least ifcfg-lo.
    exec_command "for CfgFile in /etc/sysconfig/network-scripts/ifcfg-*; do printf \"\n\n\$(basename \${CfgFile}):\n\n\"; cat \${CfgFile}; done" "LAN Configuration Files"
      ## Check first that any route-* files exist ("grep  -q ''" exit status).
    exec_command "if grep -q '' /etc/sysconfig/network-scripts/route-*; then for RouteCfgFile in /etc/sysconfig/network-scripts/route-*; do printf \"\n\n\$(basename \${RouteCfgFile}):\n\n\"; cat \${RouteCfgFile}; done; fi" "Route Configuration Files"
  fi
    ## End Marc Korte display ethernet LAN config files.

  [ -x /sbin/mii-tool ] && exec_command "/sbin/mii-tool -v" "MII Status"
  [ -x /sbin/mii-diag ] && exec_command "/sbin/mii-diag -a" "MII Diagnostics"

  NETSTAT=`which netstat`
  if [ $NETSTAT ]  && [ -x $NETSTAT ]; then
    # test if netstat version 1.38, because some options differ in older versions
    # MiMe: '\' auf awk Zeile wichtig
    RESULT=`netstat -V | awk '/netstat/ {
        if ( $2 < 1.38 ) {
          print "NO"
        } else { print "OK" }
      }'`
    exec_command "netstat -r" "Routing Tables"
    #exec_command "if [ "$RESULT" = "OK" ] ; then netstat -gi; fi" "Interfaces"
    if [ "$RESULT" = "OK" ]
      then
       exec_command "netstat -gi" "Interfaces"
       exec_command "netstat -tlpn" "TCP Daemons acceppting connection"
       exec_command "netstat -ulpn" "UDP Daemons acceppting connection"
      fi
    ## Added 4/07/06 by krtmrrsn@yahoo.com, Marc Korte, probe and display
     ##        kernel interface bonding info.
     if [ -e /proc/net/bonding ]; then
       for BondIF in `ls -1 /proc/net/bonding`
       do
         exec_command "cat /proc/net/bonding/$BondIF" "Bonded Interfaces: $BondIF"
       done
     fi
     ## End Marc Korte kernel interface bonding addition.

    exec_command "netstat -s" "Summary statistics for each protocol"
    exec_command "netstat -i" "Kernel Interface table"
    # MiMe: iptables since 2.4.x
    # MiMe: iptable_nat realisiert dabei das Masquerading
    # MiMe: Details stehen in /proc/net/ip_conntrack
    if [ -e /proc/net/ip_masquerade ]; then
      exec_command "netstat -M" "Masqueraded sessions"
    fi
    if [ -e /proc/net/ip_conntrack ]; then
      exec_command "cat /proc/net/ip_conntrack" "Masqueraded sessions"
    fi
    exec_command "netstat -an" "list of all sockets"
  fi

  DIG=`which dig`
  if [ -n "$DIG" ] && [ -x $DIG ] ; then
    exec_command "dig `hostname -f`" "dig hostname"
  else
    NSLOOKUP=`which nslookup`
    if [ -n "$NSLOOKUP" ] && [ -x $NSLOOKUP ] ; then
      exec_command "nslookup `hostname -f`" "Nslookup hostname"
    fi
  fi

  exec_command "grep -vE '^#|^ *$' /etc/hosts" "/etc/hosts"
#
  if [ -f /proc/sys/net/ipv4/ip_forward ] ; then
    FORWARD=`cat /proc/sys/net/ipv4/ip_forward`
    if [ $FORWARD = "0" ] ; then
      exec_command "echo \"IP forward disabled\"" "IP forward"
    else
      exec_command "echo \"IP forward enabled\"" "IP forward"
    fi
  fi

  if [ -r /proc/net/ip_fwnames ] ; then
    if [ -x /sbin/ipchains ] ;then
      exec_command "/sbin/ipchains -n -L forward" "ipfilter forward settings"
      exec_command "/sbin/ipchains -L -v" "ip filter settings"
    fi
  fi

  if [ -r /proc/net/ip_tables_names ] ; then
    if [ -x /sbin/iptables ] ; then
      exec_command "/sbin/iptables -L -v" "iptables list chains" ## rr, 030604 -v added
      exec_command "/sbin/iptables-save" "iptables rules" ## rr, 120704 added
    fi
  fi

  if [ -x /usr/sbin/tcpdchk ] ; then
    exec_command "/usr/sbin/tcpdchk -v" "tcpd wrapper"
    exec_command "/usr/sbin/tcpdchk -a" "tcpd warnings"
  fi

  [ -f /etc/hosts.allow ] && exec_command "grep  -vE '^#|^ *$' /etc/hosts.allow" "hosts.allow"
  [ -f /etc/hosts.deny ] && exec_command "grep  -vE '^#|^ *$' /etc/hosts.deny" "hosts.deny"

  #exec_command "nettl -status trace" "Nettl Status"

  if [ -f /etc/gated.conf ] ; then
      exec_command "cat /etc/gated.conf" "Gate Daemon"
  fi

  if [ -f /etc/bootptab ] ; then
      exec_command "grep -vE '(^#|^ *$)' /etc/bootptab" "BOOTP Daemon Configuration"
  fi

  if [ -r /etc/inetd.conf ]; then
    exec_command "grep -vE '^#|^ *$' /etc/inetd.conf" "Internet Daemon Configuration"
  fi
  #  02.05.2005, 15:23 modified by Ralph.Roth at hp.com  (HPS-TSG-MCPS)

  # RedHat default
  ## exec_command "grep -vE '^#|^ *$' /etc/inetd.conf" "Internet Daemon Configuration"
  if [ -d /etc/xinetd.d ]; then
    # mdk/rh has a /etc/xinetd.d directory with a file per service
    exec_command "cat /etc/xinetd.d/*|grep -vE '^#|^ *$'" "/etc/xinetd.d/ section"
  fi

  #exec_command "cat /etc/services" "Internet Daemon Services"
  if [ -f /etc/resolv.conf ] ; then
     exec_command "grep -vE '^#|^ *$' /etc/resolv.conf;echo; ( [ -f /etc/nsswitch.conf ] &&  grep -vE '^#|^ *$' /etc/nsswitch.conf)" "DNS & Names"
  fi
  [ -r /etc/bind/named.boot ] && exec_command "grep -v '^;' /etc/named.boot"  "DNS/Named"

if [ -x /usr/sbin/nullmailer-send ]
then
	:               ##  provides sendmail which NO options
else
  if [ ! -f /etc/sendmail.cf ] ; then
    /usr/sbin/sendmail -bV 2> /dev/null > /dev/null && exec_command "/usr/sbin/sendmail -bV" "Sendmail/Exim Version" #  23.03.2006, 13:20 modified by Ralph Roth
  else
    ## exec_command "/usr/sbin/sendmail -bv -d0.1 testuser@test.host" "Sendmail Version" ## hangs Ubuntu 9.04/karmic
    exec_command "echo \$Z | /usr/sbin/sendmail -bt -d" "Sendmail Version"               ## new workaround? #  28.01.2010, 21:24 modified by Ralph Roth
  fi
fi

  aliasespath="/etc"
  if [ "$GENTOO" == "yes" ] ;then	## 2007-02-27 Oliver Schwabedissen
    aliasespath="/etc/mail"
  fi
  if [ -f $aliasespath/aliases ] ; then
    exec_command "grep -vE '^#|^ *$' $aliasespath/aliases" "Email Aliases"
  fi
  #exec_command "grep -vE '^#|^$' /etc/rc.config.d/nfsconf" "NFS settings"
  exec_command "ps -ef|grep -E '[Nn]fsd|[Bb]iod'" "NFSD and BIOD utilization"	## fixed 2007-02-28 Oliver Schwabedissen

  # if portmap not available, do nothing
  RES=`ps xau | grep [Pp]ortmap`
  if [ -n "$RES" ] ; then
    exec_command "rpcinfo -p " "RPC (Portmapper)"
    # test if mountd running
    MOUNTD=`rpcinfo -p | awk '/mountd/ {print $5; exit}'`
  #  if [ "$MOUNTD"="mountd" ] ; then
    if [ -n "$MOUNTD" ] ; then
      exec_command "rpcinfo -u 127.0.0.1 100003" "NSFD responds to RPC requests"
      SHOWMOUNT=`which showmount`	## 2007-02-27 Oliver Schwabedissen
      if [ $SHOWMOUNT ] && [ -x $SHOWMOUNT ] ; then
        exec_command "$SHOWMOUNT -a" "Mounted NFS File Systems"
      fi
      # SUSE
      if [ -x /usr/lib/autofs/showmount ] ; then
        exec_command "/usr/lib/autofs/showmount -a" "Mounted NFS File Systems"
      fi
      if [ -f /etc/auto.master ] ;then
        exec_command "grep -vE '^#|^$' /etc/auto.master" "NFS Automounter Master Settings"
      fi
      if [ -f /etc/auto.misc ] ;then
        exec_command "grep -vE '^#|^$' /etc/auto.misc" "NFS Automounter misc Settings"
      fi
      if [ -f /proc/net/rpc/nfs ] ; then
        exec_command "nfsstat" "NFS Statistics"
      fi
    fi # mountd
  fi

  #(ypwhich 2>/dev/null>/dev/null) && \
  #    (exec_command "what /usr/lib/netsvc/yp/yp*; ypwhich" "NIS/Yellow Pages")

  # ntpq live sometimes in /usr/bin or /usr/sbin
  NTPQ=`which ntpq`
  # if [ $NTPQ ] && [ -x $NTPQ ] ; then
  if [ -n "$NTPQ" ] && [ -x "$NTPQ" ] ; then      # fixes by Ralph Roth, 180403
    exec_command "$NTPQ -p" "XNTP Time Protocol Daemon"
  fi
  [ -f /etc/ntp.conf ] && exec_command "grep  -vE '^#|^ *$' /etc/ntp.conf" "ntp.conf"
  [ -f /etc/shells ] && exec_command "grep  -vE '^#|^ *$'  /etc/shells" "FTP Login Shells"
  [ -f /etc/ftpusers ] && exec_command "grep  -vE '^#|^ *$'  /etc/ftpusers" "FTP Rejections (/etc/ftpusers)"
  [ -f /etc/ftpaccess ] && exec_command "grep  -vE '^#|^ *$'  /etc/ftpaccess" "FTP Permissions (/etc/ftpaccess)"
  [ -f /etc/syslog.conf ] && exec_command "grep  -vE '^#|^ *$' /etc/syslog.conf" "syslog.conf"
  [ -f /etc/syslog-ng/syslog-ng.conf ] && exec_command "grep  -vE '^#|^ *$' /etc/syslog-ng/syslog-ng.conf" "syslog-ng.conf"
  [ -f /etc/host.conf ] && exec_command "grep  -vE '^#|^ *$' /etc/host.conf" "host.conf"

  ######### SNMP ############
  [ -f /etc/snmpd.conf ] && exec_command "grep -vE '^#|^ *$' /etc/snmpd.conf" "Simple Network Management Protocol (SNMP)"
  [ -f /etc/snmp/snmpd.conf ] && exec_command "grep -vE '^#|^ *$' /etc/snmp/snmpd.conf" "Simple Network Management Protocol (SNMP)"
  [ -f /etc/snmp/snmptrapd.conf ] && exec_command "grep -vE '^#|^ *$' /etc/snmp/snmptrapd.conf" "SNMP Trapdaemon config"

  [ -f  /opt/compac/cma.conf ] && "grep -vE '^#|^ *$' /opt/compac/cma.conf" "HP Insight Management Agents configuration"

  ## ssh
  [ -f /etc/ssh/sshd_config ] && exec_command "grep -vE '^#|^ *$' /etc/ssh/sshd_config" "sshd config"
  [ -f /etc/ssh/ssh_config ] && exec_command "grep -vE '^#|^ *$' /etc/ssh/ssh_config" "ssh config"

  dec_heading_level

fi # terminates CFG_NETWORK wrapper


###########################################################################
if [ "$CFG_KERNEL" != "no" ]
then # else skip to next paragraph

paragraph "Kernel, Modules and Libraries" "Kernelparameters"
inc_heading_level

if [ -f /etc/lilo.conf ] ; then
  exec_command "grep -vE '^#|^ *$' /etc/lilo.conf" "Lilo Boot Manager"
  exec_command "/sbin/lilo -q" "currently mapped files"
fi

if [ -f /boot/grub/menu.lst ] ; then
  exec_command "grep -vE '^#|^ *$' /boot/grub/menu.lst" "GRUB Boot Manager" # rar
fi

if [ -f /etc/palo.conf ] ; then
  exec_command "grep -vE '^#|^ *$' /etc/palo.conf" "Palo Boot Manager"
fi
exec_command "ls -l /boot" "Files in /boot" # 2404-2006, ralph
exec_command "/sbin/lsmod" "Loaded Kernel Modules"
exec_command "ls -l /lib/modules" "Available Modules Trees"  # rar

if [ -f /etc/modules.conf ] ; then
  exec_command "grep -vE '^#|^ *$' /etc/modules.conf" "modules.conf"
fi
if [ -f /etc/modprobe.conf ] ; then
  exec_command "grep -vE '^#|^ *$' /etc/modprobe.conf" "modprobe.conf"
fi

if [ -f /etc/sysconfig/kernel ] ; then
  exec_command "grep -vE '^#|^ *$' /etc/sysconfig/kernel" "Modules for the ramdisk"	# rar, SuSE only
fi

if [ "$DEBIAN" = "no" ] && [ "SLACKWARE" = "no" ] ; then
        which rpm > /dev/null  && exec_command "rpm -qa | grep -e ^k_def -e ^kernel -e k_itanium -e k_smp -e ^linux" "Kernel RPMs" # rar, SuSE+RH+Itanium2
fi

if [ "$DEBIAN" = "yes" ] ; then
  	exec_command "dpkg -l | grep -i -e Kernel-image -e Linux-image" "Kernel related DEBs"
fi
[ -x /usr/sbin/get_sebool ] && exec_command "/usr/sbin/get_sebool -a" "SELinux Settings"

who -b 2>/dev/null > /dev/null && exec_command "who -b" "System boot" #  23.03.2006, 13:18 modified by Ralph Roth
exec_command "cat /proc/cmdline" "Kernel commandline"

exec_command "getconf GNU_LIBC_VERSION" "libc Version (getconf)"

if [ -r  /lib/libc.so.5 ]
then
if [ -x  /lib/libc.so.5 ]
then
	exec_command "/lib/libc.so.5" "libc5 Version"  # Mandrake 9.2
else
	exec_command "strings /lib/libc.so.5 | grep \"release version\"" "libc5 Version (Strings)"
	############# needs work out!
	## rpm ## ldd
fi
fi

if [ -r  /lib/libc.so.6 ]
then
if [ -x  /lib/libc.so.6 ]
then
	exec_command "/lib/libc.so.6" "libc6 Version"  # Mandrake 9.2
else
	exec_command "strings /lib/libc.so.6 | grep \"release version\"" "libc6 Version (Strings)"
	############# needs work out!
	## rpm ## ldd
fi
fi

if [ "$DEBIAN" = "no" ] && [ "$SLACKWARE" = "no" ] && [ "$GENTOO" = "no" ] ; then  ## fixed 2007-02-27 Oliver Schwabedissen
        which rpm > /dev/null  && exec_command "rpm -qi glibc" "libc6 Version (RPM)" # rar, SuSE+RH
fi


exec_command "/sbin/ldconfig -vN" "Run-time link bindings"

# MiMe: SuSE patched kernel params into /proc
if [ -e /proc/config.gz ] ; then
  exec_command "zcat /proc/config.gz | grep -vE '^#|^ *$'" "Kernelparameter /proc/config.gz"
else
  if [ -e /usr/src/linux/.config ] ; then
    exec_command "grep -vE '^#|^ *$' /usr/src/linux/.config" "Kernelsource .config"
  fi
fi

##
## we want to display special kernel configuration as well
## done in /etc/init.d/boot.local
## 31Jan2003 it233 U.Frey FRU
if [ -e /etc/init.d/boot.local ] ; then
  exec_command "grep -vE '^#|^ *$' /etc/init.d/boot.local" "Additional Kernel Parameters init.d/boot.local"
fi

if [ -x /sbin/sysctl ] ; then ##  11.01.2010, 10:44 modified by Ralph Roth
  exec_command "/sbin/sysctl -a | sort -u" "configured kernel variables at runtime"
  exec_command "cat /etc/sysctl.conf | sort -u |grep -v -e ^# -e ^$" "configured kernel variables in /etc/sysctl.conf"
fi

if [ -f "/etc/rc.config" ] ; then
   exec_command "grep ^INITRD_MODULES /etc/rc.config" "INITRD Modules"
fi

dec_heading_level

fi # terminates CFG_KERNEL wrapper
######################################################################

if [ "$CFG_ENHANCEMENTS" != "no" ]
then # else skip to next paragraph

	paragraph "System Enhancements"
	inc_heading_level

	if [ -e /etc/X11/XF86Config ] ; then
	  exec_command "grep -vE '^#|^ *$' /etc/X11/XF86Config" "XF86Config"
	else
	  if  [ -e /etc/XF86Config ] ; then
	    exec_command "grep -vE '^#|^ *$' /etc/XF86Config" "XF86Config"
	  fi
	fi

	# stderr output from "grep -vE '^#|^ *$' /etc/XF86Config-4":
	#    grep: /etc/XF86Config-4: No such file or directory

	if [ -e /etc/X11/XF86Config-4 ] ; then
	  exec_command "grep -vE '^#|^ *$' /etc/X11/XF86Config-4" "XF86Config-4"
	else
	  if  [ -e /etc/XF86Config-4 ] ; then                                   #  09.01.2008, 14:49 modified by Ralph Roth
	    exec_command "grep -vE '^#|^ *$' /etc/XF86Config-4" "XF86Config-4"
	  fi
	fi

	if [ -e /etc/X11/xorg.conf ] ; then
	  exec_command "grep -vE '^#|^ *$' /etc/X11/xorg.conf" "xorg.conf"
	fi

	# MiMe: fuer X braucht man Rechte
	if [ -x /usr/X11R6/bin/xhost ] ; then
	  /usr/X11R6/bin/xhost > /dev/null 2>&1
	  if [ "$?" -eq "0" ] ;
	  then
		# Gratien D'haese
		# fix for sshdX11
		# old command   [ -x /usr/bin/X11/xdpyinfo ] && [ -n "$DISPLAY" ] && exec_command "/usr/bin/X11/xdpyinfo" "X11"
		# this will only check if the display is 0 or 1 which is more then enough
		    [ -x /usr/bin/X11/xdpyinfo ] && [ -n "$DISPLAY" ] && [ `echo $DISPLAY | cut -d: -f2 | cut -d. -f1` -le 1 ] && exec_command "/usr/bin/X11/xdpyinfo" "X11"
		    [ -x /usr/bin/X11/fsinfo ] && [ -n "$FONTSERVER" ] && exec_command "/usr/bin/X11/fsinfo" "Font-Server"
	  fi
	fi
	dec_heading_level

fi # terminates CFG_ENHANCEMENTS wrapper
###########################################################################

if [ "$CFG_APPLICATIONS" != "no" ]
then # else skip to next paragraph

	paragraph "Applications and Subsystems"

### COMMON ################################################################

	inc_heading_level

	if [ -d /usr/local/bin ] ; then
	  exec_command "ls -lisa /usr/local/bin" "Files in /usr/local/bin"
	fi
	if [ -d /usr/local/sbin ] ; then
	  exec_command "ls -lisa /usr/local/sbin" "Files in /usr/local/sbin"
	fi
	if [ -d /opt ] ; then
	  exec_command "ls -lisa /opt" "Files in /opt"
	fi

############ Samba and Swat ########################

	if [ -f /etc/inetd.conf ] ; then
	  SWAT=`grep swat /etc/services /etc/inetd.conf`
	fi
	if [ -f /etc/xinetd.conf ] ; then
	  SWAT=`grep swat /etc/services /etc/xinetd.conf`
	fi

	[ -n "$SWAT" ] && exec_command  "echo $SWAT" "Samba: SWAT-Port"

	[ -x /usr/sbin/smbstatus ] && exec_command "/usr/sbin/smbstatus 2>/dev/null" "Samba (smbstatus)"
	### Debian...., maybe a smbstatus -V/samba -V is usefull
	[ -x /usr/bin/smbstatus ] && exec_command "/usr/bin/smbstatus 2>/dev/null" "Samba (smbstatus)"	## fixed 2007-02-27 Oliver Schwabedissen
	[ -x /usr/bin/testparm ] && exec_command "/usr/bin/testparm -s 2> /dev/null" "Samba Configuration (testparm)" #  09.01.2008, 14:53 modified by Ralph Roth
	[ -f /etc/samba/smb.conf ] && exec_command "cat /etc/samba/smb.conf" "Samba Configuration (smb.conf)" #*#  Alexander De Bernardi, 20100421 testparm does not show complete config
	[ -f /etc/init.d/samba ] && exec_command "ps -ef | grep -E '(s|n)m[b]'" "Samba Daemons"

	if [ -x /usr/sbin/lpc ] ; then
	  exec_command "/usr/sbin/lpc status" "BSD Printer Spooler and Printers"	#*# Alexander De Bernardi, 20100310
	fi
	 if [ -x /usr/bin/lpstat ] ; then
	 exec_command "/usr/bin/lpstat -t" "SYSV Printer Spooler and Printers"		#*# Alexander De Bernardi, 20100310
	 fi
	 if [ -x /usr/bin/hp-info ] ; then
	 exec_command "/usr/bin/hp-info -i | \
	 	/usr/bin/col" "HPLIP Printer Info"	#*# Alexander De Bernardi, 20100310
	 fi

	[ -f /etc/printcap ] && exec_command "grep -vE '^#|^ *$' /etc/printcap" "Printcap"
	[ -f /etc/hosts.lpd ] && exec_command "grep -vE '^#|^ *$' /etc/hosts.lpd" "hosts.lpd"

##
## we want to display HP OpenVantage Operations configurations
## 31Jan2003 it233 FRU U.Frey

	if [ -e /opt/OV/bin/OpC/utils/opcdcode ] ; then
	  if [ -e /opt/OV/bin/OpC/install/opcinfo ] ; then
	    exec_command "cat /opt/OV/bin/OpC/install/opcinfo" "HP OpenView Info, Version"
	  fi
	  if [ -e /var/opt/OV/conf/OpC/monitor ] ; then
	    exec_command "/opt/OV/bin/OpC/utils/opcdcode /var/opt/OV/conf/OpC/monitor | grep DESCRIPTION" "HP OpenView Configuration MONITOR"
	  fi

	  if [ -e /var/opt/OV/conf/OpC/le ] ; then
	    exec_command "/opt/OV/bin/OpC/utils/opcdcode /var/opt/OV/conf/OpC/le | grep DESCRIPTION" "HP OpenView Configuration LOGGING"
	  fi
	fi

## we want to display Veritas netbackup configurations
## 31Jan2003 it233 FRU U.Frey
## 3/5/08 Modified/added functionality by krtmrrsn@yahoo.com, Marc Korte.
##	Some things have changed in NetBU 6.x.
##	Made a seperate section for Veritas Netbackup
	if [ -e /usr/openv/netbackup/bp.conf ] ; then

	  paragraph "Veritas Netbackup Configuration"
	  inc_heading_level

		  NetBuVersion=$(find /usr/openv/netbackup -name "version")
		  if [ -e ${NetBuVersion} ] ; then
		    exec_command "cat ${NetBuVersion}" "Veritas Netbackup Version"
		  fi
		  exec_command "cat /usr/openv/netbackup/bp.conf" "Veritas Netbackup Configuration"
		  exec_command "netstat -tap | egrep '(bpcd|bpjava-msvc|bpjava-susvc|vnetd|vopied)|(Active|Proto)'" "Veritas Netbackup Network Connections"
		    ## Use FS="=" in case there's no whitespace in the SERVER lines.
		  exec_command "for NetBuServer in $(awk 'BEGIN {FS="="} /SERVER/ {printf $NF}' /usr/openv/netbackup/bp.conf); do ping -c 3 \${NetBuServer} && echo \"\"; done" "Veritas Netbackup Servers Ping Check"
		  if ping -c 3 $(awk 'BEGIN {FS="="} /SERVER/ {print $NF}' /usr/openv/netbackup/bp.conf | head -1) >/dev/null
		  then
		    exec_command "/usr/openv/netbackup/bin/bpclntcmd -pn" "Veritas Netbackup Client to Server Inquiry"
		  fi
	  dec_heading_level
	fi

###########################################################################
# { changed/added 28.01.2004 (17:56) by Ralph Roth }
	if [ -r /etc/cmcluster.conf ] ; then
	    dec_heading_level
	    paragraph "Serviceguard"
	    inc_heading_level
	    . ${SGCONFFILE:=/etc/cmcluster.conf}   # get env. setting, rar 12.05.2005
	    PATH=$PATH:$SGSBIN:$SGLBIN
	    exec_command "cat ${SGCONFFILE:=/etc/cmcluster.conf}" "Cluster Config Files"
	    exec_command "what  $SGSBIN/cmcld|head; what  $SGSBIN/cmhaltpkg|head" "Real Serviceguard Version"  ##  12.05.2005, 10:07 modified by Ralph.Roth at hp.com  (HPS-TSG-MCPS)
	    exec_command "cmquerycl -v" "Serviceguard Configuration"
	    exec_command "cmviewcl -v" "Serviceguard Nodes and Packages"
	    exec_command "cmviewconf" "Serviceguard Cluster Configuration Information"
	    exec_command "cmscancl -s" "Serviceguard Scancl Detailed Node Configuration"
	    exec_command "netstat -in" "Serviceguard Network Subnets"
	    exec_command "netstat -a |fgrep hacl" "Serviceguard Sockets"
	    exec_command "ls -l $SGCONF" "Files in $SGCONF"
	fi

dec_heading_level

fi 	#"$CFG_APPLICATIONS"# <m>  23.04.2008, 2145 -  Ralph Roth

##########################################################################
##
## Display Oracle configuration if applicable
## Begin Oracle Config Display
## 31jan2003 it233 FRU U.Frey

if [ -e /etc/oratab ] ; then

  paragraph "Oracle Configuration"
  inc_heading_level

  exec_command "grep -vE '^#|^$|N' /etc/oratab " "Configured Oracle Databases"

  ##
  ## Display each Oracle initSID.ora File
  for  DB in `grep ':' /etc/oratab|grep -v '^#'|grep -v 'N'`
       do
         Ora_Home=`echo $DB | awk -F: '{print $2}'`
         Sid=`echo $DB | awk -F: '{print $1}'`
         Init=${Ora_Home}/dbs/init${Sid}.ora
         exec_command "cat $Init" "Oracle Instance $Sid"
       done
  dec_heading_level
fi


###
##############################################################################
###   HP Proliant Server LINUX Logfiles from HP tools and or the HP PSP.   ###
###   Made by Jeroen.Kleen@hp.com EMEA ISS Competence Center Engineer      ###

if [ "$CFG_HPPROLIANTSERVER" != "no" ]
then # else skip to next paragraph

	paragraph "hp Proliant Server Log- and configuration Files"
	inc_heading_level

	/opt/hp/hpdiags/hpdiags -v 5 -o /tmp/hpdiags.xml -f

# Request:              Dienstag, 12. Januar 2010 -- Koerber, Martin
# ========
# Starting with "8.28-13.0 (6 May 2009)" of cpqacuxe the capture functionality is no longer supported.
# http://h20000.www2.hp.com/bizsupport/TechSupport/SoftwareDescription.jsp?lang=en&cc=us&prodTypeId=15351&prodSeriesId=1121486&swItem=MTX-a72c1471380f45f4a5cb2f4ec9&prodNameId=3288144&swEnvOID=4049&swLang=8&taskId=135&mode=5
#
# Version: 8.28-13.0  (6 May 2009)
# Scripting for captures and inputs is no longer supported in ACU HPACUCLI is now responsible for Scripting

	cpqacuxe -c /var/log/cpqacuxe.cfg
	hpaducli -f ADUreport.txt -r

	if [ -e /usr/lib/hponcfg ]
	then
		/usr/lib/hponcfg -w ilo.cfg
	fi

	if [ -e /usr/sbin/dmidecode ]
	then
		exec_command "dmidecode|grep Product -2" "HP Proliant Server Information taken from dmidecode"
	fi
	exec_command "survey -v 5 -t" "Classic Survey output -v 5"
	exec_command "hplog -t -f -p" "Current Thermal Sensor, Fan & Power data"
	exec_command "hplog -v" "Proliant Integrated Management Log"
	exec_command "cat /var/log/hppldu.log" "Installation Log PSP 7.*"
	exec_command "cat /opt/compaq/cma.conf" "/opt/compaq/cma.conf file"
	exec_command "cat /opt/compaq/snmpd.conf.orig" "/opt/compaq/snmpd.conf.orig file "
	exec_command "cat /tmp/hppldu.cfg" "PSP 7.* Installation Settings file"
	exec_command "cat /var/hp/install_history.txt" "/var/hp/install_history.txt file"
	exec_command "cat /var/log/hplog.txt" "/var/log/hplog.txt file"
	exec_command "cat /var/opt/hp/nicfwupg.log" "/var/opt/hp/nicfwupg.log file"
	exec_command "cat /var/spool/compaq/cma.log" "/var/spool/compaq/cma.log Agents logfile"
	exec_command "cat /var/cpq/Component.log" "Individual Components Installation Log file (ROMBIOS/SA FW/iLO)"
	exec_command "cat /etc/snmp/snmpd.conf" "/etc/snmp/snmpd.conf file"
	exec_command "/etc/init.d/hpasm status" "hpasm status of how what modules are loaded and running correctly."
	exec_command "cat /opt/compaq/cpqhealth/cpqhealth_boot.log" "LOGfile from when hpasm failed installation"
	exec_command "cat /opt/compaq/hprsm/hprsm_boot.log" "LOGfile during boot from hprsm"
	exec_command "/opt/compaq/nic/bin/hpetfe -A" "/opt/compaq/utils/nic/bin/hpetfe -A HP NIC information"
	hpasmcli -s "show asr; show boot; show dimm; show f1; show fans; show ht; show ipl; show name; show powersupply; show pxe; show serial bios; show serial embedded; show serial virtual; show server; show temp; show uid; show wol" >hpasmcliOutput.txt
	exec_command "cat hpasmcliOutput.txt" "HP ASM CLI command line output"
	exec_command "cat /etc/opt/hp/hp-vt/hp-vt.conf" "Intelligent Networking Pack Virus Throttling conf file"
	exec_command "/etc/init.d/hp-vt status" "Intelligent Networking Pack Virus Throttling Status"
	exec_command "cat /var/opt/hp/hp-vt/hp-vt.log" "Intelligent Networking Pack Logfile"
	exec_command "/opt/hp/hp-pel/nalicense -d" "Proliant Essentials Licenses installed overview"
	exec_command "cat /var/opt/hp/hp-pel/hp-pel.log" "Proliant Essentials Licenses Logfile"
	exec_command "ls ilo.cfg" "iLO/RILOE Configuration XML file is in TARball"
	exec_command "cat /root/install.log.syslog" "Installation SYS logfile"
	exec_command "cat /root/install.rdp.log" "Rapid Deployment Pack RDPinstall logfile"
	exec_command "cat /root/anaconda-ks.cfg" "anaconda kickstart file used during OS deployment"
	exec_command "cat /var/log/messages" "messages logging file (older messages logfiles in TARBALL)"
	exec_command "cat /var/log/boot.log" "boot.log logfile (older boot.log logfiles in TARBALL)"
	exec_command "cat /var/log/dmesg" "dmesg logfile /var/log/dmesg"

	exec_command "cat /tmp/ADUreport.txt" "Array Diagnostic Utility report is included in the TAR ball as a single file"
	exec_command "cat /var/log/cpqacuxe.cfg" "cpqacuxe configuration file (SmartArray configuration)"


	###below partitioning and HPACUCLI is contributed by kgalal@gmail.com

	if [ -x /usr/sbin/hpacucli ] ; then
		exec_command "/usr/sbin/hpacucli controller all show" "HP SmartArray controllers Detected"	 # added by jeroenkleen HP
		exec_command "/usr/sbin/hpacucli controller all show status" "HP SmartArray controllers Detected with Status"
		slotnum=`/usr/sbin/hpacucli controller all show | awk '{if($0!="")print $6}'`  # jkleen: this doesn't work (yet) for MSA1x000 controllers
		exec_command "/usr/sbin/hpacucli controller slot=$slotnum physicaldrive all show" "Physical Drives on SmartArray Controller"
		exec_command "/usr/sbin/hpacucli controller slot=$slotnum logicaldrive all show" "Logical Drives on SmartArray controller"
	fi

	disks=`/sbin/fdisk -l`
	if [ ! -z "$disks" ] ; then
		exec_command "/sbin/fdisk -l" "Disk Partitions on Logical Drives"
	else
		disks=`cat /proc/partitions | awk '{if($4 ~ /\//)print $4}' |grep -v p`
		for adisk in $disks ; do
			exec_command "/sbin/fdisk -l /dev/$adisk" "Disk Partitions - /dev/$adisk"
		done
	fi
	exec_command "/sbin/fdisk -l" "Disk Partitions"

	###above partitioning and HPACUCLI is contributed by kgalal@gmail.com

	exec_command "ls /tmp/hpdiags.xml" "HP Insight Diagnostics Detailed (5) Report is in TARball"
	hplog -s INFO -l "CFG2HTML Proliant Server report successfully created"

	dec_heading_level

fi  # end of CFG_HPPROLIANTSERVER paragraph
###  END of HP Proliant Server Integration
###############################################################################
###



###
##############################################################################
###   Altiris ADL agent settings and logfiles
###   Made by Jeroen.Kleen@hp.com EMEA ISS Competence Center Engineer      ###

if [ "$CFG_ALTIRISAGENTFILES" != "no" ]
then # else skip to next paragraph

# checking if Altiris directory exist otherwise skip this section
if [ -e /opt/altiris/deployment/adlagent ] ; then

  paragraph "Altiris ADL Agent logfiles and settings"
  inc_heading_level

  exec_command "cat /opt/altiris/deployment/adlagent/conf/adlagent.conf" "Altiris ADLagent settings file"
  exec_command "cat /opt/altiris/deployment/adlagent/log/adlagentdbg.txt" "Altris ADLagent Debugging file"
  exec_command "cat /opt/altiris/deployment/adlagent/log/adlagentIpTrace.txt" "Altiris ADLagent IP tracing file"

  dec_heading_level
fi

fi  # end of CFG_ALTIRISAGENTFILES paragraph
###  END of Altiris ADL agent settings and logfiles
##############################################################################


###
##############################################################################
###   VMWARE settings and logfiles
###   Made by Jeroen.Kleen@hp.com EMEA ISS Competence Center Engineer      ###

if [ "$CFG_VMWARE" != "no" ]
then # else skip to next paragraph

# checking if VMWare directory exist otherwise skip this section
if [ -e /proc/vmware ] ; then

  paragraph "VMWare logfiles and settings"
  inc_heading_level

exec_command "vmware -v" "VMWare Server version"

echo "VMWare server detected. We will start now the vm-support script in case you"
echo "need this vmware debugging file send to VMWare support or other support teams."
vm-support
exec_command "cat esx-$(date -I).$$.tgz" "vm-support ticket generated in local directory if vm-support is installed."


dec_heading_level
fi
fi  # end of CFG_VMWARE paragraph
##############################################################################

#
# execute custom plugins   -- anaumann 2009/07/10
#

if [ "$CFG_PLUGINS" != "no" ];
then # else skip to next paragraph
    if [ -f /etc/cfg2html/plugins ]; then
	paragraph "Custom plugins"

        # include plugin configuration
	. /etc/cfg2html/plugins


	if [ -n "$CFG2HTML_PLUGIN_DIR" -a -n "$CFG2HTML_PLUGINS" ]; then
            # only run plugins when we know where to find them and at least one of them is enabled

	    inc_heading_level

	    if [ "$CFG2HTML_PLUGINS" == "all" ]; then
		# include all plugins
		CFG2HTML_PLUGINS="$(ls -1 $CFG2HTML_PLUGIN_DIR)"
	    fi

	    for CFG2HTML_PLUGIN in $CFG2HTML_PLUGINS; do
		if [ -f "$CFG2HTML_PLUGIN_DIR/$CFG2HTML_PLUGIN" ]; then
		    . $CFG2HTML_PLUGIN_DIR/$CFG2HTML_PLUGIN
		    exec_command cfg2html_plugin "$CFG2HTML_PLUGINTITLE"
		else
		    AddText "Configured plugin $CFG2HTML_PLUGIN not found in $CFG2HTML_PLUGIN_DIR"
		fi
	    done
	    dec_heading_level
	fi
    fi
fi

## end of plugin processing


#
# collect local files
#
if [ -f /etc/cfg2html/files ] ; then
  paragraph "Local files"
  inc_heading_level
  . /etc/cfg2html/files
  for i in $FILES
  do
    if [ -f $i ] ; then
      exec_command "grep -vE '(^#|^ *$)' $i" "File: $i"
    fi
  done
  AddText "You can customize this entry by editing /etc/cfg2html/files"
  dec_heading_level
fi

dec_heading_level

close_html
###########################################################################
###########################################################################
######     Creating TAR File for all needed files together. Added by Jeroen Kleen HP EMEA ISS CC

# Logs
# I saw in cfg2html 1.42:
# # include in future TARball: /var/log/messages.* /var/log/boot.log.*
# yes, good idea to include it, in compressed format.
#
# email address
# I saw in cfg2html 1.42:
# echo "     {YourCaseID}@cases.brussels.hp.com
# is brussels still working ?  maybe it should be modified to @cases.europe.hp.com ?

if [ "$CFG_HPPROLIANTSERVER" != "no" ]
then # else skip to next paragraph

 if [ -f $OUTDIR/$BASEFILE.tar ] ; then
        rm $OUTDIR/$BASEFILE.tar
 fi
echo " "
echo " The following files are included in your tarball: "

# include in future TARball: /var/log/messages.* /var/log/boot.log.*
 tar cvf $OUTDIR/$BASEFILE.tar $OUTDIR/$BASEFILE.err $OUTDIR/$BASEFILE.html $OUTDIR/cfg2html_back.jpg $OUTDIR/profbull.gif $OUTDIR/$BASEFILE.partitions.save $OUTDIR/$BASEFILE.txt ADUreport.txt /var/spool/compaq/vcagent/log/vcagentd.log /var/spool/compaq/vcagent/log/vcasetup.log /tmp/hpdiags.xml ilo.cfg

 echo "  "
 echo " If you created this CFG2HTML report on request of a HP support Agent "
 echo " then please send the $OUTDIR/$BASEFILE.tar file"
# echo "     {YourCaseID}@cases.brussels.hp.com     "
# echo "  "
 echo " Feedback please to: Jeroen.Kleen@hp.com     Thanks! "
fi  # end of CFG_HPPROLIANTSERVER (making tarball)
###########################################################################


logger "End of $VERSION"
echo -e "\n"
line

logger "End of $VERSION"
rm -f core > /dev/null

########## remove the error.log if it has size zero #######################
[ ! -s "$ERROR_LOG" ] && rm -f $ERROR_LOG 2> /dev/null

#if [ "$1" != "-x" ]
if [ "$GIF" = "no" ]
then
  exit 0
fi
echo "Creating:    JPG/GIFs"

cd $OUTDIR

# This is a shell archive.  Remove anything before this line,
# then unpack it by saving it in a file and typing "sh file".
#
# Wrapped by Guru Ralph <root@ulmx002> on Wed Sep 13 16:03:07 2000
#
# This archive contains:
#	cfg2html_back.jpg	profbull.gif
#
# Error checking via sum(1) will be performed.

LANG=""; export LANG
PATH=/bin:/usr/bin:/usr/sbin:/usr/ccs/bin:$PATH; export PATH

if sum -r </dev/null >/dev/null 2>&1
then
	sumopt='-r'
else
	sumopt=''
fi


rm -f /tmp/uud$$
(echo -e "begin 666 /tmp/uud$$\n#;VL*n#6%@x\n \nend" | uudecode) >/dev/null 2>&1
if [ X"`cat /tmp/uud$$ 2>&1`" = Xok ]
then
	unpacker () { uudecode; }
elif [ -x "/usr/bin/perl" ]
then
	unpacker () {
                      perl -ne 'if (/^begin \d\d\d (.*$)/) { open( TT, "> $1") }
                                  elsif (/^end/) { close (TT) }
                                    else { print TT unpack u, $_  }' $1;
                    }
else
	echo Compiling unpacker for non-ascii files
	pwd=`pwd`; cd /tmp
	cat >unpack$$.c <<'EOF'
#include <stdio.h>
#define C (*p++ - ' ' & 077)
main()
{
	int n;
	char buf[128], *p, a,b;

	scanf("begin %o ", &n);
	gets(buf);

	if (freopen(buf, "w", stdout) == NULL) {
		perror(buf);
		exit(1);
	}

	while (gets(p=buf) && (n=C)) {
		while (n>0) {
			a = C;
			if (n-- > 0) putchar(a << 2 | (b=C) >> 4);
			if (n-- > 0) putchar(b << 4 | (a=C) >> 2);
			if (n-- > 0) putchar(a << 6 | C);
		}
	}
	exit(0);
}
EOF
	cc -o unpack$$ unpack$$.c
	rm unpack$$.c
	cd $pwd
	unpacker () { /tmp/unpack$$ $1; }
fi
rm -f /tmp/uud$$

echo x - cfg2html_back.jpg '[non-ascii]'
unpacker <<'@eof'
begin 777 cfg2html_back.jpg
M_]C_X  02D9)1@ ! 0$ 2P!+  #_XP,.35-/(%!A;&5T=&4@;[[4?\?:B<O=X
MC\_?DM'@EM3BFM3CG=?DGMKEH=OFI-SGI]WGJ-_HK-_IK.'JK^+JLN/KM.3LX
MM>;MN>?NN^CNO>COO>GOONOOP>OPP>SQP^WQQ.[RR._SRO'TT?/WZ?O]:;K1X
M;;W3<;_4<L'5=<'6=\+6>,37><+7>\78?<79?\C:@,;:@LC;@\G;A,O;ALG<X
MALO<B,O<B,W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S$G2-1@">IJ:W7O%T*P&!"L,?J*+7["*$=FD&<@DCW&]5UVPBL-.D[%9,T1X
MF O+8_#DE;4R4@9^]%>'JY6X;LLXT@D:9W'M[5R\4BW1;#,I8 @E<&=MZ7X*X
MCMUNT;6(PW3O7,Q2T6TA6G3,2!)W_BEOO<55<@,=7J!)SVGQ/3:I<*SC\NX2X
MRG8GH:5V7T9;CF\1EK). X$^_P!:%\<T,FDGU1)V ';R3U[8K22 I 59&X!SX
M_%'5I(@?%UTS%+6D;/Y-D*_1H4;U=[RVAZ@B8F22V.\5)#<+C4L6]C.\^](;X
35VYK4[,TM R8V'L.U3Z1-</_V4;U                                X
                                                             X
end
@eof
set `sum $sumopt <cfg2html_back.jpg`; if test $1 -ne 6004
then
	echo ERROR: cfg2html_back.jpg checksum is $1 should be 6004
fi

chmod 644 cfg2html_back.jpg

echo x - profbull.gif '[non-ascii]'
unpacker <<'@eof'
begin 777 profbull.gif
M1TE&.#EA#0 - /9! /__ '.#@X.4E)2DI'N+BV)S>XN<G,7-S7N+6F)S<WN+X
ME%IJ<UIS<YRLK,7-*:R]O:RTO6I[@____]7>6IRDK'.#B[2]B[2]O?;V]JRTX
M,:2LK)2<I*RTM+W%E.[V(.[N[FI[>ZR]@X.+@[W-2K3%Q:RT.8N<4I2DE+2]X
M.7.+BVI[<^;F&)RDI(.4G+2]M(N4G&)[>][FYJ2L>Z2L2G.#8O;V*6I[:H.+X
ME%)J:J2TM*2LM'.#>[W%8M[>6KW%M-[F$,W5<P                      X
M                                                            X
M                                                            X
M                                                            X
M                                                 "'Y! D& $$ X
M+      -  T   >(@$&"01,6(3(C@X,3+@\Z% 8"(HH])!</$ T#-P0P@SX'X
M,1@'FBT$ 2I!0!<'$A('D (* 0DE'0\'&!\0 Y$!!0D('3D<'!J] J<,"P@6X
M&@TL [T*!!$X"R8\!@,;&[(5 2 +"X(G+P+)*;\)"32",Q74 ;\,# 6**#L1X
/P 4,-HJ#,B 8F$%1(  [                                        X
                                                             X
end
@eof
set `sum $sumopt <profbull.gif`; if test $1 -ne 10255
then
	echo ERROR: profbull.gif checksum is $1 should be 10255
fi

chmod 644 profbull.gif

rm -f /tmp/unpack$$
exit 0
line

####################################################################
