137 lines
3.3 KiB
Perl
Executable File
137 lines
3.3 KiB
Perl
Executable File
#!/usr/bin/perl
|
|
# STTA Rev. 1.3 Copyright (c) 2001-2002 Jesús Pérez Lorenzo --- license GNU GPL
|
|
# makemasterdist
|
|
|
|
|
|
sub show_numbermoment
|
|
{
|
|
my ($timeNumber) = @_;
|
|
local @tm = localtime($timeNumber);
|
|
|
|
return sprintf "[%2.2d/%s/%4.4d %2.2d:%2.2d:%2.2d]",
|
|
$tm[3], $tm[4]+1, $tm[5]+1900, $tm[2], $tm[1], $tm[0];
|
|
}
|
|
|
|
$task_type = $ARGV[0];
|
|
$opc = $ARGV[1];
|
|
|
|
#if ( $task_type ne "dir" && $task_type ne "file" && $task_type ne "list" && $task_type ne "ALL" ) {
|
|
# print "setup: \"$task_type\" unknown option task \n";
|
|
# print "setup [dir|file|list|ALL] -force\n";
|
|
# exit 1;
|
|
#};
|
|
|
|
# where is config file for parameters .... (same as Webmin)
|
|
$config_directory="/etc/webmin";
|
|
$debug=2;
|
|
|
|
do './base-lib.pl';
|
|
do './global-lib.pl';
|
|
do './lists-lib.pl';
|
|
do './print-lib.pl';
|
|
|
|
$tool_name="setup";
|
|
$tta_logfile=$ENV{'TTA_LOGFILE'};
|
|
$tta_logfile="/tmp/.webmin/stta_log";
|
|
$default_lang = "en";
|
|
$current_lang = "es";
|
|
$module_name = "stta";
|
|
$remote_user="admin";
|
|
$base_remote_user="admin";
|
|
$session_id="$$";
|
|
$hostname=`hostname`;
|
|
$hostname=~s/\n//g;
|
|
$ENV{'REMOTE_HOST'}=$hostname;
|
|
$action_id_count=0;
|
|
%ttaprops=();
|
|
@ttahosts=();
|
|
%sttaparams=();
|
|
$cginame= $0 =~ /([^\/]+)$/ ? $1 : '-';
|
|
$ldap_ok=true;
|
|
$ldapcache_ok=true;
|
|
$tta_ok=true;
|
|
$to_init=false;
|
|
$DebugFile="/var/webmin/webmin.log";
|
|
# if ( "" ) $config{stta_debugname}.$tool_name.".log";
|
|
|
|
&initialize();
|
|
&load_dataconf("");
|
|
%access = &get_module_acl();
|
|
%text = &load_language();
|
|
|
|
# globals to keep STTA info
|
|
%ttaprops=();
|
|
@ttahosts=();
|
|
%sttaparams=();
|
|
$ldap_ok=true;
|
|
$ldapcache_ok=true;
|
|
$tta_ok=true;
|
|
|
|
$m=`pwd`;
|
|
chomp($m);
|
|
|
|
&read_file("$m/$remote_user.acl", \%access);
|
|
#$access{'noconfig'} &&
|
|
# &error($text{'config_ecannot'});
|
|
|
|
%minfo=&load_minfo();
|
|
$config_dir="$config_directory";
|
|
&read_file( "$config_dir/module.info",\%cinfo) ;
|
|
|
|
$cgi_List=`ls *.cgi`;
|
|
$pl_List=`ls *.pl`;
|
|
$js_List=`ls *.js`;
|
|
$sh_List=`ls *.sh`;
|
|
|
|
local $now = time();
|
|
local @tm = localtime($now);
|
|
local $line_tm = sprintf "[%2.2d/%s/%4.4d %2.2d:%2.2d:%2.2d]",
|
|
$tm[3], $tm[4]+1, $tm[5]+1900,
|
|
$tm[2], $tm[1], $tm[0];
|
|
local $id = sprintf "%s-%s", $minfo{version}.$now;
|
|
|
|
$lineStamp="# stta: (@#) ";
|
|
|
|
$fileName="tta_addusr.cgi";
|
|
$fileNameW="tta_addusr.cgi"."$$";
|
|
|
|
$| = 1;
|
|
$lineStamp="# stta: (@#) ";
|
|
|
|
$fileName="tta_addusr.cgi";
|
|
$check_next=false;
|
|
open(OUTFILE, ">$fileNameW");
|
|
open(FILEOUT, $fileName);
|
|
while(<FILEOUT>) {
|
|
if ( $check_next eq true ) {
|
|
if ( $_ =~ /^# stta: \(@#\) / ) {
|
|
print OUTFILE $lineStamp." ".$id." $line_tm\n";
|
|
} else {
|
|
print OUTFILE $lineStamp." ".$id." $line_tm\n";
|
|
print OUTFILE $_;
|
|
}
|
|
$check_next=false;
|
|
} else {
|
|
print OUTFILE "$_";
|
|
}
|
|
if ( $_ =~ /^# STTA Rev. / ) { $check_next=true; }
|
|
}
|
|
close(FILEOUT);
|
|
close(INFILE);
|
|
close(OUTFILE);
|
|
|
|
system("mv $fileNameW $fileName");
|
|
$sumr=`sum -r $fileName`;
|
|
@SumR=split(/ /, $sumr);
|
|
|
|
#print ref($now);
|
|
print "$fileName | $line_tm | $minfo{version}:$now | $SumR[0]\n";
|
|
$lineOut="$fileName | $line_tm | $minfo{version}:$now | $SumR[0]\n";
|
|
@line=split(/\|/,$lineOut);
|
|
@brandData=split(/:/,$line[2]);
|
|
$brandVersion=$brandData[0];
|
|
$brandTime=$brandData[1];
|
|
print &show_numbermoment($brandTime)." -- $brandTime - $now\n";
|
|
|
|
exit;
|