Changeset 984 in ProjectBuilder for devel


Ignore:
Timestamp:
Feb 20, 2010, 5:33:25 AM (14 years ago)
Author:
Bruno Cornec
Message:
  • Fix fedora 12: now installing in VE with rpmbootstrap
  • First fully rpmbootstrap working version. Now needs more testing with other fedora versions, and opensuse/mandriva adaptation
Location:
devel
Files:
2 edited

Legend:

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

    r983 r984  
    244244rbsmindep fedora-10 = MAKEDEV,ConsoleKit-libs,audit-libs,basesystem,bash,beecrypt,bzip2-libs,chkconfig,compat-db45,coreutils,cpio,cracklib,cracklib-dicts,crontabs,cyrus-sasl-lib,db4,dbus,dbus-libs,device-mapper,device-mapper-libs,dhclient,dirmngr,e2fsprogs,e2fsprogs-libs,elfutils-libelf,ethtool,expat,fedora-release,fedora-release-notes,file,file-libs,filesystem,findutils,gamin,gawk,gdbm,glib2,glibc,glibc-common,gnupg2,gpgme,grep,info,initscripts,iproute,iputils,keyutils-libs,krb5-libs,libacl,libattr,libcap,libcurl,libgcc,libgcrypt,libgpg-error,libidn,libksba,libselinux,libsepol,libstdc++,libusb,libvolume_id,libxml2,linux-atm-libs,logrotate,lua,mingetty,module-init-tools,ncurses,ncurses-base,ncurses-libs,net-tools,nspr,nss,openldap,openssl,pam,passwd,pcre,pinentry,popt,procps,psmisc,pth,pygpgme,python,python-iniparse,python-libs,python-urlgrabber,readline,rpm,rpm-libs,rpm-python,rsyslog,sed,setup,shadow-utils,sqlite,sysvinit-tools,tzdata,udev,upstart,util-linux-ng,vim-minimal,yum,yum-metadata-parser,zlib
    245245#
    246 rbsmindep fedora-11 = MAKEDEV,ConsoleKit-libs,audit-libs,basesystem,bash,beecrypt,bzip2-libs,chkconfig,compat-db45,coreutils,cpio,cracklib,cracklib-dicts,crontabs,cyrus-sasl-lib,db4,dbus,dbus-libs,device-mapper,device-mapper-libs,dhclient,dirmngr,e2fsprogs,e2fsprogs-libs,elfutils-libelf,ethtool,expat,fedora-release,fedora-release-notes,file,file-libs,filesystem,findutils,gamin,gawk,gdbm,glib2,glibc,glibc-common,gnupg2,gpgme,grep,info,initscripts,iproute,iputils,keyutils-libs,krb5-libs,libacl,libattr,libcap,libcurl,libgcc,libgcrypt,libgpg-error,libidn,libksba,liblzma,libselinux,libsepol,libstdc++,libusb,libvolume_id,libxml2,linux-atm-libs,logrotate,lua,mingetty,module-init-tools,ncurses,ncurses-base,ncurses-libs,net-tools,nspr,nss,openldap,openssl,pam,passwd,pcre,pinentry,popt,procps,psmisc,pth,pygpgme,python,python-iniparse,python-libs,python-urlgrabber,readline,rpm,rpm-libs,rpm-python,rsyslog,sed,setup,shadow-utils,sqlite,sysvinit-tools,tzdata,udev,upstart,util-linux-ng,vim-minimal,yum,yum-metadata-parser,zlib
    247 #
    248 rbsmindep fedora-12 = MAKEDEV,ConsoleKit-libs,audit-libs,basesystem,bash,bzip2-libs,chkconfig,coreutils,cpio,cracklib,cracklib-dicts,crontabs,cyrus-sasl-lib,db4,dbus,dbus-libs,device-mapper,device-mapper-libs,dhclient,dirmngr,e2fsprogs,e2fsprogs-libs,elfutils-libelf,ethtool,expat,fedora-release,fedora-release-notes,file,file-libs,filesystem,findutils,gamin,gawk,gdbm,glib2,glibc,glibc-common,gnupg2,gpgme,grep,info,initscripts,iproute,iputils,keyutils-libs,krb5-libs,libacl,libattr,libcap,libcurl,libgcc,libgcrypt,libgpg-error,libidn,libksba,libselinux,libsepol,libstdc++,libusb,libxml2,linux-atm-libs,logrotate,lua,lzma-libs,mingetty,module-init-tools,ncurses,ncurses-base,ncurses-libs,net-tools,nspr,nss,openldap,openssl,pam,passwd,pcre,pinentry,popt,procps,psmisc,pth,pygpgme,python,python-iniparse,python-libs,python-urlgrabber,readline,rpm,rpm-libs,rpm-python,rsyslog,sed,setup,shadow-utils,sqlite,sysvinit-tools,tzdata,udev,upstart,util-linux-ng,vim-minimal,yum,yum-metadata-parser,zlib
     246rbsmindep fedora-11 = MAKEDEV,ConsoleKit-libs,audit-libs,basesystem,bash,beecrypt,bzip2-libs,chkconfig,compat-db45,coreutils,cpio,cracklib,cracklib-dicts,crontabs,cyrus-sasl-lib,db4,dbus,dbus-libs,device-mapper,device-mapper-libs,dhclient,dirmngr,e2fsprogs,e2fsprogs-libs,elfutils-libelf,ethtool,expat,fedora-release,fedora-release-notes,file,file-libs,filesystem,findutils,gamin,gawk,gdbm,glib2,glibc,glibc-common,gnupg2,gpgme,grep,info,initscripts,iproute,iputils,keyutils-libs,krb5-libs,libacl,libattr,libblkid,libcap,libcom_err,libcurl,libgcc,libgcrypt,libgpg-error,libidn,libksba,libselinux,libsepol,libstdc++,libusb,libvolume_id,libxml2,linux-atm-libs,logrotate,lua,mingetty,module-init-tools,ncurses,ncurses-base,ncurses-libs,net-tools,nspr,nss,openldap,openssl,pam,passwd,pcre,pinentry,popt,procps,psmisc,pth,pygpgme,python,python-iniparse,python-libs,python-pycurl,python-urlgrabber,readline,rpm,rpm-libs,rpm-python,rsyslog,sed,setup,shadow-utils,sqlite,sysvinit-tools,tzdata,udev,upstart,util-linux-ng,vim-minimal,xz-libs,yum,yum-metadata-parser,zlib
     247#
     248rbsmindep fedora-12 = MAKEDEV,ConsoleKit-libs,audit-libs,basesystem,bash,bzip2-libs,chkconfig,coreutils,cpio,cracklib,cracklib-dicts,crontabs,cyrus-sasl-lib,db4,dbus,dbus-libs,device-mapper,device-mapper-libs,dhclient,dirmngr,e2fsprogs,e2fsprogs-libs,elfutils-libelf,ethtool,expat,fedora-release,fedora-release-notes,file,file-libs,filesystem,findutils,gamin,gawk,gdbm,glib2,glibc,glibc-common,gnupg2,gpgme,grep,info,initscripts,iproute,iputils,keyutils-libs,krb5-libs,libacl,libattr,libcap,libcurl,libgcc,libgcrypt,libgpg-error,libidn,libksba,libselinux,libsepol,libssh2,libstdc++,libusb,libxml2,linux-atm-libs,logrotate,lua,mingetty,module-init-tools,ncurses,ncurses-base,ncurses-libs,net-tools,nspr,nss,nss-softokn,nss-softokn-freebl,nss-util,openldap,openssl,pam,passwd,pcre,pinentry,popt,procps,psmisc,pth,pygpgme,python,python-iniparse,python-libs,python-pycurl,python-urlgrabber,readline,rpm,rpm-libs,rpm-python,rsyslog,sed,setup,shadow-utils,sqlite,sysvinit-tools,tzdata,udev,upstart,util-linux-ng,vim-minimal,xz-libs,yum,yum-metadata-parser,zlib
    249249#
    250250rbsmindep centos-4 = MAKEDEV,SysVinit,audit-libs,basesystem,bash,beecrypt,bzip2-libs,centos-release,coreutils,cracklib,cracklib-dicts,db4,device-mapper,e2fsprogs,elfutils-libelf,ethtool,expat,filesystem,findutils,gawk,gdbm,glib2,glibc,glibc-common,grep,info,initscripts,iproute,iputils,krb5-libs,libacl,libattr,libcap,libgcc,libidn,libselinux,libsepol,libstdc++,libsysfs,libtermcap,libxml2,libxml2-python,mcstrans,mingetty,mktemp,module-init-tools,ncurses,neon,net-tools,openssl,pam,pcre,popt,procps,psmisc,python,python-elementtree,python-sqlite,python-urlgrabber,readline,rpm,rpm-libs,rpm-python,sed,setup,shadow-utils,sqlite,sysklogd,termcap,tzdata,udev,util-linux,yum,yum-metadata-parser,zlib
  • devel/rpmbootstrap/bin/rpmbootstrap

    r983 r984  
    1515use English;
    1616use LWP::UserAgent;
    17 #use File::Basename;
    18 #use File::Copy;
     17use File::Basename;
     18use File::Copy;
     19use File::Find;
    1920use ProjectBuilder::Version;
    2021use ProjectBuilder::Base;
     
    8283
    8384Name of the script you want to execute on the related VEs after the installation.
     85It is executed in host environment. You can use the chroot command to execute actions in the VE.
    8486
    8587=item B<-i|--iso iso_image>
     
    138140
    139141pb_syntax_init("$appname Version $projectbuilderver-$projectbuilderrev\n");
     142pb_temp_init();
    140143
    141144GetOptions("help|?|h" => \$opts{'h'},
     
    188191# Initialize distribution info from pb conf file
    189192#
     193pb_log(0,"Starting VE build for $ENV{'PBV'}\n");
    190194my ($name,$ver,$darch) = split(/-/,$ENV{'PBV'});
    191195chomp($darch);
    192 my ($ddir, $dver, $dfam, $dtype, $pbsuf, $dsuf, $dupd) = pb_distro_init($name,$ver,$darch);
     196my ($ddir, $dver, $dfam, $dtype, $pbsuf, $pbupd) = pb_distro_init($name,$ver,$darch);
    193197
    194198#
     
    238242$ua->env_proxy;
    239243
     244pb_log(0,"Downloading package list from $mirror ...\n");
    240245my $response = $ua->get($mirror);
    241246if (! $response->is_success) {
     
    267272}
    268273
     274#
     275# Prepare early the yum cache env for the VE in order to copy in it packages on the fly
     276#
     277if ($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}
    269282
    270283# For each package to process, get it, put it in the cache dir
     
    277290    pb_log(1,"Processing package $p ...\n");
    278291    # Just print packages names if asked so.
    279     if ($opts{'p'}) {
    280         if (defined $url{$p}) {
     292    if (defined $url{$p}) {
     293        if ($opts{'p'}) {
    281294            pb_log(0,"$url{$p}\n");
     295            next;
    282296        } else {
    283             pb_log(0,"WARNING: unable to find URL for $p\n");
    284             $warning++;
    285             $lwpkg .= " $p";
     297            # Now download if not already in cache
     298            my $p1 = basename($url{$p});
     299            if (! -f "$cachedir/$p1") {
     300                pb_system("wget --quiet -O $cachedir/$p1 $url{$p}","Downloading package $p1 ...");
     301            } else {
     302                pb_log(1,"Package $p1 already in cache\n");
     303            }
     304           
     305            # End if download only
     306            if ($opts{'d'}) {
     307                next;
     308            }
     309
     310            #
     311            # Copy the cached .RPM files into the yum directory, so that yum doesn't need to make them again.
     312            #
     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                link("$cachedir/$p1","$vepath/var/cache/yum/$darch/$dver/");
     317                symlink("$vepath/var/cache/yum/core/packages/$p1","$vepath/var/cache/yum/updates-released/packages/");
     318            }
     319
     320            # And extract it to the finale dir
     321            pb_system("cd $vepath ; rpm2cpio $cachedir/$p1 | cpio -ivdum","Extracting package $p1 into $vepath");
     322
     323            # Remove cached package if not asked to keep
     324            if (! $opts{'k'}) {
     325                unlink("$cachedir/$p1");
     326            }
     327
    286328        }
    287         next;
     329    } else {
     330        pb_log(0,"WARNING: unable to find URL for $p\n");
     331        $warning++;
     332        $lwpkg .= " $p";
    288333    }
    289334}
     
    293338}
    294339
    295 # We Just printed packages names so now end
     340# Stop here if we just print
    296341if ($opts{'p'}) {
    297342    exit(0);
    298343}
     344
     345# Now executes the VE finalization steps required for it to work correctly
     346pb_log(0,"VE post configuration\n");
     347
     348# yum needs that distro-release package be installed, so force it
     349
     350foreach 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");
     354}
     355#
     356# Make sure there is a resolv.conf file present, such that DNS lookups succeed.
     357#
     358pb_log(1,"Creating resolv.conf\n");
     359pb_mkdir_p("$vepath/etc");
     360copy("/etc/resolv.conf","$vepath/etc/");
     361
     362#
     363# BUGFIX:
     364#
     365if (($ddir eq "centos") && ($dver eq "5")) {
     366    pb_log(1,"BUGFIX for centos-5\n");
     367    pb_mkdir_p("$vepath/usr/lib/python2.4/site-packages/urlgrabber.skx");
     368    foreach my $i (<$vepath/usr/lib/python2.4/site-packages/urlgrabber/keepalive.*>) {
     369        move($i,"$vepath/usr/lib/python2.4/site-packages/urlgrabber.skx/");
     370    }
     371}
     372
     373#
     374# /proc needed
     375#
     376pb_mkdir_p("$vepath/proc");
     377pb_system("mount -o bind /proc $vepath/proc","Mounting /proc");
     378
     379#
     380# Some devices may be needed
     381#
     382pb_system("mknod -m 644 $vepath/dev/random c 1 8","Creating $vepath/dev/random") if (! -c "$vepath/dev/random");
     383pb_system("mknod -m 644 $vepath/dev/urandom c 1 9","Creating $vepath/dev/urandom") if (! -c "$vepath/dev/urandom");
     384pb_system("mknod -m 666 $vepath/dev/zero c 1 5","Creating $vepath/dev/zero") if (! -c "$vepath/dev/zero");
     385
     386if ($pbupd =~ /yum/) {
     387    #
     388    # Force the architecture for yum
     389    # The goal is to allow i386 chroot on x86_64
     390    #
     391    # FIX: Not sufficient to have yum working
     392    # mirrorlist is not usable
     393    # $releasever also needs to be filtered
     394    # yum.conf as well
     395    foreach my $i (<$vepath/etc/yum.repos.d/*>,"$vepath/etc/yum.conf") {
     396        pb_system("sed -i -e 's/\$basearch/$darch/g' $i","","quiet");
     397        pb_system("sed -i -e 's/\$releasever/$dver/g' $i","","quiet");
     398        pb_system("sed -i -e 's/^mirrorlist/#mirrorlist/' $i","","quiet");
     399        pb_system("sed -i -e 's/^#baseurl/baseurl/' $i","","quiet");
     400    }
     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}
     409
     410#
     411# make 'passwd' work.
     412#
     413pb_log(1,"Authfix\n");
     414pb_system("chroot $vepath /bin/bash -c \"if [ -x /usr/bin/authconfig ]; then /usr/bin/authconfig --enableshadow --update; fi\"","Calling authconfig");
     415
     416#
     417# Clean up
     418#
     419pb_log(1,"Cleaning up\n");
     420if ($pbupd =~ /yum/) {
     421    pb_system("chroot $vepath /usr/bin/yum clean all","Cleaning yum");
     422}
     423pb_system("umount $vepath/proc","Unmounting /proc");
     424find(\&unlink_old_conf, $vepath);
     425
     426# Add additional packages if asked for
     427
     428# Executes post-install step if asked for
     429if ($opts{'s'}) {
     430    pb_system("$opts{'s'} $vepath","Executing the post-install script: $opts{'s'} $vepath");
     431}
     432
     433# Function for File::Find
     434sub unlink_old_conf {
     435
     436    unlink($_) if ($_ =~ /\.rpmorig$/);
     437    unlink($_) if ($_ =~ /\.rpmnew$/);
     438}
     439
     440
Note: See TracChangeset for help on using the changeset viewer.