From 231bce76bc69330f775429ee13228c4e5334b7ff Mon Sep 17 00:00:00 2001 From: Michael Tremer Date: Fri, 18 Aug 2017 09:09:49 +0000 Subject: [PATCH] wpa_supplicant: Move configuration to /etc/wpa_supplicant Signed-off-by: Michael Tremer --- src/functions/functions.constants | 3 +++ src/functions/functions.wpa_supplicant | 17 ++++------------- src/helpers/wpa_supplicant | 4 +--- 3 files changed, 8 insertions(+), 16 deletions(-) diff --git a/src/functions/functions.constants b/src/functions/functions.constants index 5467801e..78801da0 100644 --- a/src/functions/functions.constants +++ b/src/functions/functions.constants @@ -45,6 +45,9 @@ NETWORK_IPSEC_POOLS_DIR="${NETWORK_CONFIG_DIR}/vpn/ipsec/pools" NETWORK_IPSEC_SWANCTL_CONNECTIONS_DIR="/etc/swanctl/connections" NETWORK_IPSEC_SWANCTL_POOLS_DIR="/etc/swanctl/pools" +# WPA supplicant +WPA_SUPPLICANT_CONF_DIR="/etc/wpa_supplicant" + # Network file configuration. NETWORK_SETTINGS_FILE=${NETWORK_CONFIG_DIR}/config NETWORK_SETTINGS_FILE_PARAMS="DEBUG" diff --git a/src/functions/functions.wpa_supplicant b/src/functions/functions.wpa_supplicant index b64bf2e2..cc754cf8 100644 --- a/src/functions/functions.wpa_supplicant +++ b/src/functions/functions.wpa_supplicant @@ -27,7 +27,7 @@ wpa_supplicant_config_write() { assert isset device - local file="$(wpa_supplicant_config_dir "${device}")/wpa_supplicant.conf" + local file="${WPA_SUPPLICANT_CONF_DIR}/${device}.conf" local ap_scan=1 mode key ssid local channel @@ -142,8 +142,8 @@ wpa_supplicant_config_write() { ;; esac - local config_dir=$(dirname ${file}) - mkdir -p ${config_dir} 2>/dev/null + # Ensure we can write the file + make_parent_dir "${file}" config_header "WPA supplicant configuration file" > ${file} @@ -215,16 +215,7 @@ wpa_supplicant_config_destroy() { local device="${1}" assert isset device - local file="$(wpa_supplicant_config_dir "${device}")/wpa_supplicant.conf" - - file_delete "${file}" -} - -wpa_supplicant_config_dir() { - local device=${1} - assert isset device - - echo "${RUN_DIR}/wpa_supplicant/${device}" + file_delete "${WPA_SUPPLICANT_CONF_DIR}/${device}.conf" } wpa_supplicant_start() { diff --git a/src/helpers/wpa_supplicant b/src/helpers/wpa_supplicant index 69ee0ee5..5ec227c1 100644 --- a/src/helpers/wpa_supplicant +++ b/src/helpers/wpa_supplicant @@ -30,9 +30,7 @@ assert isset device # Create socket dir. mkdir -p ${WPA_SUPPLICANT_SOCKET_DIR} 2>/dev/null -config_file="$(wpa_supplicant_config_dir ${device})/wpa_supplicant.conf" - -cmd="wpa_supplicant -i ${device} -c ${config_file}" +cmd="wpa_supplicant -i ${device} -c ${WPA_SUPPLICANT_CONF_DIR}/${device}.conf" if device_is_wireless ${device}; then cmd="${cmd} -Dwext" -- 2.47.2