# -*-Shell-script-*-
#
# Common functions for build scripts used by various packages
-# incorporated (e.g., build, myplc, myplc-devel, vserver-reference)
+# incorporated (e.g., build, bootcd, nodeimage, sliceimage)
#
# Marc E. Fiuczynski <mef@cs.princeton.edu>
# Copyright (C) 2007 The Trustees of Princeton University
return 0
}
-# returns stuff for vserver, i.e. something like 'f8' or 'centos5'
+# returns distro shortname, something like 'f8' or 'centos5'
function pl_getReleaseName () {
distro=$1; shift
release=$1; shift
keyword=$1; shift
fcdistro=$1; shift
pldistro=$1; shift
+ builddir=$1; shift
# search for file "yumexclude.pkgs"
- yumexclude_file=$(pl_locateDistroFile ../build/ $pldistro "yumexclude.pkgs")
+ yumexclude_file=$(pl_locateDistroFile $builddir $pldistro "yumexclude.pkgs")
+ #
+ # check if pkgs.py is in PATH
+ type -p pkgs.py >& /dev/null || export PATH=$builddir:$PATH
+
# parse it
- pl_parsePkgs keyword $fcdistro $pldistro $yumexclude_file || \
+ pl_parsePkgs $keyword $fcdistro $pldistro $yumexclude_file || \
{ echo pl_yumexclude failed with fcdistro=$fcdistro and pldistro=$pldistro; return 1 ; }
}
+# <> fcdistro pldistro builddir
# node side : use the 'nodeyumexclude' keywork in yumexclude.pkgs
function pl_nodeyumexclude () { pl_yumexclude 'nodeyumexclude' "$@" ; }
+# server side : use the 'plcyumexclude' keywork in yumexclude.pkgs
function pl_plcyumexclude () { pl_yumexclude 'plcyumexclude' "$@" ; }
# the release number (plain number)
pl_DISTRO_RELEASE=$(pl_getRelease)
-# the release name - for vserver build ...
+# the release name - something like 'f8' or 'sl6'
pl_DISTRO_NAME=$(pl_getReleaseName $pl_DISTRO $pl_DISTRO_RELEASE)
# get path to appropriate yumgroups.xml file
# For pseudo ttys
mkdir -p $vroot/dev/pts
- # (Might have to remove the following for vserver-reference.)
-
# for tmpfs mount
mkdir -p $vroot/dev/shm
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 vserver.
+ # 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
echo " Defaults are searched in <pldistro>.mirrors"
echo " -v Be verbose"
echo " -h This message"
- echo " target selection (defaults based on current build vserver)"
+ echo " target selection (defaults based on current build VM context)"
echo " -r release Fedora release number (default: $releasever)"
echo " -a arch Fedora architecture (default: $basearch)"
exit 1
# Verbosity
verbose=0
-# Release and architecture to install : defaults to current vserver's settings or previously parsed fedora_options
+# Release and architecture to install : defaults to current vm settings or previously parsed fedora_options
releasever=$pl_DISTRO_RELEASE
basearch=$pl_DISTRO_ARCH
pkgs_precious=$(pl_parsePkgs precious $fcdistro $pldistro $pkgsfile)
# formerly related to mkfedora -k : packages to take from our own build
# and thus need be excluded frem the stock repos
- SUBST_NODEYUMEXCLUDE=$(pl_nodeyumexclude $fcdistro $pldistro)
- pkgs_yumexcludes=$(pl_parsePkgs yumexclude $fcdistro $pldistro $pkgsfile | sed -e s,@NODEYUMEXCLUDE@,"$SUBST_NODEYUMEXCLUDE",)
+ # locate builddir by looking for pkgs.py
+ builddir=$(dirname $(type -p pkgs.py))
+ SUBST_NODEYUMEXCLUDE=$(pl_nodeyumexclude $fcdistro $pldistro $builddir)
+ pkgs_yumexclude=$(pl_parsePkgs yumexclude $fcdistro $pldistro $pkgsfile | sed -e s,@NODEYUMEXCLUDE@,"$SUBST_NODEYUMEXCLUDE",)
# get mirrors if not specified with -l
if [ -z "$mirrors" ] ; then
mirrorsfile=$(pl_locateDistroFile ../build/ $pldistro "$pldistro.mirrors")
fi
yumexclude_line=""
- [ -n "$pkgs_yumexcludes" ] && yumexclude_line="exclude=$pkgs_yumexcludes"
+ [ -n "$pkgs_yumexclude" ] && yumexclude_line="exclude=$pkgs_yumexclude"
echo "$0: candidate mirrors"
for mirror in $mirrors ; do
#
# values can contain @arch@, @fcdistro@ or @pldistro@ that are replaced with the current values
#
-# the reason for the -a option is for when we build the build vserver itself; in this case
+# the reason for the -a option is for when we build the build vm itself; in this case
# pl_DISTRO_ARCH is the one we obtain from the root context, and that's wrong
# specify -sa arch AFTER keyword, so as to keep pl_getPackages and pl_getGroups simple
#