mirror of
https://github.com/LnL7/nix-darwin.git
synced 2024-08-17 00:20:44 +03:00
Merge pull request #854 from kallisti-dev/fix/network-names-shell-escapes
fix shell escaping in networking config
This commit is contained in:
commit
3ac7acd32d
@ -107,13 +107,13 @@ in
|
||||
echo "configuring networking..." >&2
|
||||
|
||||
${optionalString (cfg.computerName != null) ''
|
||||
scutil --set ComputerName '${cfg.computerName}'
|
||||
scutil --set ComputerName ${escapeShellArg cfg.computerName}
|
||||
''}
|
||||
${optionalString (cfg.hostName != null) ''
|
||||
scutil --set HostName '${cfg.hostName}'
|
||||
scutil --set HostName ${escapeShellArg cfg.hostName}
|
||||
''}
|
||||
${optionalString (cfg.localHostName != null) ''
|
||||
scutil --set LocalHostName '${cfg.localHostName}'
|
||||
scutil --set LocalHostName ${escapeShellArg cfg.localHostName}
|
||||
''}
|
||||
|
||||
${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…
Reference in New Issue
Block a user