Changeset 990


Ignore:
Timestamp:
02/24/10 07:03:55 (3 years ago)
Author:
bruno
Message:

r3709@localhost: bruno | 2010-02-22 22:05:32 +0100

  • First addition of OpenSUSE support in rpmbootstrap
Location:
devel
Files:
2 edited

Legend:

Unmodified
Added
Removed
  • devel/pb-modules/etc/pb.conf

    r986 r990  
    195195osupd md = sudo urpmi.update -a ; sudo urpmi --auto  
    196196osupd novell = export TERM=linux ; export PATH=\$PATH:/sbin:/usr/sbin ; sudo yast2 -i  
     197osupd opensuse-10.2 = sudo yes | zypper install 
    197198osupd opensuse = sudo zypper -n install 
    198199osupd sol = sudo pkgadd -d 
  • devel/rpmbootstrap/bin/rpmbootstrap

    r986 r990  
    275275# Prepare early the yum cache env for the VE in order to copy in it packages on the fly 
    276276# 
     277my $oscachedir = "/tmp"; 
     278my $osupdcachedir; 
     279my $osupdname = ""; 
     280 
     281pb_log(1,"Setting up $osupdname cache in VE\n"); 
    277282if ($pbupd =~ /yum/) { 
    278     pb_log(1,"Setting up YUM cache in VE\n"); 
    279     pb_mkdir_p("$vepath/var/cache/yum/core/packages/"); 
    280     pb_mkdir_p("$vepath/var/cache/yum/updates-released/packages/"); 
    281 } 
     283    $oscachedir = "$vepath/var/cache/yum/core/packages/"; 
     284    $osupdcachedir = "$vepath/var/cache/yum/updates-released/packages/"; 
     285    $osupdname = "YUM"; 
     286    # Recent Fedora release use a new yum cache dir 
     287    if (($ddir eq "fedora") && ($dver > 8)) { 
     288        $oscachedir = "$vepath/var/cache/yum/$darch/$dver/fedora/packages"; 
     289        $osupdcachedir = "$vepath/var/cache/yum/$darch/$dver/updates/packages"; 
     290        $osupdcachedir = "$vepath/var/cache/yum/updates-released/packages/"; 
     291    } 
     292} elsif ($pbupd =~ /zypper/) { 
     293    pb_log(1,"Setting up Zypper cache in VE\n"); 
     294    $oscachedir = "$vepath/var/cache/zypp/packages/opensuse/suse/$darch"; 
     295    $osupdname = "Zypper"; 
     296} 
     297pb_mkdir_p($oscachedir); 
     298pb_mkdir_p($osupdcachedir) if (defined $osupdcachedir); 
    282299 
    283300# For each package to process, get it, put it in the cache dir  
     
    309326 
    310327            # 
    311             # Copy the cached .RPM files into the yum directory, so that yum doesn't need to make them again. 
     328            # Copy the cached .RPM files into the oscachedir directory, so that os doesn't need to download them again. 
    312329            # 
    313             if ($pbupd =~ /yum/) { 
    314                 pb_log(1,"Link package into $vepath/var/cache/yum/core/packages\n"); 
    315                 #link("$cachedir/$p1","$vepath/var/cache/yum/core/packages/"); 
    316                 copy("$cachedir/$p1","$vepath/var/cache/yum/$darch/$dver/fedora/packages"); 
    317                 symlink("$vepath/var/cache/yum/$darch/$dver/fedora/packages","$vepath/var/cache/yum/$darch/$dver/updates/packages"); 
    318             } 
     330            pb_log(1,"Link package into $oscachedir\n"); 
     331            copy("$cachedir/$p1",$oscachedir) if (defined $oscachedir); 
     332            symlink("$oscachedir/$p1","$osupdcachedir/p1") if (defined $osupdcachedir); 
    319333 
    320334            # And extract it to the finale dir 
     
    347361 
    348362# yum needs that distro-release package be installed, so force it 
    349  
    350 foreach my $p1 (<$cachedir/($ddir|redhat)-release-*.rpm>) { 
    351     copy("$cachedir/$p1","$vepath/tmp"); 
    352     pb_system("chroot $vepath rpm -ivh --force --nodeps /tmp/$p1","Forcing RPM installation of $p1"); 
    353     unlink("$vepath/tmp/$p1"); 
     363if ($pbupd =~ /yum/) { 
     364    foreach my $p1 (<$cachedir/($ddir|redhat)-release-*.rpm>) { 
     365        copy("$cachedir/$p1","$vepath/tmp"); 
     366        pb_system("chroot $vepath rpm -ivh --force --nodeps /tmp/$p1","Forcing RPM installation of $p1"); 
     367        unlink("$vepath/tmp/$p1"); 
     368    } 
    354369} 
    355370# 
     
    363378# BUGFIX: 
    364379# 
    365 if (($ddir eq "centos") && ($dver eq "5")) { 
     380if ((($ddir eq "centos") || ($ddir eq "rhel")) && ($dver eq "5")) { 
    366381    pb_log(1,"BUGFIX for centos-5\n"); 
    367382    pb_mkdir_p("$vepath/usr/lib/python2.4/site-packages/urlgrabber.skx"); 
     
    384399pb_system("mknod -m 666 $vepath/dev/zero c 1 5","Creating $vepath/dev/zero") if (! -c "$vepath/dev/zero"); 
    385400 
     401my $minipkglist; 
     402 
     403pb_log(1,"Adapting $osupdname repository entries"); 
    386404if ($pbupd =~ /yum/) { 
    387405    # 
     
    399417        pb_system("sed -i -e 's/^#baseurl/baseurl/' $i","","quiet"); 
    400418    } 
    401  
    402     # 
    403     # Run "yum install the necessary modules". 
    404     # No need for sudo here 
    405     # 
    406     $pbupd =~ s/sudo//g; 
    407     pb_system("chroot $vepath /bin/bash -c \"$pbupd ldconfig yum passwd vim-minimal dhclient authconfig\"","Bootstrapping yum"); 
    408 } 
     419    $minipkglist = "ldconfig yum passwd vim-minimal dhclient authconfig"; 
     420} elsif ($pbupd =~ /zypper/) { 
     421    pb_mkdir_p("$vepath/etc/zypp/repos.d"); 
     422    open(REPO,"> $vepath/etc/zypp/repos.d/$ddir-$dver") || die "Unable to create repo file"; 
     423    my $baseurl = dirname(dirname($mirror)); 
     424    print REPO << 'EOF'; 
     425[opensuse] 
     426name=$ddir-$dver 
     427baseurl=$baseurl 
     428enabled=1 
     429gpgcheck=1 
     430 
     431EOF 
     432    $minipkglist = "zypper vim-minimal dhclient"; 
     433    # Bootstraping zypper 
     434    if ($dver eq "10.2") { 
     435        pb_system("chroot $vepath /bin/bash -c \"yes | /usr/bin/zypper sa $baseurl $ddir-$dver\"","Bootstrapping Zypper"); 
     436    } 
     437} 
     438 
     439# 
     440# Run "install the necessary modules". 
     441# No need for sudo here 
     442# 
     443$pbupd =~ s/sudo//g; 
     444pb_system("chroot $vepath /bin/bash -c \"$pbupd $minipkglist \"","Bootstrapping OS by running $pbupd $minipkglist"); 
    409445 
    410446# 
Note: See TracChangeset for help on using the changeset viewer.