#!/usr/bin/perl -w # Program to update system/SYSINFO.TXT # Increments the build number and sets the date and machine type. # Written by Martin Thomson for Daleken 1.10. # Updated for Daleken 1.12. $file = '../system/SYSINFO.TXT'; $bak = '~'; exit if( !-e ".build" ); unlink (".build"); rename( $file, $file . $bak ); open (SYSINFO, "<$file$bak") or die "Can't open SYSINFO input file!"; open (OUTPUT, ">$file") or die "Can't open SYSINFO output file!"; select (OUTPUT); while(<SYSINFO>) { # Strip comments and save them for later. if( /(\s*#.*)$/ ) { $comment = "$1"; } else { $comment = ""; }; s/(\s*#.*)$//g; # Special case lines that need changing. # Note that the data program called here is GNU date, some other # versions may not support the no padding extension. Remove the '-' # signs if you have problems. SWITCH: { /^Date/ && do { $date = `date '+"%a %-d/%b/%Y %-l:%M%p %Z";'`; $date =~ s/\n//g; s/^(Date\s+)\".+\";$/$1.$date/e; last SWITCH; }; /^Build/ && do { s/^(Build\s+)(\d+);$/$1.($2+1).";"/e; last SWITCH; }; /^Platform/ && do { $machine = "\"".`uname -s`."-".`uname -m`."\";"; $machine =~ s/\n//g; s/^(Platform\s+)\".+\";$/$1.$machine/e; last SWITCH; }; }; # Strip end of lines from $_ then print the result, with appended comment chop; # strip ending "\n" print ($_,$comment,"\n"); }; close (SYSINFO); close (OUTPUT); select (STDOUT); unlink($file . $bak); exit;