]> git.ipfire.org Git - people/stevee/network.git/blobdiff - src/functions/functions.wireless-networks
wpa_supplicant: Doesn't like spaces here
[people/stevee/network.git] / src / functions / functions.wireless-networks
index d2a81ac0a0eb0f5cf6df42bd11e37cdc3bb3b3b3..e48919f7dd82c128a47aba0d8c6904bde40d1219 100644 (file)
@@ -333,6 +333,32 @@ wireless_network_priority() {
        fi
 }
 
+wireless_networks_write_wpa_supplicant_configuration() {
+       local device="${1}"
+
+       local file="${WPA_SUPPLICANT_CONF_DIR}/${device}.conf"
+
+       # Ensure we can write the file
+       make_parent_directory "${file}"
+
+       local country="$(wireless_get_reg_domain)"
+
+       (
+               config_header "WPA supplicant configuration file"
+
+               # Set control socket directory.
+               print "ctrl_interface=${WPA_SUPPLICANT_SOCKET_DIR}"
+
+               # Honour country
+               if isset country; then
+                       print "country=${country}"
+                       print
+               fi
+
+               wireless_networks_to_wpa_supplicant
+       ) > ${file}
+}
+
 wireless_networks_to_wpa_supplicant() {
        local handle
        for handle in $(wireless_network_list); do
@@ -409,8 +435,13 @@ wireless_network_to_wpa_supplicant() {
        assert isset key_mgmt
 
        print_indent 0 "# ${SSID}"
-       print_indent 0 "network = {"
+       print_indent 0 "network={"
        print_indent 1 "ssid=\"${SSID}\""
+
+       # Priority
+       if isinteger PRIORITY; then
+               print_indent 1 "priority=${PRIORITY}"
+       fi
        print
 
        # Authentication