Re: [DNG] Wifi device names: was systemd is haunting me

2016-02-10 Thread Steve Litt
On Mon, 01 Feb 2016 17:08:17 +
Rainer Weikusat  wrote:

> Steve Litt  writes:
> > On Sun, 31 Jan 2016 18:20:12 -0500
> > Steve Litt  wrote:  
> 
> [...]
> 
> > ===
> > #!/bin/sh
> > lineno=${1:-1}
> >
> > fn=`mktemp`
> >
> > ip -o link | \
> >   cut -d ' ' -f2 | \
> >   grep ^w | \
> >   tr -d : > $fn
> >
> > maxdev=`wc -l $fn | cut -d ' ' -f 1`
> > if test $maxdev -lt $lineno; then
> >echo =max$maxdev
> > else
> >   head $fn -n $lineno | \
> >   tail -n 1
> > fi
> > rm $fn
> > ===  
> 
> [...]
> 
> > There are probably better ways to write this script, but I think the
> > way I have it here exhibits the behavior I'd like.  
> 
> 'Better' is often very much a matter of opinion but here's one which
> doesn't need a temporary file:
> 
> -
> #!/bin/sh
> want=${1:-1}
> got=0
> 
> for dev in `ip -o link | sed -n 's/[^:]*: *\(w[^:]*\).*/\1/p'`;
> do
> got=`expr $got + 1`
> 
> test $got -eq $want && {
>   echo $dev
>   exit 0
> }
> done
> 
> echo =max$got


Hi Rainer,

At the start of this thread, I had put my contribution into the Public
Domain. Then you and I started incrementally improving it, so it's
pretty much a mashup of both our works.

I'd like to use it in a package of shellscripts I'll be releasing as
Free Software. For this particular shellscript written by both of us,
would it be OK with you if we licensed it under the Expat license?

http://directory.fsf.org/wiki/License:Expat

The preceding is basically a dup of the MIT license and some of the
later BSD licenses, but by calling it "Expat" we rule out various
versions and the like.

Is it OK with you to license it Expat? Is it OK with you if both our
names appear on the Copyright line? If so, is the exact correct
spelling of your name "Rainer Weikusat"?

Did anyone else substantially contribute in creating the shellscript to
derive the Wifi device name on systems with the new "predictable"
device names? If so, same questions to you.

Thanks,

SteveT

Steve Litt 
February 2016 featured book: The Key to Everyday Excellence
http://www.troubleshooters.com/key
___
Dng mailing list
Dng@lists.dyne.org
https://mailinglists.dyne.org/cgi-bin/mailman/listinfo/dng


Re: [DNG] Wifi device names: was systemd is haunting me

2016-02-10 Thread Rainer Weikusat
Steve Litt  writes:
> Rainer Weikusat  wrote:

[shell scripts]

> At the start of this thread, I had put my contribution into the Public
> Domain. Then you and I started incrementally improving it, so it's
> pretty much a mashup of both our works.

[...]

> Is it OK with you to license it Expat? Is it OK with you if both our
> names appear on the Copyright line? If so, is the exact correct
> spelling of your name "Rainer Weikusat"?

How 'legal' do you want this to be? My work contract has a clause which
states that even if I dream of code/ something else which might be
useful, the rights rest with my employer. OTOH, my employer doesn't care
about this and neither do I: If I just post the code without adding
something like "this is copyrighted by ... and quoted here for
educational purposes", you (or anyone else) can assume "public domain".

Spelling is correct.
___
Dng mailing list
Dng@lists.dyne.org
https://mailinglists.dyne.org/cgi-bin/mailman/listinfo/dng


Re: [DNG] Wifi device names: was systemd is haunting me

2016-02-10 Thread Daniel Reurich

> How 'legal' do you want this to be? My work contract has a clause which
> states that even if I dream of code/ something else which might be
> useful, the rights rest with my employer. 

That's insane and surely it's legally unenforceable, and certainly if
they don't pay you for the time spent dreaming code

D:

-- 
Daniel Reurich
Centurion Computer Technology (2005) Ltd.
021 797 722



signature.asc
Description: OpenPGP digital signature
___
Dng mailing list
Dng@lists.dyne.org
https://mailinglists.dyne.org/cgi-bin/mailman/listinfo/dng


Re: [DNG] Wifi device names: was systemd is haunting me

2016-02-10 Thread Steve Litt
On Thu, 11 Feb 2016 12:10:23 +1300
Daniel Reurich  wrote:

> > How 'legal' do you want this to be? My work contract has a clause
> > which states that even if I dream of code/ something else which
> > might be useful, the rights rest with my employer.   
> 
> That's insane and surely it's legally unenforceable, and certainly if
> they don't pay you for the time spent dreaming code
> 
> D:


Hi Daniel,

You'd be hugely surprised at how literally some states in the US
interpret contracts. I live in (anti-employee) Florida, and a friend of
mine here in Florida was advised by his lawyer to not work for Linux for
the next 6 months because his former employer had a 6 month
anti-compete on any Linux work. His lawyer said he'd likely lose the
case if he did Linux and his old employer sued.

Meanwhile, in California, that kind of non-compete is illegal.

This often becomes a problem in Free Software, as former employers
covet Free Software rights on software written by their employees on
the employee's own time and with the employee's own computer.

This is the reason a lot of Free Software authors assign all rights to
the FSF. I don't do that because I've been self-employed since 1982.

SteveT

Steve Litt 
February 2016 featured book: The Key to Everyday Excellence
http://www.troubleshooters.com/key
___
Dng mailing list
Dng@lists.dyne.org
https://mailinglists.dyne.org/cgi-bin/mailman/listinfo/dng


Re: [DNG] Wifi device names: was systemd is haunting me

2016-02-01 Thread Rainer Weikusat
Steve Litt  writes:
> On Sun, 31 Jan 2016 18:20:12 -0500
> Steve Litt  wrote:

[...]

> ===
> #!/bin/sh
> lineno=${1:-1}
>
> fn=`mktemp`
>
> ip -o link | \
>   cut -d ' ' -f2 | \
>   grep ^w | \
>   tr -d : > $fn
>
> maxdev=`wc -l $fn | cut -d ' ' -f 1`
> if test $maxdev -lt $lineno; then
>echo =max$maxdev
> else
>   head $fn -n $lineno | \
>   tail -n 1
> fi
> rm $fn
> ===

[...]

> There are probably better ways to write this script, but I think the
> way I have it here exhibits the behavior I'd like.

'Better' is often very much a matter of opinion but here's one which
doesn't need a temporary file:

-
#!/bin/sh
want=${1:-1}
got=0

for dev in `ip -o link | sed -n 's/[^:]*: *\(w[^:]*\).*/\1/p'`;
do
got=`expr $got + 1`

test $got -eq $want && {
echo $dev
exit 0
}
done

echo =max$got

___
Dng mailing list
Dng@lists.dyne.org
https://mailinglists.dyne.org/cgi-bin/mailman/listinfo/dng


Re: [DNG] Wifi device names: was systemd is haunting me

2016-01-31 Thread Didier Kryn

Le 31/01/2016 03:12, Steve Litt a écrit :

#!/bin/sh
if test "$#" == "0"; then
   lineno="1"
else
   lineno=$1
fi

ip link | \
   cut -d ' ' -f2 | \
   grep ^w | \
   sed -e "s/:\s*$//" | \
   head -n $lineno | \
   tail -n 1


Doesn't work out of the box.

If /usr/bin/test was invoqued you should write '-eq' instead of 
'=='. But shell languages have non-standard built-ins. If /bin/sh points 
to dash, like in Debian, then the built-in test would accept '='. I 
guess '==' is a bashism (actually the adoption of a Cism by a shell 
language). Replacing '==' by '=' just works.


Thanks for the script nevertheless :-)

Didier

___
Dng mailing list
Dng@lists.dyne.org
https://mailinglists.dyne.org/cgi-bin/mailman/listinfo/dng


[DNG] Wifi device names: was systemd is haunting me

2016-01-30 Thread Steve Litt
On Sat, 30 Jan 2016 19:26:48 -0500
Haines Brown  wrote:

> I have been running Debian Sid on a laptop with a purged systemd for
> quite a few months. Maybe when I now ran # aptitude update or
> safe-upgrade for the first time after several months since the Sid
> installation systemd-udevd seems to have switched my wireless
> interface from wlan0 to wlp3s0.

I hereby donate the following shellscript to the public domain:


#!/bin/sh
if test "$#" == "0"; then
  lineno="1"
else
  lineno=$1
fi

ip link | \
  cut -d ' ' -f2 | \
  grep ^w | \
  sed -e "s/:\s*$//" | \
  head -n $lineno | \
  tail -n 1



After naming the preceding shellscript get_wifi_dev.sh, I ran it an ip
command diagnostic and get_wifi_dev.sh, and here is what happened:



[slitt@mydesk ~]$ ip link | cut -d ' ' -f1-3 | grep "^\S"
1: lo: 
2: enp3s0: 
3: wlp0s18f2u5: 
[slitt@mydesk ~]$ mydev=`get_wifi_dev.sh`
[slitt@mydesk ~]$ echo $mydev
wlp0s18f2u5
[slitt@mydesk ~]$


If you suspect you have more than one wifi device, you can specify
which one with a numeric argument to get_wifi_dev.sh, where 1 gets you
the first wifi device reported by ip link, 2 gets the second, and so
on. If your argument is greater than the number of wifi devices, it
just reports the last one reported by ip link.

So regardless of how crazy your wifi device naming gets, you can put
your device's name in a simple and memorable environment variable.

SteveT

Steve Litt 
January 2016 featured book: Twenty Eight Tales of Troubleshooting
http://www.troubleshooters.com/28


___
Dng mailing list
Dng@lists.dyne.org
https://mailinglists.dyne.org/cgi-bin/mailman/listinfo/dng