I just installed Alpine linux, and it all went as smoothly as i'd hoped, except for the wireless networking (and XFCE's Power button and reboot buttons being greyed out, but that's irrelevant here).I won't be the one using the computer, the only two things it needs to be able to do is connect to wireless networks and access the internet via a browser. But because the people using this computer are complete goofs with tech, I can't really tell them to do this (alpine linux wireless connection guide) every time they change networks; the mere sight of a terminal would freak them out. And so I need to get them a GUI.I tried messing around looking for network manager GUIs for Alpine linux. What i really need is something like Wicd, but I  only found connman and networkmanager in Alpine's testing repositories, however neither of them would launch properly, I have doubts I could get wicd to work on my own even if I manage to learn how to create APKBUILDs and compile it on time..So I thought in the end before I give up maybe I can create something with a script. I mean all I need it to do is what it says in the wireless connection guide on the alpine linux wiki, as sudo.Just runningiwlist wlan0 scanningGrepping my way to the ESSIDs and listing them all neatly, maybe ordered by signal strength. Then after one is selected a password prompt will show asking for the passphrase. And after that...iwconfig wlan0 essid MyNet #set SSIDwpa_passphrase PASSPHRASE > wpa.conf #set Passphrasewpa_supplicant -Dwext -iwlan0 -c ./wpa.conf #Connectand that should do it. I can figure out ways to check for connectivity and automate the prompt and so on myself, but I need to know to begin with if this can be done without just writing a complete GTK or Qt program.I would like to do this in a script kind of way quick and easy with something like Zenity, can it be done? Could someone give me an example? Thanks.(Btw Alpine ships with ASH, not BASH, it'd be best if I can do the scripting in ASH, but if not I don't mind using BASH or Python)
Creating a Wireless Network Management GUI workaround
linux;scripting;wifi;wpa supplicant;zenity
After messing around for hours I managed to cook something decent up using zenity and some sudoers changes. I'll give a step by step how I did it all, in case someone else is caught in the ugly situation of being on a linux distro that only has obsolete wireless networking software (like wireless-tools) without any easy way to get a known GUI like wicd...Dependencies: ash(or bash), sudo, zenity, awk, wget, ping, wpa_supplicant, wireless-tools (ip, iwlist, iwconfig, wpa_passphrase)It also optionally depends on notify-send (those instances can easily be replaced with zenity --notification though)First off I had to set the sudoers file to allow my/all users to run a few specific commands, this is the line (note that I am using alpine linux, you may have the same programs as I do but their executables may be located in a different place, find the correct path for each one first)You'll see one weird command in there (wpa_restart) we will create that file later on.in sudoers(visudo):ALL ALL=(ALL) NOPASSWD: /usr/sbin/iwlist, /usr/sbin/iwconfig, /sbin/ip /sbin/wpa_restartBefore I go on, lets set wpa_supplicant to start at boot (Open-RC users; systemd users will need to do this the systemd way)rc-update add wpa_supplicant bootAfter doing this log in as root (or use su) and run the following:echo > /etc/wpa_supplicant/wpa_supplicant.confchmod +777 /etc/wpa_supplicant/wpa_supplicant.confchmod -r /etc/wpa_supplicant/wpa_supplicant.confecho > /usr/sbin/wireless_guichmod +x /usr/sbin/wireless_guiecho > /usr/sbin/wireless_checkchmod +x /usr/sbin/wireless_checkecho > /sbin/wpa_restartchmod +x /sbin/wpa_restartNext lets actually fill up those files with some scripts.../sbin/wpa_restart (this only works for open-rc, systemd users will need something different, this file is used to restart wpa_supplicant for example if you are switching between connections, or if your connection fails and you need to reconnect and such):#!/bin/ashrc-service wpa_supplicant restart/usr/sbin/wireless_check (checks for connectivity, and launches ssid selection gui if there is none):#!/bin/ash wget -q -s http://google.com if [[ $? -eq 0 ]]; then     eth=$(ifconfig eth0 | grep inet addr)    if [ $eth !=  ];then        SSID=$(iwconfig wlan0 | grep ESSID | cut -d: -f2 )         notify-send Connected to Wireless Network $SSID    else        notify-send Connected Via Ethernet     fielse     /usr/sbin/wireless_gui fi/usr/sbin/wireless_gui (the main deal):#!/bin/ash sudo ip link set wlan0 upssid=$(sudo iwlist wlan0 scanning | awk -F: 'BEGIN{ printf zenity --list --text \Available Networks\ --list --column ESSID --column Security --column Signal ; }/Quality/{ split($0,x,=); Quality = int(x[2]*100/70+.5); }/Encryption/{ Encryption = $2; }/ESSID/{ ESSID = $2; printf %s \%s\ \%s%%\ \\\n, ESSID, Encryption, Quality}' |sh); if [ $ssid !=  ]; then    zenity --warning --text Failed to select network!else    $1=30    echo $1    sudo ip link set wlan0 down     sudo iwconfig wlan0 essid $ssid     wpa_passphrase $ssid > /etc/wpa_supplicant/wpa_supplicant.conf $(zenity --password --title Secured Network)    sudo ip link set wlan0 up     sudo wpa_restart    sleep 2    success=$(ping -q -w 1 -c 1 `ip r | grep default | cut -d ' ' -f 3` > /dev/null && echo ok || echo error)    if [ $success = error ]; then        echo $success        zenity --question --title Wrong Password --text Retry?        while [[ $? -eq 0 ]]; do            wpa_passphrase $ssid > /etc/wpa_supplicant/wpa_supplicant.conf $(zenity --password --title Secured Network)            sudo wpa_restart            sleep 2            success=$(ping -q -w 1 -c 1 `ip r | grep default | cut -d ' ' -f 3` > /dev/null && echo ok || echo error)            if [ $success = error ]; then                zenity --question --title Wrong Password --text Retry?            else                notify-send Connected to Wireless Network $ssid                break            fi        done    else        notify-send Connected to Wireless Network $ssid    fifiNow that's what I call working with what you've got :)Now get out of that root/su prompt, run wireless_gui once as a user and see if everything works, and you're done.If it doesn't work the only thing that can be wrong is that you don't have ash (replace #!/bin/ash with #!/bin/bash to fix), you got one of the paths wrong in sudoers, you forgot one of the chmod commands, your wireless interface is not called wlan0 (use ifconfig or ip link to find out, and then rename all mentions of wlan0 to whatever it is your interface is named) or of course, you're missing a dependency.The way this should be set up ideally is that wireless_check is run everytime you log in to a desktop environment. It checks for internet connectivity and then throws a notification if you're connected, launches wireless_gui if you're not. Wireless GUI will scan for and list all nearby ESSIDs, you pick one, then enter a password. If it fails to connect it will ask you if you want to retry typing the password until you either succeed or say no.A really nice solution if you either don't want to install a network manager, or if you (like me) can't.