# refracta.freeforums.org

place to talk about refracta

Skip to content

Welcome
Welcome to refracta You are currently viewing our boards as a guest, which gives you limited access to view most discussions and access our other features. By joining our free community, you will have access to post topics, communicate privately with other members (PM), respond to polls, upload content, and access many other special features. In addition, registered members also see less advertisements. Registration is fast, simple, and absolutely free, so please, join our community today!

## refracta network configurator

Stuff that has not yet gone into the official build.
Post a reply
5 posts • Page 1 of 1

### refracta network configurator

by fsmithred » Sat Jun 15, 2013 7:10 pm

Just some snippets at this point.

Code: Select all
  `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
  `

fsmithred
  Posts: 2101
  Joined: Wed Mar 09, 2011 9:13 pm

Top

### Re: refracta network configurator

by fsmithred » 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: Select all
  `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: Select all
  `lshw -short | awk '/net/ { print $2 "\t" substr($0, index($0,$4)) }'`

fsmithred
  Posts: 2101
  Joined: Wed Mar 09, 2011 9:13 pm

Top

### Re: refracta network configurator

by meandean » Tue Jun 18, 2013 10:34 pm

you lost me

meandean
  Posts: 392
  Joined: Wed Mar 09, 2011 5:16 am

Top

### Re: refracta network configurator

by fsmithred » 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.

fsmithred
  Posts: 2101
  Joined: Wed Mar 09, 2011 9:13 pm

Top

### Re: refracta network configurator

by meandean » 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....

meandean
  Posts: 392
  Joined: Wed Mar 09, 2011 5:16 am

Top

Display posts from previous:
Sort by

Post a reply
5 posts • Page 1 of 1

Return to Experimental

Jump to:

### Who is online

Users browsing this forum: No registered users and 0 guests

Donate Now
ProNight Style by ModphpBB3
Hosted by © 2017 FreeForums.org | Create a free forum | Powered by phpBB
A Member of the Crowdgather Forum Community
About FreeForums | Legal | Advertise Here | Investors | Contact FreeForums.org
Report Violation
suspicion-preferred