postplug/postplug.d/40modem

42 lines
756 B
Plaintext
Raw Normal View History

2011-04-27 19:57:03 +02:00
#!/bin/bash
#
# modem configuration plugin for postplug
#
# Copyright (c) 2008 by Silvan Calarco <silvan.calarco@mambasoft.it>
#
[ -r /etc/sysconfig/modem ] && . /etc/sysconfig/modem
[ "$DEVICE" ] && exit 0
DEVICE=`grep "Modem" /proc/asound/pcm|sed "s|\([0-9]*\)-\([0-9]*\):.*|hw:\1,\2|"`
if [ "$DEVICE" ]; then
ALSA=1
else
ALSA=0
DEVICE=/dev/slamr0
fi
[ "$COUNTRY" ] || {
case ${LANG:0:2} in
it) COUNTRY=ITALY ;;
fr) COUNTRY=FRANCE ;;
de) COUNTRY=GERMANY ;;
es) COUNTRY=SPAIN ;;
*) COUNTRY=UK ;;
esac
}
cat > /etc/sysconfig/modem << _EOF
#
# Modem configuration used by the SLMODEM initscript
#
GROUP=dialout
COUNTRY=$COUNTRY
ALSA=$ALSA
DEVICE=$DEVICE
_EOF
[ "$ALSA" = "1" ] && chkconfig --add slmodemd