0.1-alt3
- add iftabupdate utility
This commit is contained in:
parent
298071c755
commit
69a16cf90b
@ -2,7 +2,7 @@
|
||||
|
||||
Name: alterator-net-common
|
||||
Version: 0.1
|
||||
Release: alt2
|
||||
Release: alt3
|
||||
|
||||
Packager: Stanislav Ievlev <inger@altlinux.org>
|
||||
|
||||
@ -30,6 +30,9 @@ helpers for etcnet administration
|
||||
%_libexecdir/%name/
|
||||
|
||||
%changelog
|
||||
* Tue Oct 30 2007 Stanislav Ievlev <inger@altlinux.org> 0.1-alt3
|
||||
- add iftabupdate utility
|
||||
|
||||
* Thu Oct 25 2007 Stanislav Ievlev <inger@altlinux.org> 0.1-alt2
|
||||
- simplify ifcheckup utility
|
||||
- add maskname and ifaceinfo utilities
|
||||
|
@ -1,6 +1,5 @@
|
||||
TOOLS=ifup ifdown ifvar iflist ifcheckup ifcheckplug ifcheckdhcp ifaceinfo maskname
|
||||
INSTALL=/usr/bin/install
|
||||
|
||||
install:
|
||||
$(INSTALL) -d $(libexecdir)/alterator-net-common/
|
||||
$(INSTALL) -pm755 $(TOOLS) $(libexecdir)/alterator-net-common/
|
||||
$(INSTALL) -pm755 tools/* $(libexecdir)/alterator-net-common/
|
||||
|
31
alterator-net-common/tools/iftabupdate
Executable file
31
alterator-net-common/tools/iftabupdate
Executable file
@ -0,0 +1,31 @@
|
||||
#!/bin/sh
|
||||
|
||||
PATH="/usr/lib/alterator-net-common:$PATH"
|
||||
|
||||
iftabfile="/etc/iftab"
|
||||
|
||||
read_businfo()
|
||||
{
|
||||
/usr/sbin/ethtool -i "$1" 2>/dev/null|
|
||||
sed -nr 's,^bus-info:[[:space:]]([^[:space:]]+),\1,p'
|
||||
}
|
||||
|
||||
iflist|
|
||||
while read name mac;do
|
||||
[ "00:00:00:00:00:00" = "$mac" ] && continue # avoid wrong mac addresses from broken drivers (like rt61)
|
||||
|
||||
if [ -s "$iftabfile" ]; then
|
||||
sed -r \
|
||||
-e "/^$name[[:space:]]/ d" \
|
||||
-e "/[[:space:]]mac[[:space:]]+$mac([[:space:]]|\$)/ d" \
|
||||
-i "$iftabfile"
|
||||
|
||||
businfo=$(read_businfo "$name")
|
||||
[ -z "$businfo" ] ||
|
||||
sed -r \
|
||||
-e "/[[:space:]]businfo[[:space:]]+$businfo([[:space:]]|\$)/ d" \
|
||||
-i "$iftabfile"
|
||||
fi
|
||||
|
||||
printf "%s\tmac %s\n" "$name" "$mac" >>"$iftabfile"
|
||||
done
|
Loading…
x
Reference in New Issue
Block a user