modemprobe_erase 2.8 KB

12345678910111213141516171819202122232425262728293031323334353637383940414243444546474849505152535455565758596061626364656667686970717273747576
  1. #!/bin/sh
  2. #called from modemprobe
  3. #delete current modem setting.
  4. #v416 manage linuxant modems
  5. #v432 Undo automatic HCF/HSF overrides if modem selection is already cleared, to require second erase to reset the overrides.
  6. #101203 bk: modified.
  7. #120201 BK: internationalized.
  8. #120924 rerwin: Extend to all linuxant modems the modemx file removal on erase-with-no-modem-set,.
  9. export TEXTDOMAIN=modemprobe_erase
  10. export OUTPUT_CHARSET=UTF-8
  11. KERNVER="`uname -r`"
  12. rm -f /dev/modem
  13. #v432 If no modem currently "detected", reset ALSA override of HSF driver (and vice versa).
  14. if [ ! -e /etc/wvdial.conf ] \
  15. || grep -q -E '^Modem = (/dev/MYDEVM|MYDEVM)' /etc/wvdial.conf;then
  16. rm -f /etc/modprobe.d/modemx_dgc* #120924
  17. rm -f /etc/modprobe.d/modemx_hcf* #120924
  18. rm -f /etc/modprobe.d/modemx_hsf* #120924
  19. fi #v432 end
  20. #100908 Delete modem configuration files, to allow fresh start.
  21. rm -f /etc/modprobe.d/modem_* #120924
  22. #100909 Reset config file modem and alternate.
  23. [ -e /etc/wvdial.conf ] \
  24. && sed -i \
  25. -e 's%^Modem = .*%Modem = MYDEVM%' \
  26. -e '/^#Modem = .*/d' \
  27. /etc/wvdial.conf #424
  28. #v432 Remove ttyS_, ttySHCF, ttyHSF, & ttySL0 device links and nodes, to prevent wvdialconf from finding an incorrect device name after a modem-hardware change.
  29. rm -f /dev/ttyS_* /dev/ttySHCF* /dev/ttySHSF* /dev/ttySL0 /dev/ttySM0
  30. sed -i \
  31. -e /^agrsm$/d \
  32. -e /^dgcmodem$/d \
  33. -e /^ess$/d \
  34. -e /^hcfpcimodem$/d \
  35. -e /^hsfmodem$/d \
  36. -e /^intel53[67]ep$/d \
  37. -e /^ltmodem$/d \
  38. -e /^martian$/d \
  39. -e /^mwavem-1.0.2$/d \
  40. -e /^pctel$/d \
  41. -e /^slmodem$/d \
  42. -e /^Slmodemusb$/d \
  43. /etc/modules/firmware.dep.inst.${KERNVER} 2>/dev/null #101203 bugfix.
  44. #v433 Remove initialization scripts for USB modems in case modem removed...
  45. rm -f /etc/init.d/Dgcmodem
  46. rm -f /etc/init.d/Slmodemusb
  47. #101203 more
  48. rm -f /etc/init.d/agrsm
  49. rm -f /var/local/pupdial/hotpluggable
  50. #101231 Since SmartLink USB modem no longer being used, kill its application daemon to avoid hanging system if modem unplugged after erase.
  51. ALLPS="`ps`"
  52. [ "`echo "$ALLPS" | grep -w 'slmodemd' | grep -w '/dev/slusb0'`" != "" ] \
  53. && killall -q slmodemd
  54. #xmessage "/dev/modem deleted, 'Modem' entry in /etc/wvdialconf initialized."
  55. /usr/lib/gtkdialog/box_splash -placement center -close box -text "$(gettext "/dev/modem deleted, 'Modem' entry in /etc/wvdial.conf initialized. You need to reboot before trying PupDial again. Well, you do need to reboot for internal modems, as they get detected at bootup. For an external 'hotpluggable' nodem, there is no need to reboot -- if the modem is plugged in, run PupDial now (wait several seconds after plugging it in before starting PupDial)")" &
  56. #101203 kill pupdial...
  57. ALLPS="`ps`"
  58. PIDS="`echo "$ALLPS" | grep -E 'gtkdialog3 --center --program=MAINDIALOG|modemprobe|pupdial' | grep -v 'modemprobe_erase' | cut -f 1 -d ' ' | tr '\n' ' '`"
  59. kill $PIDS 2>/dev/null
  60. kill $PIDS 2>/dev/null
  61. ###END###