WiFi connection script generator.
A CLI tool generating scripts for connecting to WiFi, circumventing big WiFi management tools.
hifi
A tool for generating wifi connection scripts. Uses wpa_supplicant to connect.
Prerequisites
You will need to have wpa_supplicant
, wpa_passphrase
and dhcpcd
installed, as that is what is used in the connection scripts generated by hifi.
Installation
To install, simply do either:
stack install hifi
or
git clone https://gitlab.com/gonz/hifi ./hifi && cd hifi && stack install
Usage
hifi <filename> <interface> <ssid> <passphrase>
The filename parameter determines what your data and script files will be called. They are stored in your XDG data directory, which by default (in most distros) will mean your files will end up in $HOME/.local/share/hifi/...
.
The SSID and passphrase parameters should be obvious enough. They are simply the connection information you would use to connect to your network.
When a script has been generated once it will not have to be generated again. Instead, you should simply run the generated script.
Typical usage looks as follows, for a first run:
$ hifi wifi-home wlp7s0 MyWLANsSSID MyPassphrase
Created /home/yourusername/.local/share/hifi/data/wifi-home and /home/yourusername/.local/share/hifi/scripts/wifi-home
$ wifi-home
Your $PATH variable and connect scripts
If you want to be able to run the scripts without issuing their full path you will need to add your scripts folder to your path. You can do this in several ways, but the most common one is to add the following to your bash_profile
, zsh_profile
, zsh_env
file or the like:
PATH=".local/share/hifi/scripts:$PATH"
where $PATH can either refer to the rest of your $PATH environment variable or simply a literal containing all your specified directories.
Folders, templates
hifi will generate a script for connecting and a data portion that will be used in the script.
The scripts are located in $HOME/.local/share/hifi/scripts
and the data portion in the data
directory of that same hifi root folder.
hifi uses templates that are located in the templates
directory, so you can change the template being used to generate both the data files and the scripts.
The templates are copied on cabal install
and stack install
, so any changes made will carry on to the installed version.
The templateDir
function will return the directory where the files end up being stored. This varies, so that is why it uses getDataFileName
and the data-files
entry in the cabal-file.