X-Git-Url: http://git.onelab.eu/?a=blobdiff_plain;f=build.functions;h=a96e295ef66e50612eff65e37cc752acb0c81206;hb=905621647268aaf7bc792dfb6a064f06d3c76ba0;hp=c99941ebf350d63179c973e60a13505a9b925ebc;hpb=7cea0c08274f6bbfd6ab6bb01743072a6caf3046;p=myplc.git diff --git a/build.functions b/build.functions index c99941e..a96e295 100644 --- a/build.functions +++ b/build.functions @@ -6,7 +6,7 @@ # Mark Huang # Copyright (C) 2006 The Trustees of Princeton University # -# $Id: build.functions,v 1.7 2007/08/24 06:46:39 mef Exp $ +# $Id$ # PATH=/sbin:/bin:/usr/sbin:/usr/bin @@ -24,129 +24,59 @@ fi export PATH -# Release and architecture to install -PLC_DEVEL_FEDORA_RELEASE=$([ -f "/etc/fedora-release" ] && awk ' { if ($3=="Core") print $4; else print $3 } ' /etc/fedora-release || echo 4) -PLC_DEVEL_FEDORA_ARCH=$(uname -i) -# Fedora Core mirror from which to install filesystems -# xxx don't set URL... mkfedora will pick up the right thing -#PLC_DEVEL_FEDORA_URL=file:///data/fedora -PLC_DEVEL_FEDORA_URL= +. build.common +pl_process_fedora_options $@ +shiftcount=$? +shift $shiftcount + +# XXX Backwards compatibility with old myplc-devel environment # We may be running inside a myplc-devel environment, which can # override these defaults. if [ -f /etc/planetlab/plc_config ] ; then . /etc/planetlab/plc_config + [ ! -z "$PLC_DEVEL_FEDORA_RELEASE" ] && pl_FEDORA_RELEASE=$PLC_DEVEL_FEDORA_RELEASE + [ ! -z "$PLC_DEVEL_FEDORA_ARCH" ] && pl_FEDORA_ARCH=$PLC_DEVEL_FEDORA_ARCH + [ ! -z "$PLC_DEVEL_FEDORA_URL" ] && pl_FEDORA_URL=$PLC_DEVEL_FEDORA_URL fi -usage() -{ - echo "Usage: $0 [OPTION]..." - echo " -l url Fedora mirror location (default: $PLC_DEVEL_FEDORA_URL)" - echo " -r release Fedora release number (default: $PLC_DEVEL_FEDORA_RELEASE)" - echo " -a arch Fedora architecture (default: $PLC_DEVEL_FEDORA_ARCH)" - echo " -h This message" - exit 1 -} - -# Get options -while getopts "l:r:a:h" opt ; do - case $opt in - l) - PLC_DEVEL_FEDORA_URL=$OPTARG - ;; - r) - PLC_DEVEL_FEDORA_RELEASE=$OPTARG - ;; - a) - PLC_DEVEL_FEDORA_ARCH=$OPTARG - ;; - h|*) - usage - ;; - esac -done - # Do not tolerate errors set -e # Be verbose set -x -# Make a basic chroot at the specified location given the specified -# configuration. -make_chroot() { - root=$1 - config=$2 - - # Get group list - groups= - while read group ; do - groups="$groups -g \"$group\"" - done < <(./plc-config --groups $config) - - # Get package list - packages= - while read package ; do - packages="$packages -p \"$package\"" - done < <(./plc-config --packages $config) - - # Install base system - if [ ! -z "$PLC_DEVEL_FEDORA_URL" ] ; then - eval mkfedora -v -l $PLC_DEVEL_FEDORA_URL -r $PLC_DEVEL_FEDORA_RELEASE -a $PLC_DEVEL_FEDORA_ARCH $packages $groups $root +# this is fragile, as the actual layout may vary from one mirror to the other +# however this should be in line with the layouts obtained +# when running build/vbuild-fedora-mirror.sh + +function yum_conf_to_build_host () { + build_dir=$1; shift + BUILD_HOST=$(hostname) + + cat <