repair logic, we were creating lcxroot before checking it was non-existent
[build.git] / build.common
index b292143..7acfbb3 100644 (file)
@@ -7,11 +7,26 @@
 # Copyright (C) 2007 The Trustees of Princeton University
 # Thierry Parmentelat <thierry.parmentelat@inria.fr> INRIA
 #
-# supported distros f8, f12, f14, f16, f18, centos5, sl6
+# supported distros f12 f14 f16 f18 f20 
+# and debians/ubuntus to a lesser extent
 #
 # for locating pkgs.py
 export PATH=.:$PATH
 
+# old guests have e.g. mount in /bin but this is no longer part of 
+# the standard PATH in recent hosts after usrmove, so let's keep it simple
+export PATH=$PATH:/bin:/sbin
+
+# would be much simpler if enter-lxc-namespace was looking along a PATH...
+function bin_in_container () {
+    lxc=$1; shift
+    binary=$1; shift
+    for path in $(echo $PATH | sed -e 's,:, ,g' ); do
+       [ -f /vservers/$lxc/$path/$binary ] && { echo $path/$binary; return; }
+    done
+    echo bin_in_container_cannot_find_$binary
+}
+
 # returns 'Fedora' or 'CentOS' for now
 function pl_getDistro() {
     if [ -f "/etc/redhat-release" ] ; then
@@ -22,8 +37,8 @@ function pl_getDistro() {
        echo $DISTRIB_CODENAME 
     elif [ -f /etc/debian_version ] ; then
        case $(cat /etc/debian_version) in
-           6.0.6) distro=squeeze ;;
-           7.0)   distro=wheezy  ;;
+           6.*) distro=squeeze ;;
+           7.*)   distro=wheezy  ;;
            *)     distro=unknown.debian.in.build.common ;;
        esac
     fi
@@ -63,7 +78,7 @@ function pl_getReleaseName () {
        [Ss]L*)
            releasename=sl$release
            ;;
-       squeeze|wheezy|oneiric|precise|quantal)
+       squeeze|wheezy|oneiric|precise|quantal|raring|saucy)
            releasename=$distro
            ;;
        *)