1
0
mirror of https://github.com/rancher/os.git synced 2025-05-11 17:48:49 +00:00
os/scripts/ssh
Ivan Mikushin 74e589039b 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.
2015-09-03 20:01:32 +05:00

31 lines
647 B
Bash
Executable File

#!/bin/bash
set -e
cd $(dirname $0)/..
chmod 0600 ./assets/rancher.key
UNAME=$(uname)
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} "$@"
else
exec ssh -p 2222 -F ./assets/scripts_ssh_config -i ./assets/rancher.key rancher@localhost "$@"
fi