[Date Prev][Date Next] [Thread Prev][Thread Next] [Date Index] [Thread Index]

r4782 - glibc-package/trunk/debian/debhelper.in



Author: aurel32
Date: 2011-07-03 17:44:36 +0000 (Sun, 03 Jul 2011)
New Revision: 4782

Modified:
   glibc-package/trunk/debian/debhelper.in/libc.preinst
Log:
libc.preinst: fix indentation, always run LD_LIBRARY_PATH check


Modified: glibc-package/trunk/debian/debhelper.in/libc.preinst
===================================================================
--- glibc-package/trunk/debian/debhelper.in/libc.preinst	2011-07-03 17:37:56 UTC (rev 4781)
+++ glibc-package/trunk/debian/debhelper.in/libc.preinst	2011-07-03 17:44:36 UTC (rev 4782)
@@ -55,67 +55,67 @@
 # with different sonames, and libraries incompatible with the 
 # to-be-installed ld.so.
 check_dir () {
-  msg=$1
-  dir=$2
+    msg=$1
+    dir=$2
 
-  # Follow symlinks
-  dir=$(readlink -e $dir || true)
+    # Follow symlinks
+    dir=$(readlink -e $dir || true)
 
-  # Ignore inexistent directories
-  if ! test -d "$dir" ; then
-    return
-  fi
+    # Ignore inexistent directories
+    if ! test -d "$dir" ; then
+        return
+    fi
   
-  # Detect possible candidates
-  files=$(ls $dir | egrep '^(ld|lib(d|c|m|pthread|rt|dl))-2.*.so' 2>/dev/null || true)
-  if test -z "$files" ; then
-    return
-  fi
+    # Detect possible candidates
+    files=$(ls $dir | egrep '^(ld|lib(d|c|m|pthread|rt|dl))-2.*.so' 2>/dev/null || true)
+    if test -z "$files" ; then
+        return
+    fi
   
-  for file in $files ; do
-    lib=$dir/$file
+    for file in $files ; do
+        lib=$dir/$file
 
-    # Skip if it is a symlink (as installed by lsb-core)
-    if test -L "$lib" ; then
-      continue
-    fi
+        # Skip if it is a symlink (as installed by lsb-core)
+        if test -L "$lib" ; then
+            continue
+        fi
 
-    # Skip if it is the currently dynamic loader
-    if test "$lib" = "$ldfile" ; then
-      continue
-    fi
+        # Skip if it is the currently dynamic loader
+        if test "$lib" = "$ldfile" ; then
+            continue
+        fi
 
-    # See if the found libraries are compatible with the system ld.so;
-    # if they aren't, they'll be ignored. Check e_ident, e_type (which
-    # will just be ET_DYN), and e_machine. If a match is found, there
-    # is a risk of breakage.
-    libbytes=`head -c 20 $lib | od -c`
-    if test "$ldbytes" != "$libbytes" ; then 
-      continue
-    fi
+        # See if the found libraries are compatible with the system ld.so;
+        # if they aren't, they'll be ignored. Check e_ident, e_type (which
+        # will just be ET_DYN), and e_machine. If a match is found, there
+        # is a risk of breakage.
+        libbytes=`head -c 20 $lib | od -c`
+        if test "$ldbytes" != "$libbytes" ; then 
+          continue
+        fi
 
-    # Binaries owned packages are considered to do the right thing
-    # First try a quick lookup which should catch all cases on a 
-    # normal system
-    if echo $libcfiles | grep -q "[ ^]$lib[ $]" ; then 
-      continue
-    fi
+        # Binaries owned packages are considered to do the right thing
+        # First try a quick lookup which should catch all cases on a 
+        # normal system
+        if echo $libcfiles | grep -q "[ ^]$lib[ $]" ; then 
+            continue
+        fi
 
-    # Slower lookup to confirm
-    if dpkg-query -S "$lib" >/dev/null 2>&1 ; then
-      continue
-    fi
+        # Slower lookup to confirm
+        if dpkg-query -S "$lib" >/dev/null 2>&1 ; then
+            continue
+        fi
 
-    # Output an error message and exit
-    echo
-    echo "A copy of the C library was found $msg:"
-    echo "  '$lib'"
-    echo "It is not safe to upgrade the C library in this situation;"
-    echo "please remove that copy of the C library or get it out of"
-    echo "'$dir' and try again."
-    echo
-    exit 1
-  done
+        # Output an error message and exit
+        echo
+        echo "A copy of the C library was found $msg:"
+        echo "  '$lib'"
+        echo "It is not safe to upgrade the C library in this situation;"
+        echo "please remove that copy of the C library or get it out of"
+        echo "'$dir' and try again."
+        echo
+        exit 1
+    done
 }
 
 if [ "$type" = upgrade ]
@@ -218,167 +218,167 @@
     # upgrade.
     touch /etc/ld.so.nohwcap
 
-  # See if LD_LIBRARY_PATH contains the traditional /lib, but not the
-  # multiarch path
-  dirs=$(echo $LD_LIBRARY_PATH | sed 's/:/ /g')
-  for dir in $dirs ; do
-    dir=$(readlink -e $dir || true)
-    case "$dir" in
-    /lib)
-      seen_traditional=1
-      ;;
-    SLIBDIR)
-      seen_multiarch=1
-      ;;
-    esac
-  done
-  if test -n "$seen_traditional" && test -z "$seen_multiarch" ; then
-    echo
-    echo "LD_LIBRARY_PATH contains the traditional /lib directory,"
-    echo "but not the multiarch directory SLIBDIR."
-    echo "It is not safe to upgrade the C library in this situation;"
-    echo "please remove the /lib/directory from LD_LIBRARY_PATH and" 
-    echo "try again."
-    echo
-    exit 1
-  fi
+    # Try to detect copies of the libc library in the various places
+    # the dynamic linker uses.
+    ldfile=$(readlink -e RTLD_SO)
+    ldbytes=$(head -c 20 RTLD_SO | od -c)
+    libcfiles=$(dpkg-query -L LIBC 2>/dev/null)
 
-  # Try to detect copies of the libc library in the various places
-  # the dynamic linker uses.
-  ldfile=$(readlink -e RTLD_SO)
-  ldbytes=$(head -c 20 RTLD_SO | od -c)
-  libcfiles=$(dpkg-query -L LIBC 2>/dev/null)
-
-  dirs="SLIBDIR /lib /lib/tls /lib32 /lib64 /usr/local/lib /usr/local/lib32 /usr/local/lib64"
-  for dir in $dirs ; do
-    check_dir "in an unexpected directory" $dir
-  done
-
-  if test -n "$LD_LIBRARY_PATH"; then
-    dirs=$(echo $LD_LIBRARY_PATH | sed 's/:/ /g')
+    dirs="SLIBDIR /lib /lib/tls /lib32 /lib64 /usr/local/lib /usr/local/lib32 /usr/local/lib64"
     for dir in $dirs ; do
-      check_dir "via LD_LIBRARY_PATH" $dir
+        check_dir "in an unexpected directory" $dir
     done
-  fi
 
-  if test -e /etc/ld.so.conf; then
-    dirs=$(echo $(cat /etc/ld.so.conf))
-    if test -n "$dirs" ; then
-      for dir in $dirs ; do
-        check_dir "via /etc/ld.so.conf" $dir
-      done
+    if test -n "$LD_LIBRARY_PATH"; then
+        dirs=$(echo $LD_LIBRARY_PATH | sed 's/:/ /g')
+        for dir in $dirs ; do
+            check_dir "via LD_LIBRARY_PATH" $dir
+        done
     fi
-  fi
 
-  if [ -e /lib/tls/i686/cmov/libc.so.6 ] || [ -e /lib/i686/cmov/libc.so.6 ] ; then
-    status_i686=$(dpkg -s libc6-i686 2>/dev/null | grep ^Status: | sed -e 's/^Status: \(.*\) \(.*\) \(.*\)/\3/g')
-    status_xen=$(dpkg -s libc6-xen 2>/dev/null | grep ^Status: | sed -e 's/^Status: \(.*\) \(.*\) \(.*\)/\3/g')
-    if ([ -z "$status_i686" ] || [ "$status_i686" = "not-installed" ] || [ "$status_i686" = "config-files" ]) && \
-       ([ -z "$status_xen" ] || [ "$status_xen" = "not-installed" ] || [ "$status_xen" = "config-files" ]); then
-      echo
-      echo "A non-dpkg owned copy of the libc6-i686 package was found."
-      echo "It is not safe to upgrade the C library in this situation;"
-      echo "please remove that copy of the C library and try again."
-      echo
-      exit 1
+    if test -e /etc/ld.so.conf; then
+        dirs=$(echo $(cat /etc/ld.so.conf))
+        if test -n "$dirs" ; then
+            for dir in $dirs ; do
+                check_dir "via /etc/ld.so.conf" $dir
+            done
+        fi
     fi
-  fi
 
-  if [ -n "$LD_ASSUME_KERNEL" ] ; then
-    if dpkg --compare-versions "$LD_ASSUME_KERNEL" le "2.6.1"; then
-      echo
-      echo "POSIX threads library NPTL requires kernel version 2.6.1"
-      echo "or later.  It appears that LD_ASSUME_KERNEL is set to $LD_ASSUME_KERNEL."
-      echo "It is not safe to upgrade the C library in this situation;"
-      echo "Please unset this environment variable and try again."
-      echo
-      exit 1
+    if [ -e /lib/tls/i686/cmov/libc.so.6 ] || [ -e /lib/i686/cmov/libc.so.6 ] ; then
+        status_i686=$(dpkg -s libc6-i686 2>/dev/null | grep ^Status: | sed -e 's/^Status: \(.*\) \(.*\) \(.*\)/\3/g')
+        status_xen=$(dpkg -s libc6-xen 2>/dev/null | grep ^Status: | sed -e 's/^Status: \(.*\) \(.*\) \(.*\)/\3/g')
+        if ([ -z "$status_i686" ] || [ "$status_i686" = "not-installed" ] || [ "$status_i686" = "config-files" ]) && \
+             ([ -z "$status_xen" ] || [ "$status_xen" = "not-installed" ] || [ "$status_xen" = "config-files" ]); then
+            echo
+            echo "A non-dpkg owned copy of the libc6-i686 package was found."
+            echo "It is not safe to upgrade the C library in this situation;"
+            echo "please remove that copy of the C library and try again."
+            echo
+            exit 1
+        fi
     fi
-  fi
 fi
 
 if [ "$type" != abort-upgrade ]
 then
-  # glibc kernel version check
-  system=`uname -s`
-  if [ "$system" = "Linux" ]
-  then
-      # Test to make sure z < 255, in x.y.z-n form of kernel version
-      # Also make sure we don't trip on x.y.zFOO-n form
-      kernel_rev=$(uname -r | sed 's/\([0-9]*\.\)\{1,2\}\([0-9]*\)\(.*\)/\2/')
-      if [ "$kernel_rev" -ge 255 ]
-      then
-          echo "WARNING: Your kernel version indicates a revision number"
-          echo "of 255 or greater.  Glibc has a number of built in"
-          echo "assumptions that this revision number is less than 255."
-          echo "If you\'ve built your own kernel, please make sure that any"
-          echo "custom version numbers are appended to the upstream"
-          echo "kernel number with a dash or some other delimiter."
+    # See if LD_LIBRARY_PATH contains the traditional /lib, but not the
+    # multiarch path
+    dirs=$(echo $LD_LIBRARY_PATH | sed 's/:/ /g')
+    for dir in $dirs ; do
+        dir=$(readlink -e $dir || true)
+        case "$dir" in
+        /lib)
+            seen_traditional=1
+            ;;
+        SLIBDIR)
+            seen_multiarch=1
+            ;;
+        esac
+    done
+    if test -n "$seen_traditional" && test -z "$seen_multiarch" ; then
+        echo
+        echo "LD_LIBRARY_PATH contains the traditional /lib directory,"
+        echo "but not the multiarch directory SLIBDIR."
+        echo "It is not safe to upgrade the C library in this situation;"
+        echo "please remove the /lib/directory from LD_LIBRARY_PATH and" 
+        echo "try again."
+        echo
+        exit 1
+    fi
 
-          exit 1
-      fi
+    if [ -n "$LD_ASSUME_KERNEL" ] ; then
+        if dpkg --compare-versions "$LD_ASSUME_KERNEL" le "2.6.1"; then
+           echo
+           echo "POSIX threads library NPTL requires kernel version 2.6.1"
+           echo "or later.  It appears that LD_ASSUME_KERNEL is set to $LD_ASSUME_KERNEL."
+           echo "It is not safe to upgrade the C library in this situation;"
+           echo "Please unset this environment variable and try again."
+           echo
+           exit 1
+       fi
+    fi
 
-      # sanity checking for the appropriate kernel on each architecture.
-      realarch=`uname -m`
-      kernel_ver=`uname -r`
+    # glibc kernel version check
+    system=`uname -s`
+    if [ "$system" = "Linux" ]
+    then
+        # Test to make sure z < 255, in x.y.z-n form of kernel version
+        # Also make sure we don't trip on x.y.zFOO-n form
+        kernel_rev=$(uname -r | sed 's/\([0-9]*\.\)\{1,2\}\([0-9]*\)\(.*\)/\2/')
+        if [ "$kernel_rev" -ge 255 ]
+        then
+            echo "WARNING: Your kernel version indicates a revision number"
+            echo "of 255 or greater.  Glibc has a number of built in"
+            echo "assumptions that this revision number is less than 255."
+            echo "If you\'ve built your own kernel, please make sure that any"
+            echo "custom version numbers are appended to the upstream"
+            echo "kernel number with a dash or some other delimiter."
+            echo
+            exit 1
+        fi
 
-      # convert "armv4l" and similar to just "arm", and "mips64" and similar
-      # to just "mips"
-      case $realarch in
-        arm*) realarch="arm";;
-        mips*) realarch="mips";;
-      esac
+        # sanity checking for the appropriate kernel on each architecture.
+        realarch=`uname -m`
+        kernel_ver=`uname -r`
 
-      # The GNU libc requires a >= 2.6.26 kernel, except on m68k where a
-      # 2.6.32 kernel is needed.
-      if [ "$realarch" != m68k ]
-      then
-          vmin=2.6.26
-      else
-          vmin=2.6.32
-      fi
-      if linux_compare_versions "$kernel_ver" lt ${vmin}
-      then
-          echo WARNING: this version of the GNU libc requires kernel version
-          echo ${vmin} or later.  Please upgrade your kernel before installing
-          echo glibc.
-          kernel26_help
+        # convert "armv4l" and similar to just "arm", and "mips64" and similar
+        # to just "mips"
+        case $realarch in
+            arm*) realarch="arm";;
+            mips*) realarch="mips";;
+        esac
 
-          exit 1
-      fi
+        # The GNU libc requires a >= 2.6.26 kernel, except on m68k where a
+        # 2.6.32 kernel is needed.
+        if [ "$realarch" != m68k ]
+        then
+            vmin=2.6.26
+        else
+            vmin=2.6.32
+        fi
+        if linux_compare_versions "$kernel_ver" lt ${vmin}
+        then
+            echo WARNING: this version of the GNU libc requires kernel version
+            echo ${vmin} or later.  Please upgrade your kernel before installing
+            echo glibc.
+            kernel26_help
 
-      # From glibc 2.6-3 SPARC V8 support is dropped.
-      if [ "$realarch" = sparc ]
-      then
-          # The process could be run using linux32, check for /proc.
-          if [ -f /proc/cpuinfo ]
-          then
-             case "$(sed '/^type/!d;s/^type.*: //g' /proc/cpuinfo)" in
-                 sun4u)
-                    # UltraSPARC CPU
-                    ;;
-                 sun4v)
-                    # Niagara CPU
-                    ;;
-                 *)
-                    echo "WARNING: This machine has a SPARC V8 or earlier class processor."
-                    echo "Debian lenny and later does not support such old hardware"
-                    echo "any longer."
-                    exit 1
-                    ;;
-             esac
-          fi
-      fi
-  elif [ $system = "GNU/kFreeBSD" ] ; then
-      kernel_ver=`uname -r`
-      if kfreebsd_compare_versions "$kernel_ver" lt 8.0
-      then
-          echo WARNING: this version of the GNU libc requires kernel version
-          echo 8.0 or later.  Please upgrade your kernel before installing
-          echo glibc.
-          exit 1
-      fi
-  fi
+            exit 1
+        fi
+
+        # From glibc 2.6-3 SPARC V8 support is dropped.
+        if [ "$realarch" = sparc ]
+        then
+            # The process could be run using linux32, check for /proc.
+            if [ -f /proc/cpuinfo ]
+            then
+               case "$(sed '/^type/!d;s/^type.*: //g' /proc/cpuinfo)" in
+                   sun4u)
+                      # UltraSPARC CPU
+                      ;;
+                   sun4v)
+                      # Niagara CPU
+                      ;;
+                   *)
+                      echo "WARNING: This machine has a SPARC V8 or earlier class processor."
+                      echo "Debian lenny and later does not support such old hardware"
+                      echo "any longer."
+                      exit 1
+                      ;;
+               esac
+            fi
+        fi
+    elif [ $system = "GNU/kFreeBSD" ] ; then
+        kernel_ver=`uname -r`
+        if kfreebsd_compare_versions "$kernel_ver" lt 8.0
+        then
+            echo WARNING: this version of the GNU libc requires kernel version
+            echo 8.0 or later.  Please upgrade your kernel before installing
+            echo glibc.
+            exit 1
+        fi
+    fi
 fi
 
 #DEBHELPER#


Reply to: