Tools follow up
check-doc.pl : add result message when no issues is found config.pl : update centos enable coredump setup
This commit is contained in:
parent
a3f0aedf53
commit
ec91269ff4
@ -32,6 +32,7 @@ sub GetArgs {
|
|||||||
print "Incorect option specified, available option are:\n"
|
print "Incorect option specified, available option are:\n"
|
||||||
."\t --atcf filename => file (specify atcommand doc to use)\n"
|
."\t --atcf filename => file (specify atcommand doc to use)\n"
|
||||||
."\t --scriptf filename => file (specify script doc to use)\n"
|
."\t --scriptf filename => file (specify script doc to use)\n"
|
||||||
|
."\t --leftover=0|1 => should we run reverse chk for leftover in documentation ?\n"
|
||||||
."\t --target => target (specify wich check to run [$sValidTarget])\n";
|
."\t --target => target (specify wich check to run [$sValidTarget])\n";
|
||||||
exit;
|
exit;
|
||||||
}
|
}
|
||||||
@ -119,6 +120,8 @@ sub Script_Chk {
|
|||||||
}
|
}
|
||||||
print "}\n\n";
|
print "}\n\n";
|
||||||
}
|
}
|
||||||
|
else { print "All script command in Src are documented, no issues found\n"; }
|
||||||
|
|
||||||
if($sLeftOverChk){
|
if($sLeftOverChk){
|
||||||
my $raLeftover_sct = Chk(\@aDoc_sct,\@aDef_sct); #we just inverse the chk for leftover
|
my $raLeftover_sct = Chk(\@aDoc_sct,\@aDef_sct); #we just inverse the chk for leftover
|
||||||
if(scalar(@$raLeftover_sct)){
|
if(scalar(@$raLeftover_sct)){
|
||||||
@ -128,6 +131,7 @@ sub Script_Chk {
|
|||||||
}
|
}
|
||||||
print "}\n\n";
|
print "}\n\n";
|
||||||
}
|
}
|
||||||
|
else { print "All script command in documentation match a source BUILDIN, no leftover found\n"; }
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -180,6 +184,8 @@ sub Atc_Chk {
|
|||||||
}
|
}
|
||||||
print "}\n\n";
|
print "}\n\n";
|
||||||
}
|
}
|
||||||
|
else { print "All atcommand in Src are documented, no issues found\n"; }
|
||||||
|
|
||||||
if($sLeftOverChk){
|
if($sLeftOverChk){
|
||||||
my $raLeftover_sct = Chk(\@aDoc_act,\@aDef_act); #we just inverse the chk for leftover
|
my $raLeftover_sct = Chk(\@aDoc_act,\@aDef_act); #we just inverse the chk for leftover
|
||||||
if(scalar(@$raLeftover_sct)){
|
if(scalar(@$raLeftover_sct)){
|
||||||
@ -189,5 +195,6 @@ sub Atc_Chk {
|
|||||||
}
|
}
|
||||||
print "}\n\n";
|
print "}\n\n";
|
||||||
}
|
}
|
||||||
|
else { print "All atcommand in documentation match a source ATCMD, no leftover found\n"; }
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
@ -42,6 +42,7 @@ my $sForce = 0;
|
|||||||
my $sClean = 0;
|
my $sClean = 0;
|
||||||
my $sTarget = "All";
|
my $sTarget = "All";
|
||||||
my $sHelp = 0;
|
my $sHelp = 0;
|
||||||
|
my $sOS;
|
||||||
GetArgs();
|
GetArgs();
|
||||||
Main();
|
Main();
|
||||||
|
|
||||||
@ -107,14 +108,18 @@ sub Main {
|
|||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
sub EnableCoredump {
|
sub EnableCoredump {
|
||||||
print "\n Starting Enabling coredump \n";
|
print "\n Starting Enabling coredump \n";
|
||||||
my $sCurfile = "~/.bashrc";
|
my $sCurfile = "~/.bashrc";
|
||||||
my @lines = ();
|
my @lines = ();
|
||||||
my $sJump = .0;
|
my $sJump = .0;
|
||||||
open PIPE,"sudo less $sCurfile |" or die $!;
|
open PIPE,"sudo less $sCurfile |" or die $!;
|
||||||
foreach(<PIPE>){
|
foreach(<PIPE>){
|
||||||
push(@lines,$_) if /ulimit/;
|
if($_ =~ /ulimit -c unlimited/){
|
||||||
|
$sJump = 1; #already in here nothing to do
|
||||||
|
last;
|
||||||
|
}
|
||||||
|
push(@lines,$_) if /ulimit/;
|
||||||
}
|
}
|
||||||
if(scalar(@lines)>0){
|
if(scalar(@lines)>0){
|
||||||
print "ulimit instruction found in file=$sCurfile\n"
|
print "ulimit instruction found in file=$sCurfile\n"
|
||||||
@ -122,14 +127,33 @@ sub EnableCoredump {
|
|||||||
."are you sure you want to continue ? [y/n] \n";
|
."are you sure you want to continue ? [y/n] \n";
|
||||||
$sJump=1 if(GetValidAnwser("y|o|n") =~ /n/i);
|
$sJump=1 if(GetValidAnwser("y|o|n") =~ /n/i);
|
||||||
}
|
}
|
||||||
system("sudo echo \"ulimit -c unlimited\" >> $sCurfile") unless $sJump==1;
|
system("sudo echo \"ulimit -c unlimited\" >> $sCurfile") if $sJump==0;
|
||||||
#FIXME centos need to alter /etc/security/limits.conf
|
$sJump=0;
|
||||||
|
|
||||||
|
$sOS = GetOS() unless($sOS);
|
||||||
|
if($sOS =~ /Fedora|CentOs/i){;
|
||||||
|
open FILE, "</etc/security/limits.conf" || die;
|
||||||
|
open FILE_TMP, ">tmp_limits.conf" || die;
|
||||||
|
while(<FILE>){
|
||||||
|
@lines=split(' ',$_);
|
||||||
|
if($lines[2] eq "core" && $lines[3] eq "0"){
|
||||||
|
$lines[3]="unlimited";
|
||||||
|
print FILE_TMP "* hard core unlimited\n";
|
||||||
|
$sJump=1; #mark we have found it
|
||||||
|
}
|
||||||
|
else { print FILE_TMP $_; }
|
||||||
|
}
|
||||||
|
close FILE;
|
||||||
|
close FILE_TMP;
|
||||||
|
system("sudo mv tmp_limits.conf /etc/security/limits.conf") if $sJump==1; #don't overwritte if some config was already in there
|
||||||
|
unlink "tmp_limits.conf";
|
||||||
|
}
|
||||||
|
|
||||||
$sCurfile = "/etc/sysctl.conf";
|
$sCurfile = "/etc/sysctl.conf";
|
||||||
@lines = ();
|
@lines = ();
|
||||||
open PIPE,"sudo less $sCurfile |" or die $!;
|
open PIPE,"sudo less $sCurfile |" or die $!;
|
||||||
foreach(<PIPE>){
|
foreach(<PIPE>){
|
||||||
push(@lines,$_) if /kernel.core/;
|
push(@lines,$_) if /^kernel.core/;
|
||||||
}
|
}
|
||||||
if(scalar(@lines)>0){
|
if(scalar(@lines)>0){
|
||||||
print "ulimit instruction found in file=$sCurfile\n"
|
print "ulimit instruction found in file=$sCurfile\n"
|
||||||
@ -145,18 +169,22 @@ sub EnableCoredump {
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
sub GetOS {
|
||||||
|
#yes we could $^0 or uname -r but $^0 only give perl binary build OS and uname hmm...
|
||||||
|
my @aSupportedOS = ("Debian","Ubuntu","Fedora","CentOs","FreeBSD");
|
||||||
|
my $sOSregex = join("|",@aSupportedOS);
|
||||||
|
until($sOS =~ /$sOSregex/i){
|
||||||
|
print "Please enter your OS:[$sOSregex] or enter 'quit' to exit\n";
|
||||||
|
$sOS = <>; chomp($sOS);
|
||||||
|
last if($sOS eq "quit");
|
||||||
|
}
|
||||||
|
return $sOS;
|
||||||
|
}
|
||||||
|
|
||||||
sub InstallSoft {
|
sub InstallSoft {
|
||||||
print "\n Starting InstallSoft \n";
|
print "\n Starting InstallSoft \n";
|
||||||
print "This autoinstall feature is experimental, package name varies from distri and version, couldn't support them all\n";
|
print "This autoinstall feature is experimental, package name varies from distri and version, couldn't support them all\n";
|
||||||
#yes we could $^0 or uname -r but $^0 only give perl binary build OS and uname hmm...
|
$sOS = GetOS();
|
||||||
my @aSupportedOS = ("Debian","Ubuntu","Fedora","CentOs","FreeBSD");
|
|
||||||
my $sOSregex = join("|",@aSupportedOS);
|
|
||||||
my $sOS;
|
|
||||||
until($sOS =~ /$sOSregex/i){
|
|
||||||
print "Please enter your OS:[$sOSregex] or enter 'quit' to exit\n";
|
|
||||||
$sOS = <>; chomp($sOS);
|
|
||||||
last if($sOS eq "quit");
|
|
||||||
}
|
|
||||||
if($sOS eq "quit"){ print "Skipping Software installation\n"; return; }
|
if($sOS eq "quit"){ print "Skipping Software installation\n"; return; }
|
||||||
elsif($sOS =~ /Ubuntu|Debian/i) { #tested on ubuntu 12.10
|
elsif($sOS =~ /Ubuntu|Debian/i) { #tested on ubuntu 12.10
|
||||||
my @aListSoft = ("gcc","gdb","zlibc","zlib1g-dev","make","git","mysql-client","mysql-server","mysql-common","libmysqlclient-dev","phpmyadmin","libpcre3-dev");
|
my @aListSoft = ("gcc","gdb","zlibc","zlib1g-dev","make","git","mysql-client","mysql-server","mysql-common","libmysqlclient-dev","phpmyadmin","libpcre3-dev");
|
||||||
|
Loading…
x
Reference in New Issue
Block a user