Changeset 427


Ignore:
Timestamp:
May 7, 2008, 5:20:25 PM (11 years ago)
Author:
bruno
Message:

Improve setupv to use pb functions and setup the pb account ssh env correctly now when reusing the VMs

Location:
devel/pb
Files:
2 edited

Legend:

Unmodified
Added
Removed
  • devel/pb/bin/pb

    r423 r427  
    13291329use File::Copy;
    13301330
     1331our $debug;
     1332our $LOG;
     1333our $synmsg = "pbscript";
     1334pb_log_init($debug, $LOG);
     1335pb_temp_init();
     1336
    13311337EOF
    13321338    if ($vtype eq "vm") {
     
    13701376if ( $found == 0 ) {
    13711377    if ( ! -d "/home" ) {
    1372         mkdir "/home";
     1378        pb_mkdir("/home");
    13731379    }
    13741380EOF
    13751381    print SCRIPT << "EOF";
    1376 system "groupadd $pbac->{$ENV{'PBPROJ'}}";
    1377 system "useradd $pbac->{$ENV{'PBPROJ'}} -g $pbac->{$ENV{'PBPROJ'}} -m -d /home/$pbac->{$ENV{'PBPROJ'}}";
     1382pb_system("groupadd $pbac->{$ENV{'PBPROJ'}}","Adding group $pbac->{$ENV{'PBPROJ'}}");
     1383pb_system("useradd $pbac->{$ENV{'PBPROJ'}} -g $pbac->{$ENV{'PBPROJ'}} -m -d /home/$pbac->{$ENV{'PBPROJ'}}","Adding user $pbac->{$ENV{'PBPROJ'}} (group $pbac->{$ENV{'PBPROJ'}} - home /home/$pbac->{$ENV{'PBPROJ'}}");
     1384}
    13781385
    13791386# allow ssh entry to build
    13801387#
    1381 chdir "/home/$pbac->{$ENV{'PBPROJ'}}";
    1382 mkdir ".ssh",0700;
     1388mkdir "/home/$pbac->{$ENV{'PBPROJ'}}/.ssh",0700;
    13831389# Allow those accessing root to access the build account
    1384 copy("\$ENV{'HOME'}/.ssh/authorized_keys",".ssh/authorized_keys");
     1390copy("\$ENV{'HOME'}/.ssh/authorized_keys","/home/$pbac->{$ENV{'PBPROJ'}}/.ssh/authorized_keys");
    13851391chmod 0600,".ssh/authorized_keys";
    1386 system 'chown -R $pbac->{$ENV{'PBPROJ'}}:$pbac->{$ENV{'PBPROJ'}} .ssh';
     1392pb_system("chown -R $pbac->{$ENV{'PBPROJ'}}:$pbac->{$ENV{'PBPROJ'}} /home/$pbac->{$ENV{'PBPROJ'}}/.ssh","Finish setting up the SSH env for $pbac->{$ENV{'PBPROJ'}}");
    13871393
    13881394EOF
    13891395    print SCRIPT << 'EOF';
    1390 }
    1391 
    13921396# No passwd for build account only keys
    13931397$file="/etc/shadow";
     
    14491453#system "/usr/sbin/ntpdate ntp.pool.org";
    14501454
    1451 system "rm -rf perl-ProjectBuilder-* ; wget --passive-ftp ftp://ftp.mondorescue.org/src/perl-ProjectBuilder-latest.tar.gz ; tar xvfz perl-ProjectBuilder-latest.tar.gz ; cd perl-ProjectBuilder-* ; perl Makefile.PL ; make ; make install ; cd .. ; rm -rf perl-ProjectBuilder-* ; rm -rf project-builder-* ; wget --passive-ftp ftp://ftp.mondorescue.org/src/project-builder-latest.tar.gz ; tar xvfz project-builder-latest.tar.gz ; cd project-builder-* ; perl Makefile.PL ; make ; make install ; cd .. ; rm -rf project-builder-* ;";
     1455pb_system("rm -rf perl-ProjectBuilder-* ; wget --passive-ftp ftp://ftp.mondorescue.org/src/perl-ProjectBuilder-latest.tar.gz ; tar xvfz perl-ProjectBuilder-latest.tar.gz ; cd perl-ProjectBuilder-* ; perl Makefile.PL ; make ; make install ; cd .. ; rm -rf perl-ProjectBuilder-* ; rm -rf project-builder-* ; wget --passive-ftp ftp://ftp.mondorescue.org/src/project-builder-latest.tar.gz ; tar xvfz project-builder-latest.tar.gz ; cd project-builder-* ; perl Makefile.PL ; make ; make install ; cd .. ; rm -rf project-builder-* ;","Building Project-Builder");
    14521456system "pb 2>&1 | head -5";
    14531457EOF
    14541458    if ((! $vmexist) && ($vtype eq "vm")) {
    14551459        print SCRIPT << 'EOF';
    1456 system "sudo /sbin/halt -p";
     1460pb_system("sudo /sbin/halt -p","Halting the $vtype");
    14571461EOF
    14581462    }
     
    14651469                open(PBD,"$f") || die "Unable to open $f";
    14661470                while (<PBD>) {
    1467                     next if (/^package/);
    1468                     next if (/^use Exporter/);
    1469                     next if (/^use ProjectBuilder::Base/);
    1470                     next if (/^our \@/);
     1471                        next if (/^package/);
     1472                        next if (/^use Exporter/);
     1473                        next if (/^use ProjectBuilder::/);
     1474                        next if (/^our /);
    14711475                    print SCRIPT $_;
    14721476                }
     
    15001504my $insfm = "rm -rf File-MimeInfo* ; wget http://search.cpan.org/CPAN/authors/id/P/PA/PARDUS/File-MimeInfo/File-MimeInfo-0.15.tar.gz ; tar xvfz File-MimeInfo-0.15.tar.gz ; cd File-MimeInfo* ; perl Makefile.PL ; make ; make install ; cd .. ; rm -rf File-MimeInfo*";
    15011505my $insfb = "rm -rf File-Basedir* ; wget http://search.cpan.org/CPAN/authors/id/P/PA/PARDUS/File-BaseDir-0.03.tar.gz ; tar xvfz File-BaseDir-0.03.tar.gz ; cd File-BaseDir* ; perl Makefile.PL ; make ; make install ; cd .. ; rm -rf File-BaseDir*";
     1506my $cmtdm = "Installing Date-Manip perl module";
     1507my $cmtmb = "Installing Module-Build perl module";
     1508my $cmtfm = "Installing File-MimeInfo perl module";
     1509my $cmtfb = "Installing File-Basedir perl module";
     1510my $cmtall = "Installing required modules";
    15021511
    15031512if ( $ddir eq "fedora" ) {
    1504     system "yum clean all";
     1513    pb_system("yum clean all","Cleaning yum env");
    15051514    #system "yum update -y";
    15061515    my $arch=`uname -m`;
     
    15111520    }
    15121521
    1513     system "yum -y $opt install rpm-build wget patch ntp sudo perl-DateManip perl-File-MimeInfo perl-ExtUtils-MakeMaker";
     1522    pb_system("yum -y $opt install rpm-build wget patch ntp sudo perl-DateManip perl-File-MimeInfo perl-ExtUtils-MakeMaker",$cmtall);
    15141523    if ($dver eq 4) {
    1515         system "$insmb";
    1516         system "$insfm";
    1517         system "$insfb";
     1524        pb_system("$insmb","$cmtmb");
     1525        pb_system("$insfm","$cmtfm");
     1526        pb_system("$insfb","$cmtfb");
    15181527    }
    15191528} elsif (( $dfam eq "rh" ) || ($ddir eq "sles") || (($ddir eq "suse") && (($dver eq "10.1") || ($dver eq "10.0"))) || ($ddir eq "slackware")) {
    15201529    # Suppose pkg are installed already as no online mirror available
    1521     system "rpm -e lsb 2>&1 > /dev/null";
    1522     system "$insdm";
    1523     system "$insmb";
    1524     system "$insfm";
    1525     system "$insfb";
     1530    pb_system("rpm -e lsb 2>&1 > /dev/null","Removing lsb package");
     1531    pb_system("$insdm","$cmtdm");
     1532    pb_system("$insmb","$cmtmb");
     1533    pb_system("$insfm","$cmtfm");
     1534    pb_system("$insfb","$cmtfb");
    15261535} elsif ($ddir eq "suse") {
    15271536    # New OpenSuSE
    1528     system "$insmb";
    1529     system "$insfm";
    1530     system "$insfb";
    1531     system "export TERM=linux ; liste=\"\" ; for i in make wget patch sudo perl-DateManip perl-File-HomeDir xntp; do rpm -q \$i 1> /dev/null 2> /dev/null ; if [ \$\? != 0 ]; then liste=\"\$liste \$i\"; fi; done; echo \"Liste: \$liste\" ; if [ \"\$liste\" != \"\" ]; then yast2 -i \$liste ; fi";
     1537    pb_system("$insmb","$cmtmb");
     1538    pb_system("$insfm","$cmtfm");
     1539    pb_system("$insfb","$cmtfb");
     1540    pb_system("export TERM=linux ; liste=\"\" ; for i in make wget patch sudo perl-DateManip perl-File-HomeDir xntp; do rpm -q \$i 1> /dev/null 2> /dev/null ; if [ \$\? != 0 ]; then liste=\"\$liste \$i\"; fi; done; echo \"Liste: \$liste\" ; if [ \"\$liste\" != \"\" ]; then yast2 -i \$liste ; fi","$cmtall");
    15321541} elsif ( $dfam eq "md" ) {
    1533         system "urpmi.update -a ; urpmi --auto rpm-build wget sudo patch ntp-client perl-File-MimeInfo";
     1542        pb_system("urpmi.update -a ; urpmi --auto rpm-build wget sudo patch ntp-client perl-File-MimeInfo","$cmtall");
    15341543        if (($ddir eq "mandrake") && ($dver eq "10.1")) {
    1535             system "$insdm";
     1544            pb_system("$insdm","$cmtdm");
    15361545        } else {
    1537             system "urpmi --auto perl-DateManip";
     1546            pb_system("urpmi --auto perl-DateManip","$cmtdm");
    15381547        }
    15391548} elsif ( $dfam eq "du" ) {
    15401549    if (( $dver eq "3.1" ) && ($ddir eq "debian")) {
    15411550        #system "apt-get update";
    1542         system "$insfb";
    1543         system "$insfm";
    1544         system "apt-get -y install wget patch ssh sudo debian-builder dh-make fakeroot ntpdate libmodule-build-perl libdate-manip-perl";
     1551        pb_system("$insfb","$cmtfb");
     1552        pb_system("$insfm","$cmtfm");
     1553        pb_system("apt-get -y install wget patch ssh sudo debian-builder dh-make fakeroot ntpdate libmodule-build-perl libdate-manip-perl","$cmtall");
    15451554    } else  {
    1546         system "apt-get update; apt-get -y install wget patch openssh-server dpkg-dev sudo debian-builder dh-make fakeroot ntpdate libfile-mimeinfo-perl libmodule-build-perl libdate-manip-perl";
     1555        pb_system("apt-get update; apt-get -y install wget patch openssh-server dpkg-dev sudo debian-builder dh-make fakeroot ntpdate libfile-mimeinfo-perl libmodule-build-perl libdate-manip-perl","$cmtall");
    15471556    }
    15481557} elsif ( $dfam eq "gen" ) {
    1549         #system "emerge -u system ; emerge wget sudo ntp DateManip File-MimeInfo";
    1550         system "emerge wget sudo ntp DateManip File-MimeInfo";
     1558        #system "emerge -u system";
     1559        pb_system("emerge wget sudo ntp DateManip File-MimeInfo","$cmtall");
    15511560} else {
    15521561    print "No pkg to install\n";
  • devel/pb/lib/ProjectBuilder/Filter.pm

    r417 r427  
    4040
    4141This module provides filtering functions suitable for pbinit calls.
     42
     43=over 4
    4244
    4345=item B<pb_get_filters>
Note: See TracChangeset for help on using the changeset viewer.