-------- Forwarded Message --------
Subject: Re: ifupdown-extra: check-network-cable fails because of
leading spaces
From: Corcodel Marian <[email protected]>
To: Debian Bug Tracking System <[email protected]>
Package: ifupdown-extra
Version: 0.25
Followup-For: Bug #758798
Hi
On mee fail to set variable LINK local
-- System Information:
Debian Release: 8.0
APT prefers testing-updates
APT policy: (500, 'testing-updates'), (500, 'testing')
Architecture: amd64 (x86_64)
Kernel: Linux 3.16.0-4-amd64 (SMP w/2 CPU cores)
Locale: LANG=en_US.UTF-8, LC_CTYPE=en_US.UTF-8 (charmap=UTF-8)
Shell: /bin/sh linked to /bin/dash
Init: systemd (via /run/systemd/system)
Versions of packages ifupdown-extra depends on:
ii bind9-host [host] 1:9.9.5.dfsg-9
ii curl 7.38.0-4
ii dpkg 1.17.24
ii host 1:9.9.5.dfsg-9
ii iproute2 3.16.0-2
ii iputils-arping 3:20121221-5+b2
ii iputils-ping [ping] 3:20121221-5+b2
ii net-tools 1.60-26+b1
ii netcat-traditional [netcat] 1.10-41
Versions of packages ifupdown-extra recommends:
ii ethtool 1:3.16-1
ifupdown-extra suggests no packages.
-- Configuration Files:
/etc/network/if-up.d/00check-network-cable changed:
rc=/etc/default/network-test
[ ! -r $rc ] || . $rc
ETHTOOL=/sbin/ethtool
alt_et=/usr/sbin/ethtool
[ -x $ETHTOOL ] || [ ! -x $alt_et ] || ETHTOOL=$alt_et
MIITOOL=/sbin/mii-tool
DO_SYSLOG=${DO_SYSLOG:-yes}
ABORT_NO_LINK=i${ABORT_NO_LINK:-no}
VERBOSITY=${VERBOSITY:-0}
if [ "$DO_SYSLOG" = yes ]; then
OUTPUT="logger -i -p daemon.err -s"
else
OUTPUT=echo
fi
LC_ALL=C
export LC_ALL
check_status_miitool() {
local status=0
if $MIITOOL "$IFACE" 2>&1 | grep -q "no link"; then
status=1
fi
return $status
}
check_status_ethtool() {
local status=0
LINK=$($ETHTOOL "$IFACE" 2>&1 | grep "Link detected" || :)
#local LINK="Link detected: yes"
# If ethtool fails to print out the link line we break off
# notice that ethtool cannot get the link status out of all
# possible network interfaces
# [ "$LINK" ] || return 1
if [ "$LINK"!="Link detected: yes" ]; then
status=1
fi
return $status
}
check_status_iplink() {
local status=0
local info=""
[ -x /sbin/ip ] || return 0
info=$(/sbin/ip link show "$IFACE" 2>&1 | grep "$IFACE:")
if echo $info | grep -q NO-CARRIER ||
echo $info | grep -q "state DOWN" ||
echo $info | grep -q "state LOWERLAYERDOWN"; then
status=1
fi
return $status
}
check_status() {
local status=0 myid=$(id -u)
ifconfig "$IFACE" 2>/dev/null 1>&2 || {
$OUTPUT "ERROR: Interface $IFACE does not seem to be present" \
"in the system"
# FIXME: would that be return status 0 or 1?
return
}
# Use ethtool if installed (preferable to mii-tool)
# If none are installed (or not running as root) we will test using
# 'ip link show'
if [ -x $ETHTOOL ] && [ $myid -eq 0 ]; then
check_status_ethtool || status=$?
elif [ -x $MIITOOL ] && [ $myid -eq 0 ]; then
check_status_miitool || status=$?
else
check_status_iplink || status=$?
fi
[ $status -eq 0 ] ||
$OUTPUT "WARNING: Initialising interface $IFACE which does" \
"not have link"
return $status
}
check_bond_status() {
local status=1 slaves slave_iface
slaves="/sys/class/net/$IFACE/bonding/slaves"
[ -e $slaves ] || return 0
while read slave_iface; do
# Use ":" command to silence slaves.
OUTPUT=: IFACE=$slave_iface check_status || status=$?
# One functional slave will suffice
[ $status -ne 0 ] || return 0
done <$slaves
$OUTPUT "WARNING: Initialising bond $IFACE which does not have link" \
"on any slave"
return $status
}
[ "$IFACE" ] || {
$OUTPUT "ERROR: Variable IFACE not set in environment"
exit 1
}
case $IFACE in
eth*)
check_status || [ "$ABORT_NO_LINK" != yes ] || exit 1
;;
bond*)
check_bond_status || [ "$ABORT_NO_LINK" != yes ] || exit 1
;;
esac
-- no debconf information
--- ./ifupdown-extra_0.25_all/etc/network/if-up.d/00check-network-cable 2014-04-10 02:38:10.000000000 +0300
+++ 00check-network-cable 2015-03-26 22:11:42.613646000 +0200
@@ -69,13 +69,15 @@
check_status_ethtool() {
local status=0
- local LINK=$($ETHTOOL "$IFACE" 2>&1 | grep "Link detected" || :)
+ LINK=$($ETHTOOL "$IFACE" 2>&1 | grep "Link detected" || :)
+ #local LINK="Link detected: yes"
+
# If ethtool fails to print out the link line we break off
# notice that ethtool cannot get the link status out of all
# possible network interfaces
- [ "$LINK" ] || return 1
- if ! echo $LINK | grep -q "Link detected: yes"; then
+ # [ "$LINK" ] || return 1
+ if [ "$LINK"!="Link detected: yes" ]; then
status=1
fi
return $status