File: nohwcap.sh

package info (click to toggle)
glibc 2.19-18
  • links: PTS, VCS
  • area: main
  • in suites: jessie-backports, jessie-kfreebsd
  • size: 203,628 kB
  • sloc: ansic: 969,800; asm: 241,205; sh: 10,063; makefile: 8,471; cpp: 3,595; perl: 2,077; pascal: 1,839; awk: 1,704; yacc: 317; sed: 73
file content (45 lines) | stat: -rw-r--r-- 1,642 bytes parent folder | download | duplicates (10)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
    # Handle upgrades when libc-opt package has been installed.
    # When a /etc/ld.so.nohwcap file exists, ld.so only use libraries
    # from /lib, and ignore all optimised libraries. This file is
    # inconditionaly created in the preinst script of libc.
 
    # Get the list of optimized packages for a given architecture
    # Before removing a package from this list, make sure it appears
    # in the Conflicts: line of libc.
    case $(dpkg --print-architecture) in
        alpha)
            hwcappkgs="libc6-alphaev67"
            ;;
        i386)
            hwcappkgs="libc6-i686 libc6-xen"
            ;;
        kfreebsd-i386)
            hwcappkgs="libc0.1-i686"
            ;;
        mipsel)
	    hwcappkgs="libc6-loongson2f"
	    ;;
        sparc)
            hwcappkgs="libc6-sparcv9 libc6-sparcv9b"
            ;;
    esac
 
    # We check the version between the current installed libc and
    # all optimized packages (on architectures where such packages
    # exists).
    all_upgraded=yes
    if [ -n "$hwcappkgs" ]; then
        for pkg in $hwcappkgs ; do
            ver=$(dpkg-query -l $pkg 2>/dev/null | sed -e '/^[a-z][a-z]\s/!d;/^.[nc]/d;' -e "s/^..\s\+$pkg[0-9a-z:]*\s\+//;s/\s.*//g")
            if [ -n "$ver" ] && [ "$ver" != "CURRENT_VER" ]; then
                all_upgraded=no
            fi
        done
    fi

    # If the versions of all optimized packages are the same as the libc
    # one, we could remove /etc/ld.so.nohwcap. Otherwise, it will be removed
    # when all optimized packages are upgraded or removed.
    if [ "$all_upgraded" = yes ] ; then
        rm -f /etc/ld.so.nohwcap
    fi