1
0
Fork 0
mirror of https://github.com/JasonN3/build-container-installer.git synced 2025-12-25 10:57:55 +01:00

start ssh

This commit is contained in:
Jason N 2024-03-10 08:40:11 -04:00 committed by GitHub
parent 955eb9fb52
commit 476629cee9
No known key found for this signature in database
GPG key ID: B5690EEEBB952194

View file

@ -227,6 +227,13 @@ jobs:
(tail -f vm.stdin | nc localhost 4321 | tee vm.stdout) & (tail -f vm.stdin | nc localhost 4321 | tee vm.stdout) &
timeout 30m bash -c "while ! (grep 'login:' vm.stdout); do sleep 1; done" timeout 30m bash -c "while ! (grep 'login:' vm.stdout); do sleep 1; done"
echo "${VM_USER}" >> vm.stdin
timeout 30m bash -c "while ! (grep 'Password:' vm.stdout); do sleep 1; done"
echo "${VM_Pass}" >> vm.stdin
echo > vm.stdout
timeout 30m bash -c "while ! (grep '#\|\$' vm.stdout); do sleep 1; done"
echo "sudo systemctl start sshd" >> vm.stdin
( timeout 30m bash -c "while ! (grep 'Password' vm.stdout); do sleep 1; done" && echo "${VM_PASS}" >> vm.stdin ) || true
export VM_IP=$({ echo '{"execute": "guest-network-get-interfaces"}'; sleep 2; } | socat unix-connect:/tmp/qga.sock - | jq -r '.return[1]["ip-addresses"][] | select(."ip-address-type"=="ipv4") | .["ip-address"]') export VM_IP=$({ echo '{"execute": "guest-network-get-interfaces"}'; sleep 2; } | socat unix-connect:/tmp/qga.sock - | jq -r '.return[1]["ip-addresses"][] | select(."ip-address-type"=="ipv4") | .["ip-address"]')
if ! (echo > /dev/tcp/${VM_IP}/22) if ! (echo > /dev/tcp/${VM_IP}/22)