:: Re: [DNG] A shell script for networ…
Página superior
Eliminar este mensaje
Responder a este mensaje
Autor: Steve Litt
Fecha:  
A: dng
Asunto: Re: [DNG] A shell script for network connections
On Sat, 31 Dec 2016 17:40:10 +0000
KatolaZ <katolaz@???> wrote:

> On Sat, Dec 31, 2016 at 05:15:56PM +0000, KatolaZ wrote:
> > On Sat, Dec 31, 2016 at 10:38:48AM +0000, KatolaZ wrote:
> >
> > [cut]
> >
> > >
> > >
> > > Hi Steve,
> > >
> > > thanks for your encouragement. bash is currently a requirement,
> > > since I am using a few non-posix little things. So if you want to
> > > test it and report bugs, please use it under bash atm since a few
> > > things will not work at all with dash. I hope I will be able to
> > > port it to posix-sh soon.
> > >
> >
> > Hi All,
> >
> > it turns out that my last statement was wrong. To my own surprise,
> > setnet.sh seems to be already posix-compliant with a very slight
> > modification. In particular, it is sufficient to comment out the
> > keyword "function" in function declarations, which is done with
> >
> > sed -r -e 's/^function\ /##function\ \n/g' setnet.sh > setnet.dash
> >
>
> Actually, it is not that easy, and there are indeed a few things to
> iron out, but it should not be too difficult, I believe :)


Hi KatolaZ,

Right now setnet.sh works only for systems using the old,
non-poetterized eth0 and wlan0 type names, but fighting the nic name
battle is something we'll never win and shouldn't even try.

In function configure_device(), you deduce whether it's wifi or wired
by the device's name, and stuff like eno1 or wlo1 comes out saying
"device can't be configured."

One way to differentiate is the following:

result=`iwlist $devicename scanning | wc -l`

If the preceding yields zero, it's either ethernet or a busted wifi or
some other odd device. If the preceding yields a positive number, it's
a working wifi with ssids in range.

There's probably a better way to deduce wired vs wifi, but if you can't
think of it at the moment, you can just use this. That way everybody
with every distro can use your tool and report back to you. Your tool
is way too valuable to make for just one distro.

My only other comment right now is if there's a way to have a member of
a certain group operate everything, it would be wonderful so we could
use it as slitt (or whatever) rather than as root.

Be sure you have dialog as one of your dependencies. At first it didn't
work until I installed dialog.

Cool program!

SteveT

Steve Litt
December 2016 featured book: Rapid Learning for the 21st Century
http://www.troubleshooters.com/rl21