This file is indexed.

preinst is in libc6 2.15-0ubuntu10.18.

This file is a maintainer script. It is executed when installing (*inst) or removing (*rm) the package.

The actual contents of the file can be viewed below.

  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
 46
 47
 48
 49
 50
 51
 52
 53
 54
 55
 56
 57
 58
 59
 60
 61
 62
 63
 64
 65
 66
 67
 68
 69
 70
 71
 72
 73
 74
 75
 76
 77
 78
 79
 80
 81
 82
 83
 84
 85
 86
 87
 88
 89
 90
 91
 92
 93
 94
 95
 96
 97
 98
 99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
165
166
167
168
169
170
171
172
173
174
175
176
177
178
179
180
181
182
183
184
185
186
187
188
189
190
191
192
193
194
195
196
197
198
199
200
201
202
203
204
205
206
207
208
209
210
211
212
213
214
215
216
217
218
219
220
221
222
223
224
225
226
227
228
229
230
231
232
233
234
235
236
237
238
239
240
241
242
243
244
245
246
247
248
249
250
251
252
253
254
255
256
257
258
259
260
261
262
263
264
265
266
267
268
269
270
271
272
273
274
275
276
277
278
279
280
281
282
283
284
285
286
287
288
289
290
291
292
293
294
295
296
297
298
299
300
301
302
303
304
305
306
307
308
309
310
311
312
313
314
315
316
317
318
319
320
321
322
323
324
325
326
327
328
329
330
331
332
333
334
335
336
337
338
339
340
341
342
343
344
345
346
347
348
349
350
351
352
353
354
355
356
357
358
359
360
361
362
363
364
365
366
367
368
369
370
371
372
373
374
375
376
377
378
379
380
381
382
383
384
385
386
387
388
389
390
391
392
393
394
395
396
397
398
399
400
401
402
403
404
405
406
407
408
409
410
411
412
413
414
415
416
417
418
419
420
421
422
423
424
425
426
427
428
429
430
431
432
433
434
435
436
437
438
439
440
441
442
443
444
445
446
447
448
449
450
451
452
453
454
455
456
457
458
459
460
461
462
463
464
465
466
467
468
469
470
471
472
473
474
475
476
477
478
479
480
481
482
483
484
485
486
487
488
489
490
491
492
493
494
495
496
497
498
499
500
501
502
503
504
505
506
507
508
509
510
511
512
513
514
515
516
517
518
519
520
521
522
523
524
525
526
527
528
529
530
531
532
533
534
535
536
537
538
539
540
541
542
543
544
545
546
547
548
549
550
551
552
553
554
555
556
557
558
559
560
561
562
563
564
565
566
567
568
569
570
571
572
573
574
575
576
577
578
579
580
581
582
583
584
585
586
587
588
589
590
591
592
593
594
595
596
597
598
599
600
601
602
603
604
605
606
607
608
609
610
611
612
613
614
615
616
617
618
#!/bin/sh
set -e
export LC_ALL=C

type=$1
preversion=$2

rm_conffile() {
    local PKGNAME="$1"
    local CONFFILE="$2"

    [ -e "$CONFFILE" ] || return 0

    local md5sum="$(md5sum $CONFFILE | sed -e 's/ .*//')"
    local old_md5sum="$(dpkg-query -W -f='${Conffiles}' $PKGNAME | \
            sed -n -e "\' $CONFFILE ' { s/ obsolete$//; s/.* //; p }")"
    if [ "$md5sum" != "$old_md5sum" ]; then
        echo "Obsolete conffile $CONFFILE has been modified by you."
        echo "Saving as $CONFFILE.dpkg-bak ..."
        mv -f "$CONFFILE" "$CONFFILE".dpkg-bak
    else
        echo "Removing obsolete conffile $CONFFILE ..."
        rm -f "$CONFFILE"
    fi
}

linux_compare_versions () {
    verA=$(($(echo "$1" | sed 's/^\([0-9]*\.[0-9]*\)\([^.0-9]\|$\)/\1.0\2/; s/\([0-9]*\)\.\([0-9]*\)\.\([0-9]*\).*/\1 \* 10000 + \2 \* 100 + \3/')))
    verB=$(($(echo "$3" | sed 's/^\([0-9]*\.[0-9]*\)\([^.0-9]\|$\)/\1.0\2/; s/\([0-9]*\)\.\([0-9]*\)\.\([0-9]*\).*/\1 \* 10000 + \2 \* 100 + \3/')))

    test $verA -$2 $verB
}

kfreebsd_compare_versions () {
    verA=$(($(echo "$1" | sed 's/\([0-9]*\)\.\([0-9]*\).*/\1 \* 100 + \2/')))
    verB=$(($(echo "$3" | sed 's/\([0-9]*\)\.\([0-9]*\).*/\1 \* 100 + \2/')))

    test $verA -$2 $verB
}

kernel26_help() {
    echo ""
    echo "The installation of a 2.6 kernel _could_ ask you to install a new libc"
    echo "first, this is NOT a bug, and should *NOT* be reported. In that case,"
    echo "please add lenny sources to your /etc/apt/sources.list and run:"
    echo "  apt-get install -t lenny linux-image-2.6"
    echo "Then reboot into this new kernel, and proceed with your upgrade"
}

# Sanity check.
# If there are versions of glibc outside of the normal installation
# location (/lib, /lib64, etc.) then things may break very badly
# as soon as ld.so is replaced by a new version.  This check is not
# foolproof, but it's pretty accurate.  This script ignores libraries
# with different sonames, and libraries incompatible with the 
# to-be-installed ld.so.
check_dir () {
    msg=$1
    dir=$2

    # Follow symlinks
    dir=$(readlink -e $dir || true)

    # 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
  
    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 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

        # 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

        # 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
}

# On upgrade, if /lib64 is a symlink, remove it and replace it with a real
# directory so we can ensure biarch and multiarch packages play nicely
# together
remove_lib64_symlink() {
    ldfile=$(readlink -e /lib64/ld-linux-x86-64.so.2)
    # Test if libc is of the same architecture as /bin/mv
    # If not, they almost surely have a multiarch system and we can use
    # the native ELF interpreter
    if ! $ldfile /bin/mv --version >/dev/null 2>&1; then
        interpreter=
    else
        interpreter=$ldfile
    fi

    mkdir /lib64.eglibc-new
    ln -s $ldfile /lib64.eglibc-new/$(basename /lib64/ld-linux-x86-64.so.2)
    # sync before and after the operation to reduce the danger of hosing
    # the system
    sync
    rm -f /lib64
    $interpreter /bin/mv /lib64.eglibc-new /lib64
    sync
    rm -f /lib/$(basename /lib64/ld-linux-x86-64.so.2)
}

if [ "$type" = upgrade ]
then
    # Remove old /etc/init.d/glibc.sh init script
    if dpkg --compare-versions "$preversion" le "2.9-22"; then
        rm_conffile libc6 "/etc/init.d/glibc.sh"
	update-rc.d glibc.sh remove >/dev/null
    fi
    if dpkg --compare-versions "$preversion" lt "2.15-0ubuntu7"; then
        rm_conffile libc6 "/etc/ld.so.conf.d/i486-linux-gnu.conf"
    fi

    # Load debconf module if available
    if [ -f /usr/share/debconf/confmodule ] ; then
        . /usr/share/debconf/confmodule
    fi

    if [ -n "$preversion" ]; then
	# NSS authentication trouble guard
	if dpkg --compare-versions "$preversion" lt 2.15; then
	    if pidof xscreensaver xlockmore >/dev/null; then
		if [ -f /usr/share/debconf/confmodule ] ; then
		    db_version 2.0
		    db_reset glibc/disable-screensaver
		    db_input critical glibc/disable-screensaver || true
		    db_go || true
		else
		    echo "xscreensaver and xlockmore must be restarted before upgrading"
		    echo
		    echo "One or more running instances of xscreensaver or xlockmore have been"
		    echo "detected on this system. Because of incompatible library changes, the"
		    echo "upgrade of the GNU C library will leave you unable to authenticate to"
		    echo "these programs. You should arrange for these programs to be restarted"
		    echo "or stopped before continuing this upgrade, to avoid locking your users"
		    echo "out of their current sessions."
		    echo
		    frontend=`echo "$DEBIAN_FRONTEND" | tr '[:upper:]' '[:lower:]'`
		    if [ "$frontend" = noninteractive ]; then
			echo "Non-interactive mode, upgrade glibc forcibly"
		    else
		        echo -n "Press a key to continue"
		        read answer
		    fi
		    echo
		fi
	    fi

	    check="kdm postgresql xdm"
	    # NSS services check: NSS_CHECK
	    echo -n "Checking for services that may need to be restarted..."
	    # Only get the ones that are installed, and configured
	    check=$(dpkg -s $check 2> /dev/null | egrep '^Package:|^Status:' | awk '{if ($1 ~ /^Package:/) { package=$2 } else if ($0 ~ /^Status: .* installed$/) { print package }}')
	    # some init scripts don't match the package names
	    check=$(echo $check | \
	    	    sed -e's/\bapache2.2-common\b/apache2/g' \
	    	    	-e's/\bat\b/atd/g' \
	    	    	-e's/\bdovecot-common\b/dovecot/g' \
	    	    	-e's/\bexim4-base\b/exim4/g' \
	    	    	-e's/\blpr\b/lpd/g' \
	    	    	-e's/\blpr-ppd\b/lpd-ppd/g' \
	    	    	-e's/\bmysql-server\b/mysql/g' \
	    	    	-e's/\bsasl2-bin\b/saslauthd/g' \
	    )
	    echo
	    echo "Checking init scripts..."
	    rl=$(runlevel | sed 's/.*\ //')
	    for service in $check; do
	    	if [ -x "`which invoke-rc.d 2>/dev/null`" ]; then
	    	    invoke-rc.d ${service} status >/dev/null 2>/dev/null && status=0 || status=$?
	    	    if [ "$status" = "0" ] || [ "$status" = "2" ] ; then
	    	    	services="$service $services"
	    	    elif [ "$status" = "100" ] ; then
	    	    	echo "WARNING: init script for $service not found."
	    	    fi
	    	else
	    	    if [ -f /usr/share/file-rc/rc ] || [ -f /usr/lib/file-rc/rc ] && [ -f /etc/runlevel.conf ]; then
	    	    	idl=$(filerc $rl $service)
	    	    else
	    	    	idl=$(ls /etc/rc${rl}.d/S??${service} 2> /dev/null | head -1)
	    	    fi
	    	    if [ -n "$idl" ] && [ -x $idl ]; then
	    	    	services="$service $services"
	    	    fi
	    	fi
	    done
	    if [ -n "$services" ]; then 
		if [ -f /usr/share/debconf/confmodule ] ; then
	            db_version 2.0
		    db_reset glibc/upgrade
		    db_subst glibc/upgrade services $services
		    if [ "$RELEASE_UPGRADE_MODE" = desktop ]; then
			db_input medium glibc/upgrade || true
		    else
			db_input critical glibc/upgrade || true
		    fi
		    db_go || true
		    db_get glibc/upgrade
		    answer=$RET
		else
		    echo "Do you want to upgrade glibc now?"
		    echo
		    echo "Running services and programs that are using NSS need to be restarted,"
		    echo "otherwise they might not be able to do lookup or authentication any more."
		    echo "The installation process is able to restart some services (such as ssh or"
		    echo "telnetd), but other programs cannot be restarted automatically.  One such"
		    echo "program that needs manual stopping and restart after the glibc upgrade by"
		    echo "yourself is xdm - because automatic restart might disconnect your active"
		    echo "X11 sessions."
		    echo
		    echo "This script detected the following installed services which must be"
		    echo "stopped before the upgrade: $services"
		    echo
		    echo "If you want to interrupt the upgrade now and continue later, please"
		    echo "answer No to the question below."
		    echo 
		    frontend=`echo "$DEBIAN_FRONTEND" | tr '[:upper:]' '[:lower:]'`
		    if [ "$frontend" = noninteractive ]; then
			echo "Non-interactive mode, upgrade glibc forcibly"
			answer=true
		    else
		        echo -n "Do you want to upgrade glibc now? [Y/n] "
		        read answer
		        case $answer in
			    Y*|y*) answer=true ;;
			    N*|n*) answer=false ;;
			    *) answer=true ;;
			esac
		    fi
		    echo
		fi

		if [ "x$answer" != "xtrue" ]; then
	            echo "Stopped glibc upgrade.  Please retry the upgrade after you have"
	            echo "checked or stopped services by hand."
	            exit 1
		fi
	    fi

            services=""
            check="apache2.2-common apache apache-ssl apache-perl autofs at"
            check="$check boa cucipop courier-authdaemon cron cups exim"
            check="$check exim4-base dovecot-common cucipop incron lprng lpr"
            check="$check lpr-ppd mysql-server nis openbsd-inetd"
            check="$check openldapd proftpd postfix postfix-tls rsync samba"
            check="$check sasl2-bin slapd smail sendmail snmpd ssh"
            check="$check spamassassin vsftpd wu-ftpd wu-ftpd-academ wwwoffle"
            check="$check webmin dropbear"
            # NSS services check: NSS_CHECK
	    echo -n "Checking for services that may need to be restarted..."
	    # Only get the ones that are installed, and configured
	    check=$(dpkg -s $check 2> /dev/null | egrep '^Package:|^Status:' | awk '{if ($1 ~ /^Package:/) { package=$2 } else if ($0 ~ /^Status: .* installed$/) { print package }}')
	    # some init scripts don't match the package names
	    check=$(echo $check | \
	    	    sed -e's/\bapache2.2-common\b/apache2/g' \
	    	    	-e's/\bat\b/atd/g' \
	    	    	-e's/\bdovecot-common\b/dovecot/g' \
	    	    	-e's/\bexim4-base\b/exim4/g' \
	    	    	-e's/\blpr\b/lpd/g' \
	    	    	-e's/\blpr-ppd\b/lpd-ppd/g' \
	    	    	-e's/\bmysql-server\b/mysql/g' \
	    	    	-e's/\bsasl2-bin\b/saslauthd/g' \
	    )
	    echo
	    echo "Checking init scripts..."
	    rl=$(runlevel | sed 's/.*\ //')
	    for service in $check; do
	    	if [ -x "`which invoke-rc.d 2>/dev/null`" ]; then
	    	    invoke-rc.d ${service} status >/dev/null 2>/dev/null && status=0 || status=$?
	    	    if [ "$status" = "0" ] || [ "$status" = "2" ] ; then
	    	    	services="$service $services"
	    	    elif [ "$status" = "100" ] ; then
	    	    	echo "WARNING: init script for $service not found."
	    	    fi
	    	else
	    	    if [ -f /usr/share/file-rc/rc ] || [ -f /usr/lib/file-rc/rc ] && [ -f /etc/runlevel.conf ]; then
	    	    	idl=$(filerc $rl $service)
	    	    else
	    	    	idl=$(ls /etc/rc${rl}.d/S??${service} 2> /dev/null | head -1)
	    	    fi
	    	    if [ -n "$idl" ] && [ -x $idl ]; then
	    	    	services="$service $services"
	    	    fi
	    	fi
	    done
            if [ -n "$services" ]; then
                if [ -f /usr/share/debconf/confmodule ] ; then
                    db_version 2.0
                    if [ "$RELEASE_UPGRADE_MODE" = desktop ]; then
                        db_input medium libraries/restart-without-asking || true
                    else
                        db_input critical libraries/restart-without-asking || true
                    fi
                    db_go || true
    
                    db_get libraries/restart-without-asking
                    if [ "$RET" != true ]; then
                        db_reset glibc/restart-services
                        db_set glibc/restart-services "$services"
                        db_input critical glibc/restart-services || true
                        db_go || true
                        db_get glibc/restart-services
                        services="$RET"
                    fi
                else
                    echo
                    echo "Name Service Switch update in the C Library: post-installation question."
                    echo
                    echo "Running services and programs that are using NSS need to be restarted,"
                    echo "otherwise they might not be able to do lookup or authentication any more"
                    echo "(for services such as ssh, this can affect your ability to login)."
                    echo "Note: restarting sshd/telnetd should not affect any existing connections."
                    echo
                    echo "The services detected are: "
                    echo "        $services"
                    echo
                    echo "If other services have begun to fail mysteriously after this upgrade, it is"
                    echo "probably necessary to restart them too.  We recommend that you reboot your"
                    echo "machine after the upgrade to avoid NSS-related troubles."
                    echo
                    frontend=`echo "$DEBIAN_FRONTEND" | tr '[:upper:]' '[:lower:]'`
                    if [ "$frontend" = noninteractive ]; then
                            echo "Non-interactive mode, restarting services"
                            answer=yes
                    else
                            echo -n "Do you wish to restart services? [Y/n] "
                            read answer
                            case $answer in
                            N*|n*) services="" ;;
                            *) ;;
                            esac
                    fi
                fi

                if [ -n "$services" ]; then
                    echo "Stopping some services possibly affected by the upgrade (will be restarted later):"
                    for service in $services; do
                        if [ -x "`which invoke-rc.d 2>/dev/null`" ]; then
                            idl="invoke-rc.d ${service}"
                            idlopt="stop"
                        elif [ -f /usr/share/file-rc/rc ] || [ -f /usr/lib/file-rc/rc ] && [ -f /etc/runlevel.conf ]; then
                            idl=$(filerc $rl $service)
                            idlopt="stop"
                        else
                            idl=$(ls /etc/rc${rl}.d/S??${service} 2> /dev/null | head -1)
                            idlopt="stop"
                        fi
                        case "$service" in
                            cron)
                                # See bug (LP: #508083)
                                echo -n "  $service: stopping..."
                                if $idl $idlopt > /dev/null 2>&1; then
                                    echo "done."
                                    echo "$service" >> /var/run/services.need_start
                                else
                                    echo "FAILED! ($?)"
                                    echo "$service" >> /var/run/services.need_restart
                                fi
                              ;;

                            *)
                                # log service details to allow postinst to handle the
                                # restart.
                                echo "$service" >> /var/run/services.need_restart
                              ;;
                        esac
                    done
    
                fi
                echo
            else
                echo "Nothing to restart."
            fi
	fi # end upgrading and $preversion lt 2.15
    fi # Upgrading

    # On upgrade from older glibc versions, our PI doesn't yet exist
    # on-disk, despite the preinst wanting to play with it, so make one
    if [ "${DPKG_MAINTSCRIPT_ARCH:-$(dpkg --print-architecture)}" = "armhf" ]; then
	if dpkg --compare-versions "$preversion" lt 2.15-0ubuntu8; then
            ln -sf /lib/x86_64-linux-gnu/ld-linux.so.3 /lib64/ld-linux-x86-64.so.2
	fi
    fi

    # This will keep us from using hwcap libs (optimized) during an
    # upgrade.
    touch /etc/ld.so.nohwcap

    # Try to detect copies of the libc library in the various places
    # the dynamic linker uses.
    ldfile=$(readlink -e /lib64/ld-linux-x86-64.so.2)
    ldbytes=$(head -c 20 /lib64/ld-linux-x86-64.so.2 | od -c)
    libcfiles=$(dpkg-query -L libc6 2>/dev/null)

    dirs="/lib/x86_64-linux-gnu /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')
        for dir in $dirs ; do
            check_dir "via LD_LIBRARY_PATH" $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
        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
        fi
    fi
fi

if [ "$type" != abort-upgrade ]
then
    # 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
            ;;
        /lib/x86_64-linux-gnu)
            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 /lib/x86_64-linux-gnu."
        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

    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

    # 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

        # sanity checking for the appropriate kernel on each architecture.
        realarch=`uname -m`
        kernel_ver=`uname -r`

        # convert "armv4l" and similar to just "arm", and "mips64" and similar
        # to just "mips"
        case $realarch in
            arm*) realarch="arm";;
            mips*) realarch="mips";;
        esac

        case $realarch in
            ppc*|m68k) vmin=2.6.32;; # powerpc builders are all on lucid
            arm)       vmin=2.6.31;; # minimum version of imx51 kernel still in use
            *)         vmin=2.6.24;; # kernel version in hardy used on Xen-based ppa buildds
        esac

        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

            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.1
        then
            echo WARNING: this version of the GNU libc requires kernel version
            echo 8.1 or later.  Please upgrade your kernel before installing
            echo glibc.
            exit 1
        fi
    fi
fi



case $type in
    upgrade|abort-upgrade)
        if test -L /lib64 && dpkg --compare-versions "$2" lt 2.13-17; then
            case ${DPKG_MAINTSCRIPT_ARCH:-$(dpkg --print-architecture)} in
                amd64 | ppc64 | sparc64)
                    remove_lib64_symlink
                    ;;
            esac
        fi
        ;;
esac

if [ -n "$preversion" ]; then
    if dpkg --compare-versions "$preversion" lt 2.13; then
       # upgrading from a pre-multiarch libc to a multiarch libc; we have
       # to blow away /etc/ld.so.cache, otherwise the old unpacked libc
       # is still first in the cache and segfaults when combined with
       # our newly-unpacked ld.so. Do this last to avoid slowing down the
       # rest of the upgrade.
       rm -f /etc/ld.so.cache
    fi
fi

exit 0