0.2-alt1
- use hal
This commit is contained in:
parent
69a16cf90b
commit
c513999564
@ -1,11 +1,13 @@
|
||||
%define _altdata_dir %_datadir/alterator
|
||||
|
||||
Name: alterator-net-common
|
||||
Version: 0.1
|
||||
Release: alt3
|
||||
Version: 0.2
|
||||
Release: alt1
|
||||
|
||||
Packager: Stanislav Ievlev <inger@altlinux.org>
|
||||
|
||||
Requires: libshell hal
|
||||
|
||||
Requires: etcnet
|
||||
|
||||
BuildArch: noarch
|
||||
@ -30,6 +32,9 @@ helpers for etcnet administration
|
||||
%_libexecdir/%name/
|
||||
|
||||
%changelog
|
||||
* Wed Nov 14 2007 Stanislav Ievlev <inger@altlinux.org> 0.2-alt1
|
||||
- use hal
|
||||
|
||||
* Tue Oct 30 2007 Stanislav Ievlev <inger@altlinux.org> 0.1-alt3
|
||||
- add iftabupdate utility
|
||||
|
||||
|
@ -1,25 +1,29 @@
|
||||
#!/bin/sh
|
||||
|
||||
usage()
|
||||
{
|
||||
echo "Usage: $0 <interface>" > /dev/stderr
|
||||
exit 1
|
||||
}
|
||||
. shell-error
|
||||
|
||||
description()
|
||||
{
|
||||
echo "$4"
|
||||
}
|
||||
[ -z "$1" ] && fatal "Usage: $0 <interface>"
|
||||
|
||||
[ -z "$1" ] && usage
|
||||
/sbin/service messagebus start >/dev/null 2>/dev/null
|
||||
/sbin/service haldaemon start >/dev/null 2>/dev/null
|
||||
|
||||
device=$(readlink "/sys/class/net/$1/device")
|
||||
iface_udi="$(hal-find-by-property --key=net.interface --string="$1")"
|
||||
[ -n "$iface_udi" ] || fatal "interface $1 not found"
|
||||
|
||||
if echo "$device" | grep -q usb; then
|
||||
cat "$device/../manufacturer"
|
||||
else
|
||||
slot=${device##*/}
|
||||
if [ -n "$slot" ]; then
|
||||
eval description $(lspci -m -s "$slot")
|
||||
fi
|
||||
fi
|
||||
device_udi="$(hal-get-property --udi="$iface_udi" --key=net.originating_device)"
|
||||
[ -n "$device_udi" ] || fatal "originating device for interface $1 not found"
|
||||
|
||||
device_subsystem="$(hal-get-property --udi="$device_udi" --key=info.subsystem)"
|
||||
|
||||
case "$device_subsystem" in
|
||||
pci)
|
||||
printf '%s\n' \
|
||||
"$(hal-get-property --udi="$device_udi" --key=pci.product)"
|
||||
;;
|
||||
usb)
|
||||
printf '%s\n' \
|
||||
"$(hal-get-property --udi="$device_udi" --key=usb.vendor)"
|
||||
;;
|
||||
*)
|
||||
fatal "wrong device subsystem $device_subsystem"
|
||||
esac
|
||||
|
15
alterator-net-common/tools/ifcheckwireless
Executable file
15
alterator-net-common/tools/ifcheckwireless
Executable file
@ -0,0 +1,15 @@
|
||||
#!/bin/sh
|
||||
|
||||
. shell-error
|
||||
|
||||
[ -z "$1" ] && fatal "Usage: $0 <interface>"
|
||||
|
||||
/sbin/service messagebus start >/dev/null 2>/dev/null
|
||||
/sbin/service haldaemon start >/dev/null 2>/dev/null
|
||||
|
||||
iface_udi="$(hal-find-by-property --key=net.interface --string="$1")"
|
||||
[ -n "$iface_udi" ] || fatal "interface $1 not found"
|
||||
|
||||
[ "$(hal-get-property --udi="$iface_udi" --key=info.category)" = "net.80211" ]
|
||||
|
||||
|
16
alterator-net-common/tools/ifdriver
Executable file
16
alterator-net-common/tools/ifdriver
Executable file
@ -0,0 +1,16 @@
|
||||
#!/bin/sh
|
||||
|
||||
. shell-error
|
||||
|
||||
[ -z "$1" ] && fatal "Usage: $0 <interface>"
|
||||
|
||||
/sbin/service messagebus start >/dev/null 2>/dev/null
|
||||
/sbin/service haldaemon start >/dev/null 2>/dev/null
|
||||
|
||||
iface_udi="$(hal-find-by-property --key=net.interface --string="$1")"
|
||||
[ -n "$iface_udi" ] || fatal "interface $1 not found"
|
||||
|
||||
device_udi="$(hal-get-property --udi="$iface_udi" --key=net.originating_device)"
|
||||
[ -n "$device_udi" ] || fatal "originating device for interface $1 not found"
|
||||
|
||||
hal-get-property --udi="$device_udi" --key=info.linux.driver
|
@ -1,4 +1,11 @@
|
||||
#!/bin/sh
|
||||
|
||||
/sbin/ip -o a l|
|
||||
sed -nre 's|^[0-9]+: ([^:]+): [^/]* link/ether ([a-f0-9:]+).*|\1 \2|p'
|
||||
/sbin/service messagebus start >/dev/null 2>/dev/null
|
||||
/sbin/service haldaemon start >/dev/null 2>/dev/null
|
||||
|
||||
(hal-find-by-capability --capability=net.80203 ; hal-find-by-capability --capability=net.80211)|
|
||||
while read udi ;do
|
||||
printf '%s %s\n' \
|
||||
"$(hal-get-property --udi=$udi --key=net.interface)" \
|
||||
"$(hal-get-property --udi=$udi --key=net.address)"
|
||||
done
|
||||
|
Loading…
x
Reference in New Issue
Block a user