#
#  Various misc functions
#

require "conf/coroner.cf";

#
# Create the config vault; a location to copy all the config files, etc.
#
sub prepare_config_vault {

print "Preparing the vault...\n";

print "... in prepare_config_vault()\n" if $verbose;

mkdir("$DATA/$conf_vault", 0700);

#
# Toss in HTML file
#
if (-f "$DATA/$conf_vault/index.html") {unlink "$DATA/$conf_vault/index.html";}

die "Can't open configuration vault HTML index file $DATA/$conf_vault/index.html\n" unless open(CFI, ">$DATA/$conf_vault/index.html");

print CFI "<HTML>\n";
print CFI "<BODY BGCOLOR=\"#FFFFFF\">\n\n";
print CFI "<h2>The Coroner's Toolkit Found these Configuration/Interesting files</h2>\n\n";
print CFI "<hr>\n\n<TT>\n";
close(CFI);

}

#
# Create the config vault; a location to copy all the config files, etc.
#
sub close_config_vault {

print "Closing the vault (in close_config_vault())\n" if $verbose;

if (-f "$DATA/$conf_vault/index.html") {
	die "Can't open configuration vault HTML index file $DATA/$conf_vault/index.html\n" unless open(CFI, ">>$DATA/$conf_vault/index.html");
	print CFI "</TABLE>\n\n</BODY></HTML>\n";
	close(CFI);
	}

&date_stamp("$DATA/MD5_all");

system("$FIND $DATA\_$pretty_date -print | xargs $MD5 >> $DATA/MD5_all");

&sign_it("$DATA/MD5_all");

}

1;
