User:ZyMOS/Howto configure the linux kernel/script


 * 1) !/usr/bin/perl



use CMS::MediaWiki; use LWP::Simple; use Net::hostent; use Socket; use IO::Socket; use Getopt::Std;
 * 1) Modules
 * 1) Modules


 * 1)     Time Server Settings
 * 2) some setting that
 * 1) some setting that

$sleepInt = 3; # max time(sec) for random sleep interval between extractions, and posts (integer or float) $listfile = "1";


 * 1) Websites for extraction data
 * 1) Websites for extraction data

################################## #  Write woli paghes subroutine sub updatePage {	local($a, $b); ($a, $b) = ($_[0], $_[1]); #Post the page $rc = $mw->editPage(  	  title   => "$a" ,	  section => '', 	  text    => "$b" ,	  summary => "Updated via Bot." ,	); # randome sleep from 0-n in sec # to put less load on server my $b = rand($sleepInt); system sleep ($b); }

print "\n\n######################\n# Loging onto Wikihowto.\n#\n"; $mw = CMS::MediaWiki->new(       host  => 'en.howto.wikia.com',        path  => 'wiki',     #  Can be empty on 3rd-level domain Wikis        debug => 1            #  0=no debug msgs, 1=some msgs, 2=more msgs );

$rc = $mw->login( user => 'Bot-Admin-ZyMOS', pass => 'xxxxxxxxx' );

$phile=0; $data=0; $tree=0; $x=0; print "\n"; open(LI, "< $listfile") or die "at start"; @list = ; foreach $phile (@list){ #extract page loc from file name ($phile) $fileContent = $phile; $fileContent =~ s/\/usr\/src\/linux//; $fileContent =~ s/\/Kconfig//; $pageName = "User:ZyMOS/Howto configure the linux kernel". "$fileContent"; $tree = $tree. $pageName. "\n"; open(FI, "< $phile") or die "file $phile didn't open"; @lines = ; $page = ''; foreach $line (@lines){ #subsitutions $line =~ s/\t//g; $page = $page. $line; # } }  close(FI); $page =~ s/\n //g; $page =~ s/\n / $page =~ s/^config/*Option: /gm; $page =~ s/^bool/**(on\/off) /gm; $page =~ s/^select /**select /gm; $page =~ s/^depends/**depends /gm; $page =~ s/^default/**default /gm; $page =~ s/^tristate/**(on\/off\/module) /gm; $page =~ s/^help/**: /gm; $page =~ s/^---help---/**: /gm; $page =~ s/^endmenu//gm; $page =~ s/^endif//gm; $page =~ s/^source \"/*Option: Konfig\.)\"//gm;	$page =~ s/\/(Kconfig|Konfig\.)/]]/gm;
 * 1)  print "$pageName\n";
 * 1)   $line =~ s/^config/*Option:/;
 * 1) 	$line =~ s/\n\s\s*/ /;
 * 2) 	$line =~ s/\n //;
 * 3) 	$line =~ s/^\sbool/**(on\/off)
 * 4) 	$line =~ s/^\sdepends/**depends/;
 * 5) 	#$line =~ s/\n**$//;
 * 6) 	$line =~ s/^\stristate/**(on\/off\/module)
 * 7) 	$line =~ s/^\shelp\s/**:/;
 * 8) 	$line =~ s/^\s---help---\s/**:/;
 * 9) 	$line =~ s/---help---$//;
 * 10) 	$line =~ s/^source\s"/*Option: \[\[Guide to configuring the linux kernel\//;
 * 11) 	$line =~ s/\/Kconfig"$/\]\]/;
 * 12) 	$line =~ s/^\sIf/** If/;
 * 13)   chop($line);
 * 14)  print "<$line>\n";
 * 15)   if($line != "endmend" || $line != "endif"){
 * 1)  print "<$line>\n";
 * 2)   if($line != "endmend" || $line != "endif"){
 * 1) print $page;
 * 2) 	 $page =~ s/\t//g;
 * 1) 	$page =~ s/---help---//g;
 * /g;
 * 1) 	$page =~ s/\n\n/\n/g;
 * 1)        $page =~ s/\n**$//g;
 * 1) 	$page =~ s/---help---$//g;
 * 1) 	$page =~ s/\nIf/
 * If/g;

print "========================\n"; print "==$pageName==\n"; &updatePage($pageName,$page); $x++; } close(LI);
 * 1)  print "$page\n\n";
 * 1)  if(0){
 * 2) 	exit;
 * 3) 	# }
 * 1) &updatePage($tmpRedir,$numOfRedirects);
 * 2) print $tree;