linux/debian/templates/image.plain.bug/include-network

43 lines
1.1 KiB
Plaintext

add_network() {
yesno "Include network configuration and status from this computer? " nop
test $REPLY = yep || return 0
echo '** Network interface configuration:' >&3
# Hide passwords/keys
awk '$1 ~ /^wireless-key/ { gsub(".", "*", $2); }
$1 == "ethtool-wol" { gsub(".", "*", $3); }
{ print; }
' </etc/network/interfaces >&3
echo >&3
echo '** Network status:' >&3
if command -v ip >/dev/null; then
echo '*** IP interfaces and addresses:' >&3
ip address show >&3
echo >&3
fi
echo '*** Device statistics:' >&3
cat /proc/net/dev >&3
echo >&3
if command -v netstat >/dev/null; then
echo '*** Protocol statistics:' >&3
netstat -s >&3 || true
echo >&3
fi
echo '*** Device features:' >&3
for dir in /sys/class/net/*; do
echo -n "${dir##*/}: " >&3
cat "$dir"/features >&3
done
echo >&3
}
ask_network() {
test $same_system = yep || return 0
yesno "Include network configuration from this computer? " nop
test $REPLY = yep || return 0
echo '** Network interface configuration:' >&3
cat /etc/network/interfaces >&3
echo >&3
}