Commit fedf976b authored by Leigh B. Stoller's avatar Leigh B. Stoller

Commit little script to set the version and build info. The build info

comes from the current date. The version from from sql/database-migrate.txt.
Also commit changes to front page. I still need to hook it into the
install process.
parent 81b9d4ca
#!/usr/bin/perl -w
#
# EMULAB-COPYRIGHT
# Copyright (c) 2000-2002, 2005 University of Utah and the Flux Group.
# All rights reserved.
#
# Set the version and build info into the DB, at a toplevel install.
#
use English;
use Getopt::Std;
use POSIX qw(strftime);
#
# Configure variables
#
my $DBNAME = '@TBDBNAME@';
my $DBMIGRATE = "@top_srcdir@/sql/database-migrate.txt";
#
# We use the bare Mysql module instead of the testbed libdb, so that this
# script can run from a first-time installation, before the latter is
# installed.
#
use Mysql;
#
# Build a list of tables to export
#
my $dbh = Mysql->connect('localhost', $DBNAME, undef, undef);
if (!$dbh) {
die("*** $0:\n".
" Unable to connect to mysqld\n");
}
#
# Easy, get the build version which is simply today's date.
#
my $buildinfo = POSIX::strftime("%m/%d/20%y", localtime());
$buildinfo = $dbh->quote($buildinfo);
#
# And store into the appropriate sitevar.
#
my $query_result =
$dbh->query("update sitevariables set value=$buildinfo ".
"where name='general/version/build'");
if (!$query_result) {
die("*** $0:\n".
" Unable to set sitevar 'general/version/build' to $buildinfo\n");
}
#
# Now dig out the version info from the database-migrate file.
#
my $major = "96";
my $minor = "96";
open(MIG, $DBMIGRATE) or
die("*** $0:\n".
" Unable to open $DBMIGRATE\n");
while (<MIG>) {
if ($_ =~ /^(\d*)\.(\d*)/) {
$major = $1;
$minor = $2;
}
}
#
# The last entry is the build info.
#
$query_result =
$dbh->query("update sitevariables set value='$major' ".
"where name='general/version/major'");
if (!$query_result) {
die("*** $0:\n".
" Unable to set sitevar 'general/version/major' to '$major'\n");
}
$query_result =
$dbh->query("update sitevariables set value='$minor' ".
"where name='general/version/minor'");
if (!$query_result) {
die("*** $0:\n".
" Unable to set sitevar 'general/version/minor' to '$minor'\n");
}
exit(0);
......@@ -608,8 +608,8 @@ function PAGEBEGINNING( $title, $nobanner = 0 ) {
global $TBDOCBASE;
global $autorefresh;
$MAINPAGE = !strcmp($TBDIR, "/usr/testbed/");
$MAINPAGE = !strcmp($TBDIR, "/usr/testbed/");
echo "<!DOCTYPE HTML PUBLIC '-//W3C//DTD HTML 4.01 Transitional//EN'
'http://www.w3.org/TR/html4/loose.dtd'>
<html>
......@@ -653,10 +653,10 @@ function PAGEBEGINNING( $title, $nobanner = 0 ) {
href='$TBDOCBASE/index.php3'>
</map>
<table cellpadding='0' cellspacing='0' width='100%'>
<tr>
<td valign='top' class='bannercell'
background='$BASEPATH/headerbgbb.jpg'
bgcolor=#3D627F>
<tr valign='top'>
<td valign='top' class='bannercell'
background='$BASEPATH/headerbgbb.jpg'
bgcolor=#3D627F
<img width=369 height=100 border=0 usemap=\"#overlaymap\" ";
if ($ELABINELAB) {
......@@ -666,10 +666,10 @@ function PAGEBEGINNING( $title, $nobanner = 0 ) {
echo "src='$BASEPATH/overlay.".strtolower($THISHOMEBASE).".gif' ";
}
echo "alt='$THISHOMEBASE - the network testbed'>\n";
if (!$MAINPAGE) {
echo "<font size='+1' color='#CCFFCC'>&nbsp;<b>$WWW</b></font>";
}
echo "</td></tr></table>\n";
if (!$MAINPAGE) {
echo "<font size='+1' color='#CCFFCC'>&nbsp;<b>$WWW</b></font>";
}
echo "</td></tr></table>\n";
}
echo "<table cellpadding='8' cellspacing='0' height='100%' width='100%'>
......@@ -787,9 +787,20 @@ function PAGEHEADER($title, $view = NULL) {
border=0 alt='Admin Off'></a>\n";
}
}
$major = "";
$minor = "";
$build = "";
TBGetVersionInfo($major, $minor, $build);
$now = date("D M d g:ia T");
echo "$title</h2></td>\n";
echo "<td class=contentheader align=right>\n";
echo "<table border='0' cellpadding='0' cellspacing='0'>";
echo " <tr>";
echo " <td class=contentheader>".
"<font size=-1><b>Vers: $major.$minor Build: $build</b></font></td>";
echo " <td class=contentheader>&nbsp&nbsp</td>";
echo " <td class=contentheader align=right>";
if ($login_uid) {
echo "<font size=-1>'<b>$login_uid</b>' Logged in.<br>$now</font>\n";
}
......@@ -797,6 +808,9 @@ function PAGEHEADER($title, $view = NULL) {
echo "$now";
}
echo "</td>";
echo "</tr>";
echo "</table>";
echo "</td>";
echo "</tr>\n";
echo "<tr><td colspan=3 class=\"contentbody\" width=*>";
echo "<!-- begin content -->\n";
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment