#!/usr/bin/perl -s our ($cvs); $cvs ||= "/home/jj/cvs"; @ins = grep {/\S/} split(/\s*\n\s*/,qq{ ##proj/dir (install project from local CVS) ##proj/dir/file (install file) ##!proj/dir (install with interaction) ##proj/dir comand for install (install project with strange comand) ##cpan:CGI (cpan CGI) ##From CPAN cpan:YAML cpan:Tk !cpan:Tie::Cvs cpan:Text::Iconv ##local CVS misc/prel misc/mkform misc/mktextrr misc/prel misc/biblio2tex misc/diumthesis misc/klass misc/dicttex misc/mktalk misc/ptc misc/utf8vi !xml/XML-DT HTML/HTML-BoxML ddmf/ddmf smallbook Biblio/Thesaurus Biblio/Thesaurus/examples/t2any Biblio/WebPortal #jspell ...problems with autogen? #ems camila dicionarios/jspell.en !dicionarios/jspell.pt make jspell-install Chronology cwb-utils dag dpl Lingua/TreeBank !Lingua/PT/speaker Mapit musica/chord musica/lyra #mwu-extractor ...problems with autogen? #nllex ...problems with autogen? pibabylon RENA Search-Glimpse Tie/Ispell !Tie/Cvs wmboi xml/tmx xml/XML-XCES }); install({cvs=>$cvs},$_) for(@ins); sub install { my %opt =(cvs => "$ENV{HOME}/cvs"); if(ref($_[0]) eq "HASH") {%opt = (%opt , %{shift(@_)}) } ; my $porig = shift; return if($porig =~ /^#/); my $inter=0; $inter= ($porig =~ s/^!//); my $com = undef; $com = $1 if $porig =~ s/\s+(.*)// ; my $p = "$opt{cvs}/$porig"; print STDERR "[ ] $porig $com\n"; if($com){ d("cd $p; $com",$inter) } elsif($porig =~ s/^cpan://){ d("cpan $porig",$inter) } elsif (-d $p){ if(-f "$p/Makefile.PL"){ d("cd $p; perl Makefile.PL; make test; make install",$inter)} elsif(-f "$p/autogen.sh"){ d("cd $p; chmod +x autogen.sh; ./autogen.sh; make install",$inter) } elsif(-f "$p/makefile" or -f "$p/Makefile"){ d("cd $p; make install",$inter)} } elsif(-x $p){ d("cp -v $p /usr/local/bin",$inter)} elsif($p =~ /([^\/]+).sty/){ my $file = $1; my $dir = d("kpsewhich book.sty",0); $dir =~ s!base/book\.sty!misc/$file! ; mkdir($dir); d("cp -v $p $dir",$inter); } else{ warn("$p not found\n") } ### warn("$!") if $!; } sub d{ my $com=shift; my $i=shift || 0; #print STDERR "...$com\n"; if($i){ system($com) } else {`$com` } # if ($? == -1) { warn("...failed to execute: $!\n"); } # elsif ($? & 127) { warn(sprintf("...died with signal \%d\n", ($? & 127))); } # elsif ($?) { warn ("...child exited with value ". $? >> 8 ,"\n"); } }