Page 1 of 1

Wifi script - criticisms welcome

Posted: 2018-02-21 01:34
by n_hologram
Hey all,

I wrote this rudimentary wifi "manager" (assistant, maybe?) as way to avoid traditional ones, like networkmanager and wicd, due to specific (personal) needs and uses. I'm painfully new to github, and only made this git page to house some common scripts I use from Linux-to-Linux systems, so it's certainly nothing hyper-professional. I just thought I'd share for anyone who is interested, and seek advice as well.

Upsides: insignificant resource usage; uses network/interfaces.d directly; shell script can be modified to add specific needs, like openvpn or macchanger, without unnecessary intrusion (eg, rfkill); and stores network information as files in a common directory (/etc/wpa).

Downsides: currently, no daemon for auto-switching on network change (auto-switching for available networks is a WIP); probably isn't newbie-friendly at all; surely there is at least one or ten unknown issues; doesn't grind coffee beans in the morning. Also, I'm using sysv, so I have no idea what would and woudn't break in systemd.

Constructive criticism welcome and invited.

https://github.com/souperdoupe/crunkbon ... fe-netdude

Re: Wifi script - criticisms welcome

Posted: 2018-02-21 05:02
by Argus
Hey; this looks nice! I'll check it out when I have time. I really like super simple utilities like this.
Maybe I'll post my own such projects / scripts and we can all share and contribute to eachother, as is the open-source way :mrgreen:

Re: Wifi script - criticisms welcome

Posted: 2018-02-21 07:03
by Head_on_a_Stick
Thanks for this, I love these connection scripts :)

I will try it out tonight...

You may want to consider using wpa_supplicant directly (with a dhcp client or static IPs) instead of /etc/network/interfaces — it would be distribution-agnostic and the wpa_supplicant configuration file will automatically switch to the best available network.

Have you seen grml's connection script?

http://deb.grml.org/pool/main/g/grml-network/

I think it needs their core functions as well: http://deb.grml.org/pool/main/g/grml-etc-core/

I use it in my live ISO image and it is most excellent.

There is also TinyCore's cheeky little POSIX script:

https://gist.githubusercontent.com/Head ... ce/wifi.sh

EDIT: you need their tc-functions for that one to work, perhaps crack open one of their ISO images to obtain them.

Re: Wifi script - criticisms welcome

Posted: 2018-02-22 15:18
by sunrat
Is this better than Ceni? it's Antix default network manager and should work in Stretch. siduction also uses it but I'm not sure if Stretch would have the right dependencies although Sid should.
http://download.tuxfamily.org/antix/doc ... Q/net.html

Re: Wifi script - criticisms welcome

Posted: 2018-02-22 15:50
by golinux
@n_hologram . . . Good for you to make it "your way"! You might also want to look at KatolaZ' setnet which you can find here or in the devuan repos. Might be something useful for you in the way he does things. As for me . . . wicd works ootb so allows me to do other things. ;)

Re: Wifi script - criticisms welcome

Posted: 2018-02-22 20:01
by n_hologram
@argus: I'll bet a shell-script megathread would be eye-opening for a lot of post-novice members!

@HoaS: Ironically, the first iteration of the script used wpasupplicant :) #greatminds. The only issue I faced was, when wpa_passphrase generates its own config file, I realized there's no room for extra options; and if I had to trim the fat anyways, network/interfaces seemed more sensible. I'll revisit that one, though.

Also, I like grml's network configurator. I'll have to peruse the source code sometime; never thought about dropping it in a custom spin.

@sunrat: "better" is subjective. I wanted a utility that balanced simplicity with efficiency -- ie, passing a simple command-line argument to connect to a network -- and also one that is simple enough to easily augment (eg, writing a quick, streamlined daemon for basic autoconnection, if that's desirable) without weird issues that I've noticed other network managers tend to spit-out, like rfkill intrusion. ceni is legit, and I actually cited it a point to acknowledge it as one of the inspirations, since managing interfaces is one of its major tasks; however, it's also not a mere 91 lines of code... ;)

@golinux: that is one intense script! I'll try it out tonight. I'm already getting a few ideas.

Re: Wifi script - criticisms welcome

Posted: 2018-02-22 23:45
by sunrat
n_hologram wrote:@sunrat: "better" is subjective...., it's also not a mere 91 lines of code... ;)
Sorry, I didn't mean to sound negative. Should have said "how does it differ from..." 91 lines is indeed impressive.

Ceni uses ncurses and perl so I guess is not a purely shell script. And I had to look - 1679 lines including 200 blank ones. :)

Re: Wifi script - criticisms welcome

Posted: 2018-02-23 16:44
by n_hologram
I didn't take it offensively :) I only wanted to avoid setting high expectations.

Interestingly, I tried the original script on another system, and it didn't work. This is a bit embarrassing...
EDIT: Fixed, had some things misquoted.

I did take HaoS' advice and made a separate variant based on wpasupplicant, with its own separate install script and config folder, and that one DID work on the other system, so I assume it's good to go. Testers welcome.