| 1 | #!/bin/sh |
| 2 | |
| 3 | #excluded_modules="dahdi_dummy|dahdi_vpmadt032_loader" |
| 4 | # * dahdi_vpmadt032_loader: architecture-dependent. May not exist |
| 5 | # * dahdi_echocan_oslec: fails for an odd reason. No time to figure this |
| 6 | # now. Loads and works fine in the m-a test. |
| 7 | excluded_modules="dahdi_vpmadt032_loader|dahdi_echocan_oslec" |
| 8 | dkms_conf="debian/dkms.conf.in" |
| 9 | skip_status=77 |
| 10 | |
| 11 | # |
| 12 | # Check DKMS installation |
| 13 | # |
| 14 | dkms status |
| 15 | dkms status -k $(uname -r) | grep -q ": installed" |
| 16 | if [ $? -ne 0 ]; then |
| 17 | echo "DKMS installation: failed for $(uname -r)!" |
| 18 | exit $skip_status |
| 19 | fi |
| 20 | echo "DKMS installation: OK" |
| 21 | |
| 22 | # |
| 23 | # Load all the DAHDI modules: |
| 24 | # |
| 25 | |
| 26 | set -e |
| 27 | |
| 28 | # Excuded modules: |
| 29 | # * dahdi_vpmadt032_loader is architecture-dependent |
| 30 | # * dahdi_dummy: should not be on this list. It is not built |
| 31 | modules=`awk -F'"' '/^BUILT_MODULE_NAME/ {print $2}' $dkms_conf | grep -E -v "$excluded_modules"` |
| 32 | |
| 33 | echo "Unloading any existing modules:" |
| 34 | /usr/share/dahdi/dahdi-modules unload |
| 35 | echo "Loading all modules: $modules" |
| 36 | find /lib/modules/$(uname -r) -name '*.ko' | grep dahdi |
| 37 | for module in $modules; do |
| 38 | if ! modprobe $module; then |
| 39 | dmesg | tail |
| 40 | echo "Failed to load module $module." |
| 41 | exit 1 |
| 42 | fi |
| 43 | done |
| 44 | |
| 45 | echo "Unloading them all again" |
| 46 | /usr/share/dahdi/dahdi-modules unload |
| 47 | if lsmod | grep -w echo; then |
| 48 | rmmod echo |
| 49 | fi |
| 50 | |
| 51 | # uninstall, to not get in the way of the m-a test |
| 52 | dkms uninstall dahdi/`dkms status dahdi | cut -d, -f2 | head -n1` --all |
| 53 | |
| 54 | echo "DAHDI modules load: OK" |
| 55 | |
| 56 | exit 0 |
| 57 |