#!/bin/sh

# Shell script to summarize snapshots for SCC.
# Copyright (C) 2001-2004 Open Challenge B.V.
# Copyright (C) 2004-2005 OpenEyeT Professional Services.
# Copyright (C) 2005-2009 QNH.
#
# This program is free software; you can redistribute it and/or modify
# it under the terms of the GNU General Public License as published by
# the Free Software Foundation; either version 2, 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.
#
# You should have received a copy of the GNU General Public License
# along with this program; see the file COPYING.
# If not, write to the Free Software Foundation,
# 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA.
#
# Contact information: http://scc.qnh-infrastructure.nl

# SCC-release:	1.7.5
# file-version:	$Revision: 1.108 $


ProgName=${0##*/};			export ProgName

set -u

SCC_BIN=/opt/scc-srv/bin
SCC_TOP=/var/opt/scc-srv
export SCC_BIN SCC_TOP

export SCC_DATA=${SCC_TOP}/data
export SCC_TMP=${SCC_TOP}/tmp
export SCC_CONF=${SCC_TOP}/conf
export SCC_WWW=${SCC_DATA}/www

export TMPDIR=${SCC_TMP}
export TMP=${SCC_TMP}

export SHELL=/bin/sh
export LANG=C

PATH=/sbin:/usr/sbin:/usr/bin:/bin:${SCC_BIN};		export PATH

# Use the following utilities for SunOS.
if [ -x /usr/ccs/bin/what ]
then
	alias what=/usr/ccs/bin/what
fi
if [ -x /usr/xpg4/bin/awk ]
then
	alias awk=/usr/xpg4/bin/awk
fi
if [ -x /usr/xpg4/bin/grep ]
then
	alias grep=/usr/xpg4/bin/grep
fi

SYNTAX="Syntax error, use: ${ProgName} [ -d <scc_web_path> ] [ -f ] <dir>"

export TMP_FILE_1=${SCC_TMP}/scc_summary_1_$$
export TMP_FILE_2=${SCC_TMP}/scc_summary_2_$$

trap "rm -f ${TMP_FILE_1} ${TMP_FILE_2}" 0
trap "exit 2" 1 2 3 15

scc_web_path_dir=""
force=0;
while [ $# -gt 1 ]
do
	if [ $# -eq 1 ]
	then
		# All options, except the ones in the following list, should have an argument.
		if [ "x${1}" != "x-f" ]
		then
			echo "${ProgName}: Syntax error, missing argument for option: $1" 
			exit 2
		fi
	fi

	case "${1}" in
	-d)	if [ "${2}" != "/" ]
		then
			scc_web_path_dir="$2"
		fi
		shift 2;;

	-f)	force=1;
		shift 1;;

	*)	echo "${SYNTAX}" >&2
		exit 1;;
	esac
done

if [ $# -ne 1 ]
then
	echo "${SYNTAX}" >&2
	exit 1
fi

if [ ! -d "${SCC_WWW}/${1}" ]
then
	echo "${ProgName}: directory ${SCC_WWW}/${1} does not exist" >&2
	exit 1
fi

if [ -z "${scc_web_path_dir}" ]
then
	scc_web_path_dir="$(sed -n 's/^SCC_WEB_PATH=//p' ${SCC_CONF}/scc.conf 2>/dev/null)"
fi

realm="${1}"
web_realm_dir="${scc_web_path_dir}/${realm}"
HOME_URL="<A HREF=\"${web_realm_dir}/index.html\">Home</A>&nbsp;&nbsp;&nbsp;&nbsp;"

now=$(date '+%Y-%m-%d %H:%M:%S')

cd "${SCC_WWW}/${realm}"

# Use the owner/group/permissions of the destination directory for the files we put there.
# We are only interested in the read-permissions of the directory.
set dummy $(ls -ld .)
case "${2}" in
?r??r??r??)	new_mode=0444; umask 333;;
?r??r??-??)	new_mode=0440; umask 337;;
?r??-??-??)	new_mode=0400; umask 377;;
?r??-??r??)	new_mode=0404; umask 373;;
*)		new_mode=0400; umask 077;;
esac
new_owner_group="${4}:${5}"


bg_color=""
if [ -f ./custom/scc-realm.conf ]
then
	color="$(sed -n 's/^BG_COLOR=//p' ./custom/scc-realm.conf)"
	if [ "${color}" ]
	then
		bg_color=" bgcolor=\"${color}\""
	fi
fi

logo_tag="<IMG SRC=\"${web_realm_dir}/custom/scc-logo.png\" ALT=HelpInfo BORDER=0>"

# Ignore snapshots in sub-directories (with more than one '/' in the name).
# The following file records errors from head, use the contents to detect broken symbolic links.
rm -f ${TMP_FILE_1} ${TMP_FILE_2}
find . -name "scc.*.cur" 2>/dev/null			|
sed -e '/\/.*\//d'					|
xargs head -n 30 /dev/null 2>>${TMP_FILE_1}		|
sed -e '/\/dev\/null/d'					|
awk -F: '/^==> .* <==$/			{
						if ( length( host ) > 0 )
						{
							printf( "general_data:%s:%s:%s:%s:%s:%s:%s\n",\
								host, model, os, release, last_d, last_t, domain );
							model = "";
							doamin = "";
							os = "";
							release = "";
							last_d = "";
							last_t = "";
						}

						host=$0;
						sub( /.*[ 	]\.\/scc\./, "", host );
						sub( /\.cur.*/, "", host );
						next;
					}
	/^var:general::date:/		{ last_d = $5; next }
	/^var:general::time:start:/	{ last_t = $6; next; }
	/^var:general::start time:/	{ last_t = $5; next; }
	/^fix:general::model:/		{ model = $5; next }
	/^fix:general::domain:/		{ domain = $5; next }
	/^fix:general::OS-name:/	{ os = $5; next }
	/^fix:general::OS-release:/	{ release = $5; next }
END	{
		if ( length( host ) )
		{
			printf( "general_data:%s:%s:%s:%s:%s:%s:%s\n",\
				host, model, os, release, last_d, last_t, domain );
		}
}'					|
sort -f >${TMP_FILE_2}
mv -f ${TMP_FILE_2} scc-summary.data
chown "${new_owner_group}" scc-summary.data
system_cnt=$(wc -l <scc-summary.data)

# The format of the contents of this file is:
# head: <filename>: No such file or directory.
# or
# <filename>: No such file or directory.
sed	-e 's/^head: //'	\
	-e 's/:.*//' ${TMP_FILE_1}		|
while read snapshot
do
	# Check for broken links.
	sys=${snapshot%%.cur}
	sys=${sys#*scc.}
	if [ -h ${snapshot} -a ! -f ${snapshot} ]
	then
		for suffix in cur log html log.html smt.html
		do
			rm -f scc.${sys}.${suffix}
		done
	fi
done

# Ignore log files in sub-directories (with more than one '/' in the name).
# Find all the reported counts of differences.
rm -f ${TMP_FILE_1} ${TMP_FILE_2}
find . -name "scc.*.log"				|
sed -e '/\/.*\//d'					|
xargs grep "^[^:]*:[^:]*:count::" /dev/null		|
sed	-e 's@^\./scc\.@@'	\
	-e 's/\.log:/ /'	\
	-e 's/:/ /'		\
	-e 's/:.*:/ /'		\
	-e 's/  */:/g'					|
sort -t: -k 2,2r -k 1,1f -k 3,3r >${TMP_FILE_1}

# Remove all the html-files pointing to the changes per day.
# We wille generate them again. From this point of time, the files
# are not accessible by the web server until we chown them.
find . -name "scc-log-[0-9][0-9][0-9][0-9]-[0-9][0-9]-[0-9][0-9].html"	|
sed -e '/\/.*\//d'							|
xargs rm -f

# Initialize the main log file.
rm -f scc-log-index.html
cat >scc-log-index.html <<-EndOfTxt
	<!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.01 Transitional//EN">
	<HTML>
	<HEAD>
		<LINK HREF="${web_realm_dir}/custom/style.css" REL="stylesheet" TYPE="text/css">
		<TITLE>Configuration changes for ${realm}</TITLE>
	</HEAD>
	<BODY${bg_color}>
	<CENTER>
	<A HREF="${scc_web_path_dir}/scc-help/scc-log-index.html">${logo_tag}</A>

	<H4>
		<A HREF="${web_realm_dir}/index.html">Home</A>&nbsp;&nbsp;&nbsp;&nbsp;
		Configuration changes for ${realm}, last update on: ${now}
	</H4>

	<TABLE CLASS=SCC BORDER SUMMARY="Summary of dates with changes" CELLSPACING=1 CELLPADDING=4>
	<THEAD>
		<TR class=Odd align=left>
			<TH>Date</TH>
			<TH>System count</TH>
		</TR>
	</THEAD>
	<TBODY>
EndOfTxt
chown "${new_owner_group}" scc-log-index.html

# Initialize the main-summary file
# Be sure to pick the same names as below when these html-files are generated.
rm -f scc-summary-init.html
cat >scc-summary-init.html <<-EndOfTxt
	<!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.01 Transitional//EN">
	<HTML>
	<HEAD>
		<LINK HREF="${web_realm_dir}/custom/style.css" REL="stylesheet" TYPE="text/css">
		<TITLE>Summary of SCC-data for ${realm}</TITLE>
	</HEAD>
	<BODY${bg_color}>

	<CENTER>
	<A HREF="${scc_web_path_dir}/scc-help/scc-summary-index.html">${logo_tag}</A>

	<H4>
		<A HREF="${web_realm_dir}/index.html">Home</A>&nbsp;&nbsp;&nbsp;&nbsp;
		Summary of SCC-data for ${realm} (${system_cnt} systems), last update on: ${now}
	</H4>

	<TABLE CLASS=SCC BORDER SUMMARY="Summary of systems" CELLSPACING=1 CELLPADDING=4>
	<THEAD>
		<TR class=Odd align=left>
			<TH><A HREF="${web_realm_dir}/scc-summary-sys.html">System</A></TH>
			<TH><A HREF="${web_realm_dir}/scc-summary-model.html">Model</A></TH>
			<TH><A HREF="${web_realm_dir}/scc-summary-os.html">OS</A></TH>
			<TH><A HREF="${web_realm_dir}/scc-summary-run.html">Last run</A></TH>
			<TH><A HREF="${web_realm_dir}/scc-summary-change.html">Last change</A></TH>
		</TR>
	</THEAD>
	<TBODY>
EndOfTxt

awk -F: 'BEGIN	{
			c[ 0 ] = "Even";
			c[ 1 ] = "Odd";
			tr_m = 1;		# TR class for main file
			tr_d = 1;		# TR class for detail files
		}
	/general_data/	{
		# Get some general system data to add to the logs per day.
		# Format of the input is: "general_data":<host>:<model>:<os>:<release>:<last_day>:<last_time>:<domain>
		if ( NF == 7 )
		{
			model[ $2 ] = $3;
			os[ $2 ] = $4;
			rel[ $2 ] = $5;
		}
		next;
	}
{
	# Format of the input is: <system> <day> <time> <line-count>
	# The data is sorted on day and system.
	# Stdout is written to the main log file.
	if ( $2 != curr_day )
	{
		if ( length( curr_log ) > 0 )
		{
			# Write the data to the main log file.
			printf( "<TR class=%s><TD%s><A HREF=\"%s/%s/scc-log-%s.html\">%s</A></TD><TD %s align=right>%s</TD></TR>\n",\
				c[ tr_m++ % 2 ], " class=Even", d, r, curr_day, curr_day, " class=Odd", cnt_per_day );

			close( curr_log );
		}
		curr_day = $2;
		curr_log = sprintf( "scc-log-%s.html", $2 );
		cnt_per_day = 0;
		visited[ curr_log ] = 1;

		tr_d = 1;

		# Initialize the log file for this day
		print "<!DOCTYPE HTML PUBLIC \"-//W3C//DTD HTML 4.01 Transitional//EN\">"	>curr_log;
		print "<HTML>"									>>curr_log;

		print "<HEAD>"									>>curr_log;
		printf( "<LINK HREF=\"%s/%s/custom/style.css\" REL=\"stylesheet\" TYPE=\"text/css\">\n",\
			d, r )									>>curr_log;
		print "<TITLE>Configuration changes for", r, "on", $2, "</TITLE>"		>>curr_log;
		print "</HEAD>"									>>curr_log;

		printf( "<BODY%s>\n", b )							>>curr_log;
		print "<CENTER>"								>>curr_log;
		printf( "<A HREF=\"%s/scc-help/scc-log-index.html\">%s</A>\n", d,l )		>>curr_log;
		print "<H4>"									>>curr_log;
		printf( " <A HREF=\"%s/%s/index.html\">Home</A>&nbsp;&nbsp;&nbsp;&nbsp;\n",d,r) >>curr_log;
		print "	Configuration changes for", r, "on", $2					>>curr_log;
		print "</H4>"									>>curr_log;

		printf( "<TABLE CLASS=SCC BORDER SUMMARY=\"Summary of changes on %s\" CELLSPACING=1 CELLPADDING=4>\n", $2) >>curr_log;

		print "<THEAD>"									>>curr_log;
		printf( "	<TR class=%s align=left>\n", c[ tr_d++ %2 ] )			>>curr_log;
		print "		<TH>System</TH>"						>>curr_log;
		print "		<TH>Model</TH>"							>>curr_log;
		print "		<TH>OS</TH>"							>>curr_log;
		print "		<TH>Detection</TH>"						>>curr_log;
		print "		<TH>Line count</TH>"						>>curr_log;
		print "	</TR>"									>>curr_log;
		print "</THEAD>"								>>curr_log;
		print "<TBODY>"									>>curr_log;
	}

	# Write the data to the log-files per day.
	cnt_per_day++;
	printf( "<TR class=%s>\n", c[ tr_d++ % 2 ] )						>>curr_log;
	printf( "	<TD class=Even><A HREF=\"%s/%s/scc.%s.html\">%s</A></TD>\n", d, r, $1, $1 )	>>curr_log;
	if ( length( model[ $1 ] ) > 0 )
	{
		printf( "	<TD class=Odd>%s</TD>\n", model[ $1 ] )				>>curr_log;
	}
	else
	{
		printf( "	<TD class=Odd>&nbsp;</TD>\n" )					>>curr_log;
	}
	printf( "	<TD class=Even>%s&nbsp;%s</TD>\n", os[ $1 ], rel[ $1 ] )		>>curr_log;
	printf( "	<TD class=Odd><A HREF=\"%s/%s/scc.%s.log.html#log_%s_%s\">%s %s</A></TD>\n",\
		d, r, $1, $2, $3, $2, $3 )							>>curr_log;
	printf( "	<TD class=Even align=right>%s</TD>\n", $4 )				>>curr_log;
	print "</TR>"										>>curr_log;
}
END	{
		if ( length( curr_day ) )
		{
			# Write the data to the main log file.
			printf( "<TR class=%s><TD%s><A HREF=\"%s/%s/scc-log-%s.html\">%s</A></TD><TD %s align=right>%s</TD></TR>\n",\
				c[ tr_m %2 ], " class=Even", d, r, curr_day, curr_day, " class=Odd", cnt_per_day );
			printf( "</TBODY></TABLE></CENTER></BODY></HTML>\n" );
		}

		# Finish all the html-files pointing to the changes per day.
		for ( curr_log in visited )
		{
			print "</TBODY></TABLE></CENTER></BODY></HTML>"				>>curr_log;
			close( curr_log );
		}
}'	b="${bg_color}"		\
	l="${logo_tag}"		\
	d="${scc_web_path_dir}"	\
	r="${realm}"		\
		scc-summary.data ${TMP_FILE_1} >>scc-log-index.html

# From now on, these files are accessible again by the web server.
find . -name "scc-log-*.html" -type f	|
sed -e '/\/.*\//d'			|
xargs chown "${new_owner_group}" 2>/dev/null

# Record for all systems the date and time of the last detected change on the system.
# Combine the general summary-data and the data of the changes.
sort -t: -k 2,3r -k 1,1 ${TMP_FILE_1}	|
awk -F: '/general_data/	{
		# Format of the input is: "general_data":<host>:<model>:<os>:<release>:<last_day>:<last_time>:<domain>
		printf( "%s:%s:%s:%s:%s:%s:%s:%s\n", $2, $3, $4, $5, $6, $7, last_day[ $2 ], last_time[ $2 ] );
		next;
	}
{
	# Format of the input is: <system> <day> <time> <line-count>
	# The data is sorted on day, time and system.
	if ( ! visited[ $1 ] )
	{
		# Only record the first record of each system: get the most recent change.
		visited[ $1 ] = 1;
		last_day[ $1 ] = $2;
		last_time[ $1 ] = $3;
	}
}' - scc-summary.data >${TMP_FILE_2}

while read col title remainder
do
	html="scc-summary-${title}.html"
	rm -f ${html}

	# Each header is a HREF to a html-file with the data sorted on the
	# corresponding column. Mark the proper heading in the table to indicate 
	# the current html-file. 
	sed	-e "s@${html}\">\(.*\)</A></TH>@${html}\"><font color=white>\1</font></A></TH>@"	\
		-e "s@SUM_TITLE@${title}@g"							\
			<scc-summary-init.html							\
			>${html}

	chown "${new_owner_group}" ${html}
	
	extra_sort=""
	if [ "${remainder}" ]
	then
		extra_sort="-k ${remainder}"
	fi

	sort -t: -k ${col} ${extra_sort} ${TMP_FILE_2}	|
	awk -F: 'BEGIN	{
				c[ 0 ] = "Even";
				c[ 1 ] = "Odd";
				tr_c = 1;		# TR class 
			}
		{
			# Format of the input is:
			#	1 <host>
			#	2 <model>
			#	3 <os>
			#	4 <release>
			#	5 <last_day_run>
			#	6 <last_time_run>
			#	7 <last_change_day>
			#	8 <last_change_time>
			printf( "<TR class=%s align=left>\n", c[ tr_c++ % 2 ] );
			printf( "	<TD class=Even><A HREF=\"%s/%s/scc.%s.html\">%s</A></TD>\n", d, r, $1, $1 );
			if ( length( $2 ) > 0 )
			{
				printf( "	<TD class=Odd>%s</TD>\n", $2 );
			}
			else
			{
				printf( "	<TD class=Odd>&nbsp;</TD>\n" );
			}
			printf( "	<TD class=Even>%s&nbsp;%s</TD>\n", $3, $4 );
			if ( length( $5 ) > 0 )
			{
				printf( "	<TD class=Odd><A HREF=\"%s/%s/scc.%s.log.html\">%s %s</A></TD>\n",\
					d, r, $1, $5, $6 );
			}
			else
			{
				printf( "	<TD class=Odd>&nbsp;</TD>\n" );
			}
			if ( length( $7 ) > 0 )
			{
				printf( "	<TD class=Even><A HREF=\"%s/%s/scc.%s.log.html#log_%s_%s\">%s %s</A></TD>\n",\
					 d, r, $1, $7, $8, $7, $8 );
			}
			else
			{
				printf( "	<TD class=Even>&nbsp;</TD>\n" );
			}
			print "</TR>";
		}' d="${scc_web_path_dir}" r="${realm}" >>${html}

	echo "</TBODY></TABLE></CENTER></BODY></HTML>" >>${html}
done <<_X_
1,1f sys
2,2 model 1,1f
3,4 os 1,1f
5,6 run 1,1f
7,8r change 1,1f
_X_

rm -f scc-summary-init.html

# Searching for all top-level classifications takes some time for a large number of
# systems in a realm. To reduce the amount of time, we keep the classifications
# in a file and save it for later runs during 7 days.
create_class=1
if [ -f scc-summary.class ]
then
	too_old=$(find . -name scc-summary.class -mtime +7 2>/dev/null)
	if [ ${system_cnt} -gt 10 -a -z "${too_old}" ]
	then
		create_class=0
	fi
fi

if [ ${create_class} -eq 1 -o ${force} -eq 1 ]
then
	# Retrieve all the top-level classifications that are used in this realm
	# Ignore the class that is used to delimit the data of the user-modules: MoDuLe
	find . -name "scc.*.cur" 2>/dev/null    			|
	sed -e '/\/.*\//d'						|
	xargs cut -d: -f2						|
	uniq								|
	sort -u								|
	sort -f								|
	sed	-e '/^MoDuLe$/d'	\
		-e 's@^@<OPTION> @'	\
		-e '/^[ 	]*$/d'	\
		-e 's@$@ </OPTION>@' >scc-summary.class

	chown "${new_owner_group}" scc-summary.class
fi

# Build the option-list for all systems.
awk -F: '{ print "<OPTION>", $2, "</OPTION>" }' scc-summary.data >scc-summary.sys

if [ ! -f scc-rules.data ]
then
	SCC_RULES_RADIO=""
else
	if [ -s scc-rules.data ]
	then
		SCC_RULES_RADIO="<BR><INPUT TYPE=\"radio\" NAME=\"opt\" VALUE=\"rules\" > <FONT color=red>Rules</FONT>"
	else
		SCC_RULES_RADIO="<BR><INPUT TYPE=\"radio\" NAME=\"opt\" VALUE=\"rules\" > Rules"
	fi
fi

SCC_SMT_RADIO=""
if [ -f "custom/scc-smt-select" -o -h "custom/scc-smt-select" ]
then
	SCC_SMT_RADIO="<BR><INPUT TYPE=\"radio\" NAME=\"opt\" VALUE=\"smt\" > System Tools"
fi

# Build the index.html
# The string "all_systems" for the option-list is used in scc.cgi.sh
# Keep all the radio-buttons adjacent on one line.
# Otherwise IE inserts a blank line after the longest entry!?!?!
cat >${TMP_FILE_1} <<-EndOfTxt
	<!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.01 Transitional//EN">
	<HTML>
	<HEAD>
		<LINK HREF="${web_realm_dir}/custom/style.css" REL="stylesheet" TYPE="text/css">
		<TITLE>System Configuration Collector: ${realm}</TITLE>
	</HEAD>
	<BODY${bg_color}>
	<CENTER>

	<A HREF="${scc_web_path_dir}/scc-help/scc-realm-index.html">${logo_tag}</A>

	<H4>Configuration data:</H4>

	<FORM ACTION="${web_realm_dir}/cgi-bin/scc-wrapper.cgi">
	<TABLE SUMMARY="System(s) info" BORDER=0 CELLPADDING=5>
	<TR class=Odd>
		<TD ALIGN=center>
			<SELECT NAME=sys SIZE="1" >
				<OPTION> all_systems </OPTION>
				$(cat scc-summary.sys)
			</SELECT>
		</TD>

		<TD>
			<INPUT TYPE="radio" NAME="opt" VALUE="cnf" CHECKED> Configuration<BR><INPUT TYPE="radio" NAME="opt" VALUE="log" > Changes (logbook)${SCC_SMT_RADIO}${SCC_RULES_RADIO}
		</TD>

		<TD>
			<INPUT TYPE="SUBMIT" NAME="config" VALUE="Start">
		</TD>

		<TD>
			Search string:
			<BR>
			<INPUT TYPE="text" NAME="search" SIZE="30" MAXLENGTH="80">
			<BR>
			<INPUT TYPE="checkbox" NAME="s_case" VALUE="search" CHECKED> Case sensitive
		</TD>

	</TR>
	</TABLE>
	</FORM>

	<HR WIDTH="70%">

	<H4>Compare two systems:</H4>

	<FORM ACTION="${web_realm_dir}/cgi-bin/scc-wrapper.cgi">
	<TABLE SUMMARY="Comparing systems" BORDER=0 CELLPADDING=5>
	<TR>
		<TD ALIGN=center>System 1</TD>
		<TD ALIGN=center>System 2</TD>
		<TD>Class(es)</TD>
	</TR>

	<TR>
		<TD valign=top>
			<SELECT NAME="sys1" SIZE="1" >
				$(cat scc-summary.sys)
			</SELECT>
		</TD>

		<TD valign=top>
			<SELECT NAME="sys2" SIZE="1" >
				$(cat scc-summary.sys)
			</SELECT>
		</TD>

		<TD>
			<SELECT MULTIPLE NAME="class" SIZE="5">
				$(cat scc-summary.class)
			</SELECT>
		</TD>
	
		<TD>
			<INPUT TYPE="SUBMIT" NAME="compare" VALUE="Start">
		</TD>
	</TR>
	</TABLE>
	</FORM> 

	</CENTER>
	</BODY>
		</HTML>
EndOfTxt

mv  ${TMP_FILE_1} index.html
chown "${new_owner_group}" index.html
	
rm -f scc-summary.sys

exit 0
