From be75c98a06d569fbaa2d86f92676af961795d094 Mon Sep 17 00:00:00 2001 From: Colin Guthrie Date: Fri, 21 Oct 2011 01:28:48 +0100 Subject: Add the mdkconf patch --- mandriva/ifup-hso | 78 +++++++++++++++++++++++++++++++++++++++++++++++++++++++ 1 file changed, 78 insertions(+) create mode 100755 mandriva/ifup-hso (limited to 'mandriva/ifup-hso') diff --git a/mandriva/ifup-hso b/mandriva/ifup-hso new file mode 100755 index 00000000..859e5bf9 --- /dev/null +++ b/mandriva/ifup-hso @@ -0,0 +1,78 @@ +#! /bin/bash + +. /etc/init.d/functions + +cd /etc/sysconfig/network-scripts +. ./network-functions + +CONFIG=$1 +[ -f "${CONFIG}" ] || CONFIG=ifcfg-${1} +source_config + +if [ "${2}" = "boot" -a "${ONBOOT}" = "no" ]; then + exit +fi + +[ -z "$CELLULAR_CID" ] && CELLULAR_CID=1 +[ "${DEBUG}" = "yes" ] && CHATDBG="-v" + +CHATSCRIPT=/etc/sysconfig/network-scripts/chat-${DEVNAME} +[ -f ${CHATSCRIPT} ] || { + CHATSCRIPT=/etc/sysconfig/network-scripts/chat-${PARENTDEVNAME} +} +[ -f ${CHATSCRIPT} ] || { + echo $"/etc/sysconfig/network-scripts/chat-${DEVNAME} does not exist" + echo $"ifup-hso for ${DEVNAME} exiting" + logger -p daemon.info -t ifup-hso \ + $"/etc/sysconfig/network-scripts/chat-${DEVNAME} does not exist for ${DEVICE}" + exit 1 +} + +CELLULAR_PIN=$(cat pin-${DEVICE} 2>/dev/null) +if [ -n "$CELLULAR_PIN" -a -x /usr/sbin/comgt ]; then + COMGTPIN=$CELLULAR_PIN comgt PIN -d $MODEMPORT +fi + +if ! /usr/sbin/chat ${CHATDBG} -s -f ${CHATSCRIPT} < $MODEMPORT > $MODEMPORT; then + echo $"Connect script failed" + exit 1 +fi + +CHATSCRIPT=`mktemp /tmp/chatXXXXXX` +CHATRESULT=`mktemp /tmp/chatXXXXXX` +cat > $CHATSCRIPT < $MODEMPORT 2> ${CHATRESULT}; then + DATA=$(grep ^_OWANDATA $CHATRESULT) + if [ -n "$DATA" ]; then + set $(echo $DATA | cut -d ',' -f 2,4,5 --output-delimiter ' ') + IPADDR=$1 + DNS1=$2 + DNS2=$3 + break + fi + fi + sleep 2 + let TRIES=$TRIES-1 +done +rm -f $CHATSCRIPT $CHATRESULT + +if [ "$TRIES" = 0 ]; then + echo $"Connect script failed (HSO)" + exit 1 +fi + +ifconfig $DEVICE $IPADDR up +route add default dev $DEVICE ${METRIC:+metric $METRIC} +export DNS1 DNS2 +exec /etc/sysconfig/network-scripts/ifup-post ${CONFIG} $BOOTARG -- cgit v1.2.1