# -*-Shell-script-*- # # Common functions for MyPLC build scripts (build_devel.sh and # build.sh) # # Mark Huang # Copyright (C) 2006 The Trustees of Princeton University # # $Id:$ # PATH=/sbin:/bin:/usr/sbin:/usr/bin # In both a normal CVS environment and a PlanetLab RPM # build environment, all of our dependencies are checked out into # directories at the same level as us. if [ -d ../build ] ; then PATH=$PATH:../build srcdir=.. else echo "Error: Could not find $(cd .. && pwd -P)/build/" exit 1 fi export PATH . 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 # 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) pl_setup_chroot $root $packages $groups } # Move specified directories out of the chroot and into a "data" # directory that will be bind mounted on /data inside the chroot. move_datadirs() { root=$1 data=$2 shift 2 pl_move_dirs $root $data /data "$@" } # Make loopback filesystem from specified location make_image() { root=$1 image=$2 pl_make_image $root $image 100000000 }