windows: Fix quoting issues in XML

This commit is contained in:
adisbladis 2020-01-27 20:52:23 +00:00 committed by Stephan Maka
parent a1e5d01f80
commit d90a2716bd
1 changed files with 8 additions and 5 deletions

View File

@ -39,17 +39,20 @@ let
makeDirs = lib.mapAttrsToList (n: v: ''mkdir C:\Users\${n}\.ssh'') users;
writeKeys = lib.flatten (lib.mapAttrsToList (n: v: builtins.map (key: let
commands = [
''echo "${key}" | Out-File -FilePath C:\Users\${n}\.ssh\authorized_keys''
''powershell.exe "echo ${key} | Out-File -FilePath C:\Users\${n}\.ssh\authorized_keys"''
];
in lib.concatStringsSep "\n" commands) (v.sshKeys or [])) users);
in makeDirs ++ writeKeys ++ [
mkDirsDesc = builtins.map (c: {Path = c; Description = "Make SSH key dir";}) makeDirs;
writeKeysDesc = builtins.map (c: {Path = c; Description = "Add SSH key";}) writeKeys;
in mkDirsDesc ++ writeKeysDesc ++ [
# TODO: Figure out how to do this step with sandboxing enabled
{
Path = ''Register-PSRepository -Name "bootstraprepo" -SourceLocation F:\files'';
Path = ''Register-PSRepository -Name bootstraprepo -SourceLocation F:\files'';
Description = "Local powershell repo import";
}
{
Path = ''powershell.exe Install-Module -Repository "bootstraprepo" -Force OpenSSHUtils -Scope AllUsers'';
Path = ''powershell.exe Install-Module -Repository bootstraprepo -Force OpenSSHUtils -Scope AllUsers'';
Description = "Install Openssh.";
}
{
@ -57,7 +60,7 @@ let
Description = "Now start the sshd service.";
}
{
Path = ''powershell.exe Set-Service -Name sshd -StartupType "Automatic"'';
Path = ''powershell.exe Set-Service -Name sshd -StartupType Automatic'';
Description = "Enable SSH by default.";
}
];