Changeset 1812 in ProjectBuilder for devel/rpmbootstrap


Ignore:
Timestamp:
Jan 2, 2014, 12:15:42 PM (10 years ago)
Author:
Bruno Cornec
Message:
  • Improve fedora rpmbootstrap VE (still need now correct deps list)
File:
1 edited

Legend:

Unmodified
Added
Removed
  • devel/rpmbootstrap/bin/rpmbootstrap

    r1802 r1812  
    303303# Get the list of packages and their URL in this hash
    304304my %url;
     305my %done;
    305306foreach my $l (@list_pkg) {
    306307    my ($url,$desc) = rbs_find_pkg($l,$parch,"pkg");
     
    309310    } else {
    310311        pb_log(3,"not a package, maybe a dir containing packages\n");
    311         my $response1 = $ua->get("$mirror/Packages");
    312         # Check if we have a fedora 17/18 type of repo
    313         if ($response1->is_success) {
    314             foreach my $d (split(/\n/,$response1->as_string())) {
    315                 ($url,$desc) = rbs_find_pkg($d,$parch,"dir");
    316                 if (defined $url) {
    317                     # Here we have the dir in which are packages
    318                     my $response2 = $ua->get("$mirror/Packages/$desc");
    319                     foreach my $p (split(/\n/,$response2->as_string())) {
    320                         ($url,$desc) = rbs_find_pkg($d,$parch,"dir");
    321                         if (defined $url) {
    322                             $url{$p} = "$mirror/$desc";
    323                         } else {
    324                             pb_log(3,"not a package, and not a dir containing packages\n");
    325                         }
     312        ($url,$desc) = rbs_find_pkg($l,$parch,"dir");
     313        if ((defined $desc) and (not defined $done{$desc})) {
     314            my $response1 = $ua->get("$mirror/$desc");
     315            # Check if we have a fedora 17/18 type of repo
     316            if ($response1->is_success) {
     317                $done{$desc} = "true";
     318                foreach my $d (split(/\n/,$response1->as_string())) {
     319                    my ($url2,$desc2) = rbs_find_pkg($d,$parch,"pkg");
     320                    if (defined $url2) {
     321                        # Here we have the dir in which are packages
     322                        $url{$url2} = "$mirror/$desc/$desc2";
     323                    } else {
     324                        pb_log(3,"not a package, and not a dir containing packages\n");
    326325                    }
    327                 } else {
    328326                }
     327            } else {
    329328            }
    330         } else {
    331329        }
    332330    }
     
    477475pb_system("mknod -m 666 $vepath/dev/null c 1 3","Creating $vepath/dev/null") if (! -c "$vepath/dev/null");
    478476
     477# Where is bash
     478my $bash = "/usr/bin/bash";
     479if (! -x "$vepath/$bash" ) {
     480    $bash = "/bin/bash";
     481    if (! -x "$vepath/$bash" ) {
     482        die "No bash found in usual places. Please report to dev team";
     483    }
     484}
     485   
     486
    479487my $minipkglist;
    480488
     
    503511    # Setup the repo
    504512    if ($pbos->{'version'} eq "10.2") {
    505         pb_system("chroot $vepath /bin/bash -c \"yes | /usr/bin/zypper sa $baseurl $pbos->{'name'}-$pbos->{'version'}\"","Bootstrapping Zypper");
     513        pb_system("chroot $vepath $bash -c \"yes | /usr/bin/zypper sa $baseurl $pbos->{'name'}-$pbos->{'version'}\"","Bootstrapping Zypper");
    506514    } else {
    507515        # don't care if remove fails if add succeeds.
    508         pb_system("chroot $vepath /bin/bash -c \"/usr/bin/zypper rr $pbos->{'name'}-$pbos->{'version'}\"","Bootstrapping Zypper","mayfail");
    509         pb_system("chroot $vepath /bin/bash -c \"/usr/bin/zypper ar $baseurl $pbos->{'name'}-$pbos->{'version'}\"","Bootstrapping Zypper");
     516        pb_system("chroot $vepath $bash -c \"/usr/bin/zypper rr $pbos->{'name'}-$pbos->{'version'}\"","Bootstrapping Zypper","mayfail");
     517        pb_system("chroot $vepath $bash -c \"/usr/bin/zypper ar $baseurl $pbos->{'name'}-$pbos->{'version'}\"","Bootstrapping Zypper");
    510518    }
    511519    #print REPO << "EOF";
     
    523531    # Setup the repo
    524532    my $baseurl = dirname(dirname(dirname($mirror)));
    525     pb_system("chroot $vepath /bin/bash -c \"urpmi.addmedia --distrib $baseurl\"","Bootstrapping URPMI");
     533    pb_system("chroot $vepath $bash -c \"urpmi.addmedia --distrib $baseurl\"","Bootstrapping URPMI");
    526534    # TODO here too ?
    527535    $minipkglist = "ldconfig urpmi passwd vim-minimal dhcp-client";
     
    560568
    561569# Keep redhat variants from destroying nis domain on install
    562 #pb_system("chroot $vepath /bin/bash -e -c \"ln -snf /bin/true /bin/domainname\"");
     570#pb_system("chroot $vepath $bash -e -c \"ln -snf /bin/true /bin/domainname\"");
    563571
    564572#if ($pbos->{'name'} =~ /fedora/i) { # hack to prevent fedora from destroying NIS settings on host
     
    567575#   close(AUTH);
    568576#}
    569 pb_system("chroot $vepath /bin/bash -c \"$pbos->{'install'} $minipkglist \"","Bootstrapping OS by running $pbos->{'install'} $minipkglist");
     577pb_system("chroot $vepath $bash -c \"$pbos->{'install'} $minipkglist \"","Bootstrapping OS by running $pbos->{'install'} $minipkglist");
    570578
    571579# CentOS6 will replace the yum.repos.d files; oddly it will leave the yum.conf file alone and make the new one ".rpmnew"
     
    585593# TODO: Not generic enough to be done like that IMHO
    586594# In case it was changed during the install
    587 #pb_system("chroot $vepath /bin/bash -e -c \"ln -snf /bin/true /bin/domainname\"");
    588 pb_system("chroot $vepath /bin/bash -c \"if [ -x /usr/bin/authconfig ]; then /usr/bin/authconfig --enableshadow --update --nostart; fi\"","Calling authconfig");
     595#pb_system("chroot $vepath $bash -e -c \"ln -snf /bin/true /bin/domainname\"");
     596pb_system("chroot $vepath $bash -c \"if [ -x /usr/bin/authconfig ]; then /usr/bin/authconfig --enableshadow --update --nostart; fi\"","Calling authconfig");
    589597
    590598# Installed additional packages we were asked to
    591599if (defined $opts{'a'}) {
    592600    $opts{'a'} =~ s/,/ /g;
    593     pb_system("chroot $vepath /bin/bash -c \"$pbos->{'install'} $opts{'a'} \"","Adding packages to OS by running $pbos->{'install'} $opts{'a'}");
     601    pb_system("chroot $vepath $bash -c \"$pbos->{'install'} $opts{'a'} \"","Adding packages to OS by running $pbos->{'install'} $opts{'a'}");
    594602}
    595603
Note: See TracChangeset for help on using the changeset viewer.