nixos/wireless: fix failure on missing config file
This change prevents doing the secret substitution when the config is missing, which would result in an error. The service can be useful even without configuration; for example connman controls wpa_supplicant using dbus and as such it does not need a config file nor any other declarative options.
This commit is contained in:
@@ -121,11 +121,15 @@ let
|
||||
''}
|
||||
|
||||
# substitute environment variables
|
||||
${pkgs.gawk}/bin/awk '{
|
||||
for(varname in ENVIRON)
|
||||
gsub("@"varname"@", ENVIRON[varname])
|
||||
print
|
||||
}' "${configFile}" > "${finalConfig}"
|
||||
if [ -f "${configFile}" ]; then
|
||||
${pkgs.gawk}/bin/awk '{
|
||||
for(varname in ENVIRON)
|
||||
gsub("@"varname"@", ENVIRON[varname])
|
||||
print
|
||||
}' "${configFile}" > "${finalConfig}"
|
||||
else
|
||||
touch "${finalConfig}"
|
||||
fi
|
||||
|
||||
iface_args="-s ${optionalString cfg.dbusControlled "-u"} -D${cfg.driver} ${configStr}"
|
||||
|
||||
|
||||
Reference in New Issue
Block a user