Whamcloud - gitweb
LU-4199 libcfs: add CPU table functions for uniprocessor
[fs/lustre-release.git] / contrib / lbuild / funcs.sh
index 53854f7..c369453 100644 (file)
@@ -134,11 +134,9 @@ autodetect_distro() {
         case "$name" in
             "EnterpriseEnterpriseServer")
                 name="oel"
-                version="${version%%.*}"
                 ;;
             "RedHatEnterpriseServer" | "ScientificSL" | "CentOS")
                 name="rhel"
-                version="${version%%.*}"
                 ;;
             "SUSE LINUX")
                 name="sles"
@@ -161,14 +159,14 @@ autodetect_distro() {
             #name=$(head -1 /etc/redhat-release)
             name=rhel
             version=$(echo "$distroname" |
-                      sed -e 's/^[^0-9.]*//g' | sed -e 's/[ \.].*//')
+                      sed -e 's/^[^0-9.]*//g' | sed -e 's/[ ].*//')
         fi
         if [ -z "$name" -o -z "$version" ]; then
             fatal 1 "I don't know how to determine distro type/version.\nEither update autodetect_distro() or use the --distro argument."
         fi
     fi
 
-    echo ${name}${version}
+    echo ${name}-${version}
     return 0
 
 }
@@ -183,7 +181,13 @@ autodetect_target() {
          rhel5) target="2.6-rhel5";;
          rhel6) target="2.6-rhel6";;
         sles10) target="2.6-sles10";;
-        sles11) target="$(uname -r | cut -d . -f 1,2)-sles11";;
+        sles11) target="$(uname -r | cut -d . -f 1,2)-sles11"
+               local PLEV=$(grep PATCHLEVEL /etc/SuSE-release | \
+                            sed -e 's/.*= *//')
+               if [ "$PLEV" = "3" ]; then
+                       target=${target}sp3
+               fi
+               ;;
           fc15) target="2.6-fc15";;
           fc18) target="3.x-fc18";;
             *) fatal 1 "I don't know what distro $distro is.\nEither update autodetect_target() or use the --target argument.";;