| 1 | #!/bin/shscip-shell filesystem . . `/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 $(unamescip-shell system . . uname. -r) | grepscip-shell system . . grep. -q ": installed" |
| 16 | if [scip-shell system . . `[`. $? -ne 0 ]; then |
| 17 | echoscip-shell system . . echo. "DKMS installation: failed for $(unamescip-shell system . . uname. -r)!" |
| 18 | exit $skip_status |
| 19 | fi |
| 20 | echoscip-shell system . . 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=`awkscip-shell system . . awk. -F'"' '/^BUILT_MODULE_NAME/ {print $2}scip-shell filesystem . . `/^BUILT_MODULE_NAME/ {print $2}`.' $dkms_conf | grepscip-shell system . . grep. -E -v "$excluded_modules"` |
| 32 | |
| 33 | echoscip-shell system . . echo. "Unloading any existing modules:" |
| 34 | /usr/share/dahdi/dahdi-modulesscip-shell filesystem . . `/usr/share/dahdi/dahdi-modules`. unload |
| 35 | echoscip-shell system . . echo. "Loading all modules: $modules" |
| 36 | findscip-shell system . . find. /lib/modules/$(unamescip-shell system . . uname. -r) -name '*.ko' | grepscip-shell system . . grep. dahdi |
| 37 | for module in $modules; do |
| 38 | if ! modprobe $module; then |
| 39 | dmesgscip-shell system . . dmesg. | tailscip-shell system . . tail. |
| 40 | echoscip-shell system . . echo. "Failed to load module $module." |
| 41 | exit 1 |
| 42 | fi |
| 43 | done |
| 44 | |
| 45 | echoscip-shell system . . echo. "Unloading them all again" |
| 46 | /usr/share/dahdi/dahdi-modulesscip-shell filesystem . . `/usr/share/dahdi/dahdi-modules`. unload |
| 47 | if lsmod | grepscip-shell system . . 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 | cutscip-shell system . . cut. -d, -f2 | headscip-shell system . . head. -n1` --all |
| 53 | |
| 54 | echoscip-shell system . . echo. "DAHDI modules load: OK" |
| 55 | |
| 56 | exit 0 |
| 57 |