ci/aws: Use powershell for ssh on windows

msys2 just doesn't work when you're running a command noninteractively.
No output is shown. And then using msys2's opensshd doesn't actually
listen exposed. I was unable to connect on port 22 remotely but could
locally in windows. 🤷
This commit is contained in:
Anmol Sethi 2022-12-15 23:56:40 -08:00
parent 6fe4af1105
commit 7310211eaf
No known key found for this signature in database
GPG key ID: 25BC68888A99A8BA
2 changed files with 4 additions and 2 deletions

View file

@ -2,7 +2,7 @@
## _install.sh ## _install.sh
The template for the install script in the root of the repository. The template for the install script in the root of the d2 repository.
### gen_install.sh ### gen_install.sh

View file

@ -418,7 +418,7 @@ init_remote_windows() {
Invoke-WebRequest -Uri "https://github.com/msys2/msys2-installer/releases/download/2022-10-28/msys2-x86_64-20221028.exe" -OutFile "./msys2-x86_64.exe" Invoke-WebRequest -Uri "https://github.com/msys2/msys2-installer/releases/download/2022-10-28/msys2-x86_64-20221028.exe" -OutFile "./msys2-x86_64.exe"
./msys2-x86_64.exe install --default-answer --confirm-command --root C:\msys64 ./msys2-x86_64.exe install --default-answer --confirm-command --root C:\msys64
C:\msys64\msys2_shell.cmd -defterm -here -no-start -mingw64 -c 'pacman -Sy --noconfirm base-devel' C:\msys64\msys2_shell.cmd -defterm -here -no-start -mingw64 -c 'pacman -Sy --noconfirm base-devel vim'
C:\msys64\msys2_shell.cmd -defterm -here -no-start -mingw64 -c 'curl -fsSL https://d2lang.com/install.sh | sh -s -- --tala' C:\msys64\msys2_shell.cmd -defterm -here -no-start -mingw64 -c 'curl -fsSL https://d2lang.com/install.sh | sh -s -- --tala'
C:\msys64\msys2_shell.cmd -defterm -here -no-start -mingw64 -c 'd2 --version' C:\msys64\msys2_shell.cmd -defterm -here -no-start -mingw64 -c 'd2 --version'
@ -448,6 +448,8 @@ $(perl -pe 's#\n#\r\n#' "$ID_PUB_PATH" | jq -Rs .)
\$null = New-Item -Force "\$env:ProgramData\ssh\administrators_authorized_keys" -Value (Get-Content -Path "\$env:ProgramData\ssh\administrators_authorized_keys" | Out-String) \$null = New-Item -Force "\$env:ProgramData\ssh\administrators_authorized_keys" -Value (Get-Content -Path "\$env:ProgramData\ssh\administrators_authorized_keys" | Out-String)
get-acl "\$env:ProgramData\ssh\ssh_host_rsa_key" | set-acl "\$env:ProgramData\ssh\administrators_authorized_keys" get-acl "\$env:ProgramData\ssh\ssh_host_rsa_key" | set-acl "\$env:ProgramData\ssh\administrators_authorized_keys"
New-ItemProperty -Path "HKLM:\SOFTWARE\OpenSSH" -Name DefaultShell -Value "C:\Windows\System32\WindowsPowerShell\v1.0\powershell.exe" -PropertyType String -Force
Restart-Computer Restart-Computer
EOF EOF
) )