mirror of
https://github.com/rancher/os.git
synced 2025-08-31 22:32:14 +00:00
make run and ssh scripts more robust
Detect if KVM is available. Enable QEMU to run w/o KVM (in the cloud or on OS X). Use --xhyve flag to run with xhyve on OS X.
This commit is contained in:
18
scripts/ssh
18
scripts/ssh
@@ -7,10 +7,24 @@ chmod 0600 ./assets/rancher.key
|
||||
|
||||
UNAME=$(uname)
|
||||
|
||||
if [ "$UNAME" == "Darwin" ]; then
|
||||
while [ "$#" -gt 0 ]; do
|
||||
case $1 in
|
||||
--xhyve)
|
||||
shift 1
|
||||
if [ "$UNAME" == "Darwin" ] && [ -x $(which xhyve) ]; then
|
||||
XHYVE=1
|
||||
fi
|
||||
;;
|
||||
*)
|
||||
break
|
||||
;;
|
||||
esac
|
||||
done
|
||||
|
||||
if [ "$XHYVE" == "1" ]; then
|
||||
HOST=192.168.64.2 # consult `/var/db/dhcpd_leases` or delete it
|
||||
exec ssh -F ./assets/scripts_ssh_config -i ./assets/rancher.key rancher@${HOST} "$@"
|
||||
elif [ "$UNAME" == "Linux" ]; then
|
||||
else
|
||||
exec ssh -p 2222 -F ./assets/scripts_ssh_config -i ./assets/rancher.key rancher@localhost "$@"
|
||||
fi
|
||||
|
||||
|
Reference in New Issue
Block a user