#!/bin/sh

# This file should not be modified -- make local changes to
# /etc/ppp/ip-up.local instead

LOGDEVICE=$6
REALDEVICE=$1

export PATH=/sbin:/usr/sbin:/bin:/usr/bin

# for dynamic DNS support with gnome-ppp and kppp and draknet (adsl)
if grep -iqs '#.*ppp temp entry' /etc/resolv.conf; then
    PPP_TEMP_ENTRY=`grep '#.*ppp temp entry' /etc/resolv.conf | \
       tail -1 | sed 's/.*ppp temp entry/# ppp temp entry/' `
else
    unset PPP_TEMP_ENTRY
fi
if [ -n "$PPP_TEMP_ENTRY" ]; then
    [ -n "$DNS1" ] && \
	echo -e "nameserver $DNS1 $PPP_TEMP_ENTRY" >> /etc/resolv.conf
    [ -n "$DNS2" ] && \
	echo -e "nameserver $DNS2 $PPP_TEMP_ENTRY" >> /etc/resolv.conf
fi

/etc/sysconfig/network-scripts/ifup-post "ifcfg-$LOGDEVICE"

for f in /etc/ppp/ip-up.d/*; do
	[ -x "$f" ] || continue

	# Don't run *.rpm* and *~ scripts
	[ "${f%.rpm*}" = "$f" -a "${f%\~}" = "$f" ] || continue

	"$f" "$@"
done

IP_UP_LOCAL=/etc/ppp/ip-up.local
[ -x "$IP_UP_LOCAL" ] && "$IP_UP_LOCAL" "$@"

exit 0
