2024-01-26 02:50:32 +08:00
|
|
|
#!/bin/sh
|
|
|
|
export VM_DIRECTORY=`ls ~/Parallels | grep vcpkg-osx`
|
|
|
|
export SSH_KEY="$HOME/Parallels/$VM_DIRECTORY/id_guest"
|
|
|
|
export SSH_PUBLIC_KEY="$SSH_KEY.pub"
|
|
|
|
ssh-keygen -P '' -f "$SSH_KEY"
|
|
|
|
if [ `uname -m` = 'arm64' ]; then
|
|
|
|
# on arm64, prlctl does not know the IP address, but luckily for us DNS works
|
|
|
|
export SSH_COOKIE=vcpkg@vcpkgs-Virtual-Machine.local
|
|
|
|
else
|
|
|
|
# on amd64, DNS does not work, but luckily for us prlctl does know the IP
|
|
|
|
export GUEST_IP=`prlctl list --full | sed -nr 's/^.*running *([0-9]{1,3}\.[0-9]{1,3}\.[0-9]{1,3}\.[0-9]{1,3}).*/\1/p'`
|
|
|
|
export SSH_COOKIE=vcpkg@$GUEST_IP
|
|
|
|
fi
|
|
|
|
echo Type 'vcpkg' and press enter
|
2024-06-05 04:35:41 +08:00
|
|
|
ssh-copy-id -i "$SSH_PUBLIC_KEY" $SSH_COOKIE
|
2024-01-26 02:50:32 +08:00
|
|
|
echo Keys deployed
|
2024-06-05 04:35:41 +08:00
|
|
|
ssh $SSH_COOKIE -i "$SSH_KEY" echo hello from \`hostname\`
|
|
|
|
scp -i "$SSH_KEY" ./clt.dmg $SSH_COOKIE:/Users/vcpkg/clt.dmg
|
|
|
|
scp -i "$SSH_KEY" ./setup-box.sh $SSH_COOKIE:/Users/vcpkg/setup-box.sh
|
|
|
|
ssh $SSH_COOKIE -i "$SSH_KEY" chmod +x /Users/vcpkg/setup-box.sh
|
|
|
|
ssh $SSH_COOKIE -i "$SSH_KEY" /Users/vcpkg/setup-box.sh
|