#!/bin/sh # use gainroot to become root and relaunch itself if [ `id -u` != 0 ] ; then #if not already root, call itself as root sudo gainroot <<EOF $0 $* EOF exit fi # real script follows BTADDR='xx:xx:xx:xx:xx:xx' IP=192.168.2.2 GW=192.168.2.1 NS=192.168.2.1 IFACE=bnep0 #insmod just to be sure insmod /mnt/initfs/lib/modules/current/bnep.ko #start PAN Bluetooth connection pand --connect $BTADDR # wait for the interface created by pand s=60 echo -n "Waiting $s secs for $IFACE" while [ $s -gt 0 ] ; do ifconfig $IFACE >/dev/null 2>&1 && break s=$((s-1)) echo -n "." sleep 1 done echo if ifconfig $IFACE >/dev/null 2>&1 ; then # bring it up echo "OK, bringing $IFACE up" ifconfig $IFACE $IP up route add default gw $GW echo "nameserver $NS" >/tmp/resolv.conf.lo else echo "Error: $IFACE not available." fi
#!/bin/sh # use gainroot to become root and relaunch itself if [ `id -u` != 0 ] ; then #if not already root, call itself as root sudo gainroot <<EOF $0 $* EOF exit fi # real script follows echo -n '' >/tmp/resolv.conf.lo pand -K sleep 1 rmmod bnep