dahdi_span_assignments: matched and unmatched
[dahdi/tools.git] / hotplug / dahdi_auto_assign_compat
1 #! /bin/sh
2
3 devdir='/sys/bus/dahdi_devices/devices'
4
5 # DAHDI is loaded?
6 if [ ! -d "$devdir" ]; then
7         exit 0
8 fi
9
10 devices_by_registration_time() {
11         grep -H '' $devdir/*/registration_time 2>/dev/null | \
12                 sed 's,/registration_time:,\t,' | \
13                 sort -k 2,2
14 }
15
16 # First assign non-Astribank devices
17 devices_by_registration_time | \
18         grep -v '/astribanks:' | \
19         while read devpath time; do
20                 echo >&2 "D: auto '$devpath'"
21                 dahdi_span_assignments auto "$devpath"
22         done
23
24 # Now handle Astribanks
25 LC_ALL=C dahdi_registration -Rv on