mirror of
https://github.com/LnL7/nix-darwin.git
synced 2025-03-05 08:17:01 +00:00
fix shell escaping in networking config
This commit is contained in:
parent
74ab0227ee
commit
5cec74dae1
2 changed files with 18 additions and 3 deletions
|
@ -107,13 +107,13 @@ in
|
||||||
echo "configuring networking..." >&2
|
echo "configuring networking..." >&2
|
||||||
|
|
||||||
${optionalString (cfg.computerName != null) ''
|
${optionalString (cfg.computerName != null) ''
|
||||||
scutil --set ComputerName '${cfg.computerName}'
|
scutil --set ComputerName ${escapeShellArg cfg.computerName}
|
||||||
''}
|
''}
|
||||||
${optionalString (cfg.hostName != null) ''
|
${optionalString (cfg.hostName != null) ''
|
||||||
scutil --set HostName '${cfg.hostName}'
|
scutil --set HostName ${escapeShellArg cfg.hostName}
|
||||||
''}
|
''}
|
||||||
${optionalString (cfg.localHostName != null) ''
|
${optionalString (cfg.localHostName != null) ''
|
||||||
scutil --set LocalHostName '${cfg.localHostName}'
|
scutil --set LocalHostName ${escapeShellArg cfg.localHostName}
|
||||||
''}
|
''}
|
||||||
|
|
||||||
${setNetworkServices}
|
${setNetworkServices}
|
||||||
|
|
15
tests/networking-shell-escape.nix
Normal file
15
tests/networking-shell-escape.nix
Normal file
|
@ -0,0 +1,15 @@
|
||||||
|
|
||||||
|
{ config, pkgs, ... }:
|
||||||
|
|
||||||
|
{
|
||||||
|
networking.computerName = "\"Quotey McQuote's Macbook Pro\"";
|
||||||
|
networking.hostName = "\"Quotey-McQuote's-Macbook-Pro\"";
|
||||||
|
|
||||||
|
test = ''
|
||||||
|
echo checking hostname in /activate >&2
|
||||||
|
grep "scutil --set ComputerName '"\""Quotey McQuote's Macbook Pro"\""'" ${config.out}/activate
|
||||||
|
grep "scutil --set LocalHostName '"\""Quotey-McQuote's-Macbook-Pro"\""'" ${config.out}/activate
|
||||||
|
grep "scutil --set HostName "'"\""Quotey-McQuote's-Macbook-Pro"\""'" ${config.out}/activate
|
||||||
|
echo checking defaults write in ${config.out}/activate-user >&2
|
||||||
|
'';
|
||||||
|
}
|
Loading…
Add table
Reference in a new issue