Stuff that has not yet gone into the official build.
Post a reply

refracta network configurator

Sat Jun 15, 2013 7:10 pm

Just some snippets at this point.
Code:
select interface in $(awk -F, '/NAME/ { print $8 }' /etc/udev/rules.d/70-persistent-net.rules | sed 's/NAME=//g' | sed 's/"//g' ); do echo "$interface"; break; done


iwlist $interface scan >> scanned
grep -A5 Cell scanned
select cell in $(grep ESSID scanned) ; do echo "Cell is $cell"; done

function wired {
echo "
# mode="static|dhcp" (pick one)
iface $interface inet $mode
  address  $address
  netmask  $netmask
  gateway  $gateway
auto $interface
"   >> /etc/network/interfaces
}

function wireless {
same as above but with more fields to fill in...
}

echo "Do you want to review this in a text editor to make sure the programmer didn't muck it up?"

ifup $interface

Re: refracta network configurator

Sun Jun 16, 2013 12:57 pm

Dean,
Go ahead and steal this - it's based on code that I already stole from dzz. See refracta2usb for examples.
Code:
face=$(awk -F, '/NAME/ { print $8 }' /etc/udev/rules.d/70-persistent-net.rules | sed 's/NAME=//g' | sed 's/"//g' )

cards=$(hwinfo --netcard --short)

interface=$(yad --list --separator=" " --column="" --text="Select a network interface.\n\n$cards" $face)

Note that the last line ends with $face and NOT "$face".


Putting this one here for reference. It shows how to get awk to print from a particular field all the way to the end.
Code:
lshw -short | awk '/net/ { print  $2 "\t"  substr($0, index($0,$4)) }'

Re: refracta network configurator

Tue Jun 18, 2013 10:34 pm

you lost me :D

Re: refracta network configurator

Wed Jun 19, 2013 12:32 am

It's not a script. You can run some of the commands and look at the output. The idea was to get the necessary information to fill in variables, then use those to create an entry in /etc/network/interfaces, then use ifup to bring up the interface.

Another way would be to get the same information and then use it with ifconfig. That would be a one-shot deal, and you'd have to do it every time. Might be good if you travel and use different networks. Just brainstorming. Ideas are welcome.

Re: refracta network configurator

Thu Jun 20, 2013 11:16 am

whew I thought my skills were failing me...

now that I understand...it looks like a good start...

Not sure if asking to pick dhcp or static is a good thing as those that don't know probably want dhcp but may pick static.Maybe a message that if you dont know which one then you probably want dhcp and default to dhcp anyway. Or maybe some way to just do dhcp unless the user takes some kind of action to have the static choice presented? Not sure what is possible in that regard....

I think adding the info to interfaces and then upping that interface is probably the right approach...although if it is done that way and then the next boot the nextwork or interface isn't available....might be problematic...so maybe not..

requires more thinking maybe....
Post a reply