X-Git-Url: http://git.onelab.eu/?a=blobdiff_plain;f=build.common;h=2007f1126bc6e2dcd41909867160d7695ad9b14c;hb=4a63162c62e4ae7d6834b399ec3fd837ab4d9611;hp=9f3adfb796622bf0deb7cc452bc82f80ebe61011;hpb=31a02b8f3144038782ed3fbbb03f0c042612f6ed;p=build.git diff --git a/build.common b/build.common index 9f3adfb7..2007f112 100644 --- a/build.common +++ b/build.common @@ -20,7 +20,7 @@ function pl_getDistro() { case $distro in Scientific*) distro="SL" ; esac elif [ -f /etc/lsb-release ] ; then . /etc/lsb-release - distro=$DISTRIB_CODENAME + distro=$DISTRIB_CODENAME elif [ -f /etc/debian_version ] ; then case $(cat /etc/debian_version) in 7.*) distro=wheezy ;; @@ -65,12 +65,12 @@ function pl_getReleaseName () { [Ss]L*) releasename=sl$release ;; - wheezy|jessie|precise|trusty|utopic|vivid|wily|xenial) + wheezy|jessie|trusty|xenial|bionic) releasename=$distro ;; *) releasename="unknown-name-for-${pl_DISTRO}-please-edit-build.common" - echo 1>&2 "build.common: WARNING - releasename not set for distro=$distro" + echo 1>&2 "build.common: WARNING - releasename not set for distro=$distro" return 1 ;; esac @@ -117,7 +117,7 @@ pl_DISTRO_RELEASE=$(pl_getRelease) pl_DISTRO_NAME=$(pl_getReleaseName $pl_DISTRO $pl_DISTRO_RELEASE) # get path to appropriate yumgroups.xml file -# Thierry: quick & dirty improvement +# Thierry: quick & dirty improvement # this file is updated by the toplevel build, from the .pkgs files pl_DISTRO_YUMGROUPS="../../../RPMS/yumgroups.xml" @@ -166,7 +166,7 @@ function pl_root_makedevs() { vroot=$1 # Clean ${vroot}/dev, but only when ${vroot}!="" [ -n $vroot ] && rm -rf $vroot/dev - + mkdir -p $vroot/dev mknod -m 666 $vroot/dev/null c 1 3 mknod -m 666 $vroot/dev/zero c 1 5 @@ -192,7 +192,7 @@ function pl_root_makedevs() { mknod -m 600 $vroot/dev/net/tun c 10 200 # For mkinitrd (in case a kernel is being installed) - # As well as for loop back mounting within a vm. + # As well as for loop back mounting within a vm. for i in $(seq 0 255) ; do mknod -m 640 $vroot/dev/loop$i b 7 $i done @@ -245,13 +245,13 @@ function pl_root_mkfedora () { # parse pkgsfile and add to local vars fcdistro=${pl_DISTRO_NAME} - pkgs_packages=$(pkgs.py -a $pl_DISTRO_ARCH -f $fcdistro -d $pldistro package $pkgsfile) + pkgs_packages=$(pkgs.py -a $pl_DISTRO_ARCH -f $fcdistro -d $pldistro package $pkgsfile) pkgs_groups=$(pkgs.py -a $pl_DISTRO_ARCH -f $fcdistro -d $pldistro group $pkgsfile) # what can get trashed to save space pkgs_junk=$(pkgs.py -a $pl_DISTRO_ARCH -f $fcdistro -d $pldistro junk $pkgsfile) # but not this pkgs_precious=$(pkgs.py -a $pl_DISTRO_ARCH -f $fcdistro -d $pldistro precious $pkgsfile) - # formerly related to mkfedora -k : packages to take from our own build + # formerly related to mkfedora -k : packages to take from our own build # and thus need be excluded frem the stock repos # locate builddir by looking for pkgs.py builddir=$(dirname $(type -p pkgs.py)) @@ -277,7 +277,7 @@ function pl_root_mkfedora () { if ! yumconf_mirrors $yum_conf_repos ../build/ $fcdistro "$yumexclude_line" $mirrors ; then echo xxx -- error ; return 1 fi - + # Do not tolerate errors set -e @@ -288,7 +288,7 @@ function pl_root_mkfedora () { # you have to use at least one language beside 'C' # Prevent all locales from being installed in reference image mkdir -p $vroot/etc/rpm - pl_root_rpm_macros > $vroot/etc/rpm/macros + pl_root_rpm_macros > $vroot/etc/rpm/macros # Trick rpm and yum, who read the real root /etc/rpm/macros file # rather than the one installed in the reference image, despite what @@ -312,7 +312,7 @@ function pl_root_mkfedora () { mount -t tmpfs none $vroot/dev/shm mkdir -p $vroot/proc mount -t proc none $vroot/proc - + # Create a /var/lib dirs for yum & rpm mkdir -p $vroot/var/lib/yum mkdir -p $vroot/var/lib/rpm @@ -357,7 +357,7 @@ gpgcheck=0 # (e.g., from /etc/yum.repos.d/) reposdir=/dev/null EOF - + cat $yum_conf_repos >> $yum_conf # If we are being built as part of an automated RPM build, solve the @@ -399,7 +399,7 @@ fi if [ -n "$pkgs_packages" ] ; then echo "* Installing optional packages" $pkgs_packages # ignore yum's return code that is basically undefined - echo "* Install options" $vroot $yum_options + echo "* Install options" $vroot $yum_options yum $yum_options install $pkgs_packages || : if ! rpm --root $vroot -q $pkgs_packages >/dev/null ; then echo "* Warning: Missing packages" @@ -411,7 +411,7 @@ fi ## call yum sequentially to get finer-grained info on dependencies for group_plus in $pkgs_groups ; do group=$(echo $group_plus | sed -e "s,+++, ,g") - echo "* Installing optional group $group" + echo "* Installing optional group $group" # ignore yum's return code that is basically undefined yum $yum_options groupinstall "$group" || : done @@ -433,21 +433,21 @@ fi # Clean yum cache echo "* Cleaning up" - # NOTE: this hack is for Fedora >= 12. - # if kernel-debug is installed, clean it up - # we link to our version of kernel/initrd and clean up - # kernel-debug manually - if rpm --root $vroot --quiet -q kernel-debug ; then - echo "* Cleaning up kernel-debug - (workaround for f12)" - pushd $vroot/boot/ - rm -rf kernel-boot kernel-bootsmp initrd-boot initrd-bootsmp - ln -s vmlinuz-*${pldistro}* kernel-boot - ln -s vmlinuz-*${pldistro}* kernel-bootsmp - ln -s initrd-*${pldistro}* initrd-boot - ln -s initrd-*${pldistro}* initrd-bootsmp - rpm --root $vroot --nodeps -e kernel-debug || : - popd - fi +# # NOTE: this hack is for Fedora >= 12. +# # if kernel-debug is installed, clean it up +# # kernel-debug manually +# # we link to our version of kernel/initrd and clean up +# if rpm --root $vroot --quiet -q kernel-debug ; then +# echo "* Cleaning up kernel-debug - (workaround for f12)" +# pushd $vroot/boot/ +# rm -rf kernel-boot kernel-bootsmp initrd-boot initrd-bootsmp +# ln -s vmlinuz-*${pldistro}* kernel-boot +# ln -s vmlinuz-*${pldistro}* kernel-bootsmp +# ln -s initrd-*${pldistro}* initrd-boot +# ln -s initrd-*${pldistro}* initrd-bootsmp +# rpm --root $vroot --nodeps -e kernel-debug || : +# popd +# fi # ignore yum's return code that is basically undefined yum $yum_options clean all || : @@ -476,6 +476,15 @@ fi function pl_root_tune_image () { root=$1; shift + # This tells the Boot Manager that it is okay to update + # /etc/resolv.conf and /etc/hosts whenever the network configuration + # changes. Users are free to delete this file. + touch $root/etc/AUTO_UPDATE_NET_FILES + + # all this sounds terribly old and out of scope + # turning off for fedora31 where it just fails + return 0 + # Disable all services in reference image chroot $root sh -c "/sbin/chkconfig --list | awk '{ print \$1 }' | xargs -i /sbin/chkconfig {} off" @@ -484,10 +493,6 @@ function pl_root_tune_image () { rm -f $root/sbin/minilogd ln -nsf /bin/true $root/sbin/minilogd - # This tells the Boot Manager that it is okay to update - # /etc/resolv.conf and /etc/hosts whenever the network configuration - # changes. Users are free to delete this file. - touch $root/etc/AUTO_UPDATE_NET_FILES } # Move specified directories out of a src tree into a dst tree, and @@ -568,7 +573,7 @@ function pl_parsePkgs () { pldistro=$1; shift echo 1>&2 "pl_parsePkgs: using -a $target_arch -f $fcdistro -d $pldistro $keyword $@" - pkgs.py -a $target_arch -f $fcdistro -d $pldistro $keyword "$@" + pkgs.py -a $target_arch -f $fcdistro -d $pldistro $keyword "$@" } # usage: pl_getPackages [-a arch] fcdistro pldistro pkg-file[..s] function pl_getPackages() { pl_parsePkgs package "$@" ; } @@ -643,7 +648,7 @@ __header echo "Cannot find groupname: and groupdesc: in $pkgsfile -- skipped" 1>&2 continue fi - + cat << __group_header $(echo $groupname|tr A-Z a-z) @@ -652,7 +657,7 @@ __header true __group_header - for package in $packages; do + for package in $packages; do echo "$package" done cat << __group_footer @@ -667,7 +672,7 @@ __footer function build_fetch () { - curl --fail --silent --max-time 60 --output /dev/null "$1" + curl --fail --silent --max-time 60 --output /dev/null "$1" } # tries to compute a valid yum.conf for that pldistro from the template in mirroring/ @@ -681,7 +686,7 @@ function yumconf_mirrors () { mirrors="$@" template=$builddir/mirroring/$fcdistro/yum.repos.d/building.repo.in - + if [ ! -f $template ] ; then echo "yumconf_mirrors: cannot locate template $template" rm -f $dest_yumconf @@ -709,7 +714,7 @@ function yumconf_mirror () { sed -e "s,@MIRRORURL@,$mirror,g" \ -e "/baseurl=/i\\ $yumexclude_line" $template > $dest_yumconf - + # capture all lines defining baseurl baseurl_defs=$(grep '^baseurl=' $dest_yumconf) if [ -z "$baseurl_defs" ] ; then @@ -746,7 +751,7 @@ function yumconf_gpgkey () { function yumconf_exclude () { repo=$1; shift yumexclude_line="$1" ; shift - + sed -i -e "/#baseurl=.*$/i\\ $yumexclude_line" $repo }