# dhcpd_pid=/var/run/dhcpd-eth0.pid dhcpcd_pid=/var/run/dhcpcd-eth0.pid proxyconf=/home/zaurus/Applications/Network/modules/Proxies.conf user_id=zaurus card=eth0 net_if_up() { if [ "$NETMASK" = "" ]; then NETMASK=255.255.255.0 fi if [ ! -f $proxyconf.template ]; then cp $proxyconf $proxyconf.template fi if [ "$PROXY" = "1" ]; then sed -e "s/type = 0/type = 1/g" -e "s/httphost =.*/httphost = $PROXYHOST/g" -e "s/httpport =.*/httpport = $PROXYPORT/g" -e "s/ftphost =.*/ftphost = $PROXYHOST/g" -e "s/ftpport =.*/ftpport = $PROXYPORT/g" $proxyconf.template > $proxyconf else sed -e "s/type = 1/type = 0/g" $proxyconf.template > $proxyconf fi # DHCP client if [ "$DHCPC" = "yes" -a -f /sbin/dhcpcd ]; then if [ ! -f $dhcpcd_pid ]; then ID=`id -u` if [ "$ID" = "0" ]; then /sbin/dhcpcd $card >/dev/null 2>&1 su $user_id -c "qcop QPE/Network \"up()\" >/dev/null 2>&1" else sudo /sbin/dhcpcd $card >/dev/null 2>&1 qcop QPE/Network "up()" >/dev/null 2>&1 fi fi else ID=`id -u` if [ "$ID" = "0" ]; then ifconfig $card $IP netmask $NETMASK up su $user_id -c "qcop QPE/Network \"up()\" >/dev/null 2>&1" else sudo ifconfig $card $IP netmask $NETMASK up qcop QPE/Network "up()" >/dev/null 2>&1 fi if [ "$GATEWAY" != "" ]; then route add default gw $GATEWAY fi if [ "$DOMAIN" != "" ]; then #domainname $DOMAIN echo domain $DOMAIN > /etc/resolv.conf else echo > /etc/resolv.conf fi if [ "$DNS1" != "" ]; then echo nameserver $DNS1 >> /etc/resolv.conf fi if [ "$DNS2" != "" ]; then echo nameserver $DNS2 >> /etc/resolv.conf fi fi } net_if_down() { if [ -f $dhcpd_pid ]; then PID=`cat $dhcpd_pid` if [ "$PID" != "" ]; then kill $PID fi rm -f $dhcpd_pid fi if [ -f $dhcpcd_pid ]; then PID=`cat $dhcpcd_pid` if [ "$PID" != "" ]; then kill $PID fi rm -f $dhcpd_pid fi if [ "$GATEWAY" != "" ]; then route del default fi ID=`id -u` if [ "$ID" = "0" ]; then ifconfig $card down su $user_id -c "qcop QPE/Network \"up()\" >/dev/null 2>&1" else sudo ifconfig $card down qcop QPE/Network "down()" >/dev/null 2>&1 fi }