HEX
Server: Apache
System: Linux scp1.abinfocom.com 5.4.0-216-generic #236-Ubuntu SMP Fri Apr 11 19:53:21 UTC 2025 x86_64
User: confeduphaar (1010)
PHP: 8.1.33
Disabled: exec,passthru,shell_exec,system
Upload Files
File: //usr/src/glibc/debian/debhelper.in/libc.postinst
#!/bin/sh
set -e
export LC_ALL=C

type=$1
preversion=$2

checkpkgver () {
    local status pkg
    pkg=$1
    status=$(dpkg -s $pkg 2>/dev/null | grep ^Status: | sed -e 's/^Status: \(.*\) \(.*\) \(.*\)/\3/g')
    if [ -n "$status" ] && [ "$status" != "not-installed" ] && [ "$status" != "config-files" ]; then
	echo $(dpkg -s $pkg 2>/dev/null | grep ^Version: | sed -e 's/^Version: *//');
    fi
}

if [ "$type" = "configure" ]
then
    # We don't use a registry anymore, remove the old file
    rm -f /etc/ld.so.hwcappkgs
 
    # /etc/ld.so.nohwcap code:
    __NOHWCAP__

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

    if [ -n "$preversion" ] && [ -x "$(which ischroot)" ] && ! ischroot; then
	if dpkg --compare-versions "$preversion" lt GLIBC_VERSION; then
	    check=""
	    [ -f /var/run/services.need_restart ] && check=$(sort -u /var/run/services.need_restart 2>/dev/null)
	    # Change service names back into package names, so that we can
	    # double-check package installation.
	    check=$(echo "$check" | \
                    sed -e's/\batd\b/at/g' \
                        -e's/\bdovecot\b/dovecot-common/g' \
                        -e's/\bexim4\b/exim4-base/g' \
                        -e's/\blpd\b/lpr/g' \
                        -e's/\blpd-ppd\b/lpr-ppd/g' \
                        -e's/\bmysql\b/mysql-server/g' \
                        -e's/\bsaslauthd\b/sasl2-bin/g' \
                        -e's/\bsmbd\b/samba/g' \
                        -e's/\bpostgresql\b/postgresql-common/g' \
                    )

	    # Check to see which of the services that were running at unpack
	    # time are still around
            # the following substitution processes the check variable
            # and returns results in the services variable
	    # NSS services check:
	    __NSS_CHECK__
	    # If there are services that we *stopped* in the preinst, don't
	    # forget to restart them now
	    if [ -e /var/run/services.need_start ]; then
		services="$(sort -u /var/run/services.need_start) $services"
	    fi
	    if [ -n "$services" ]; then
		echo "Restarting services possibly affected by the upgrade:"
		failed=""
		for service in $services; do
		    case "$service" in
			gdm*)
			    idlopt="reload"
			    ;;
			*)
			    idlopt="restart"
			    ;;
		    esac
		    echo -n "  $service: restarting..."
		    if invoke-rc.d ${service} $idlopt > /dev/null 2>&1; then
			echo "done."
		    else
			echo "FAILED! ($?)"
			failed="$service $failed"
		    fi
		done
	
		echo
		if [ -n "$failed" ]; then
		    if [ -f /usr/share/debconf/confmodule ] ; then
			db_fset glibc/restart-failed seen false
			db_subst glibc/restart-failed services "$failed"
			if [ "$RELEASE_UPGRADE_MODE" = desktop ]; then
			    db_input medium glibc/restart-failed || true
			else
			    db_input critical glibc/restart-failed || true
			fi
			db_go || true
		    else
			echo "The following services failed to start: $failed"
			echo
			echo "You will need to start these manually by running \`invoke-rc.d <service> start'"
			echo "If the service still fails to start, you may need to file a bug on"
			echo "${DPKG_MAINTSCRIPT_PACKAGE}:${DPKG_MAINTSCRIPT_ARCH} or the service involved."
			frontend=`echo "$DEBIAN_FRONTEND" | tr '[:upper:]' '[:lower:]'`
			if [ "$frontend" != noninteractive ]; then
			    echo
			    echo -n "Press ENTER to continue: "
			    read foo
			fi
		    fi
		else
		    echo "Services restarted successfully."
		    rm -f /var/run/services.need_start /var/run/services.need_restart
		fi
	
		# Shut down the frontend, to make sure none of the
		# restarted services keep a connection open to it
		if [ -f /usr/share/debconf/confmodule ] ; then
		    db_stop
		fi
	    else
		echo "Nothing to restart."
	    fi
	fi # end upgrading and $preversion lt GLIBC_VERSION
	# give a reboot notification on al upgrades (LP: #1546457)
	if [ -x /usr/share/update-notifier/notify-reboot-required ]; then
	    /usr/share/update-notifier/notify-reboot-required
	fi
    fi # Upgrading

    # Restart init.  Currently handles chroots, systemd and upstart, and
    # assumes anything else is going to not fail at behaving like
    # sysvinit:
    TELINIT=yes
    if ischroot 2>/dev/null; then
        # Don't bother trying to re-exec init from a chroot:
        TELINIT=no
    elif [ -d /run/systemd/system ]; then
        # Skip if systemd is the active PID 1, since systemd doesn't
        # need a reexec for a clean shutdown
        TELINIT=no
    elif [ -x "`which initctl`" ]; then
        UPSTART=$(initctl version 2>/dev/null | awk '/upstart/ {print $3}' | tr -d ')')
        if dpkg --compare-versions "$UPSTART" lt-nl 1.6.1; then
            # This is an old upstart that can't re-exec statefully:
            TELINIT=no
            touch /var/run/init.upgraded
        fi
    fi
    if [ "$TELINIT" = "yes" ]; then
        telinit u 2>/dev/null || true ; sleep 1
    fi
fi

#DEBHELPER#

exit 0