- if not iface['iface'].startswith('ppp'):
- print 'ifconfig %(iface)s %(ip)s broadcast %(broadcast)s netmask %(mascara)s' % iface
+ if iface['iface'].startswith('ppp'):
+ print 'UP: pppd -detach crtscts lock %(ip)s:%(peer)s /dev/ttyS0' % iface
+ os.system('pppd -detach crtscts lock %(ip)s:%(peer)s /dev/ttyS0 &' % iface)
+ ppp = 1
+ else:
+ print 'UP: ifconfig %(iface)s %(ip)s broadcast %(broadcast)s netmask %(mascara)s' % iface
+ os.system('ifconfig %(iface)s %(ip)s broadcast %(broadcast)s netmask %(mascara)s' % iface)
+ if ppp:
+ print 'while sleep 1; do if ping -c1 %(peer)s 2>&1 > /dev/null; then break; else echo Esperando link ppp...; fi; done' % iface
+ os.system('while sleep 1; do if ping -c1 %(peer)s 2>&1 > /dev/null; then break; else echo Esperando link ppp...; fi; done' % iface)