dotfiles

configuration files for shell, text editor, graphical environment, etc.
git clone git://src.adamsgaard.dk/dotfiles
Log | Files | Refs | README | LICENSE Back to index

commit 8569ca34a091ce5761fdc08cda9d9c78a108bd52
parent 5b0d52d19520d9b4c3c52685be9d32fd4320d731
Author: Anders Damsgaard <anders@adamsgaard.dk>
Date:   Wed, 16 May 2018 13:18:22 -0400

Add VM client configuration for static IPs

Diffstat:
Alinks/bin/alpine-headless | 63+++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++
Mlinks/bin/phony-headless | 12++++++++++--
2 files changed, 73 insertions(+), 2 deletions(-)

diff --git a/links/bin/alpine-headless b/links/bin/alpine-headless @@ -0,0 +1,63 @@ +#!/bin/bash +#vmpath="Documents/Virtual Machines.localized/Debian 8.x 64-bit.vmwarevm/Debian 8.x 64-bit.vmx" +vmpath="$HOME/VMware Fusion VMs/alpine-virt.vmwarevm/alpine-virt.vmx" +#ip=172.16.106.42 +sshfsmount=~/alpine +cmd="tmux" + +if [[ "$1" = "-h" ]]; then + echo "usage: $0 [start|suspend|stop|status|copysshkey|notmux]" + echo "If no arguments are passed this script will connect to the VM via ssh" + +elif [[ "$1" = "start" ]]; then + vmrun -T fusion start "$vmpath" nogui + vmrun list + +elif [[ "$1" = "suspend" ]]; then + vmrun -T fusion suspend "$vmpath" + vmrun list + +elif [[ "$1" = "stop" ]]; then + vmrun -T fusion stop "$vmpath" + vmrun list + +elif [[ "$1" = "status" ]]; then + vmrun list + +elif [[ "$1" = "copysshkey" ]]; then + ssh-copy-id -i ~/.ssh/id_rsa.pub "$ip" + +else + if [[ "$1" = "notmux" ]]; then + cmd="" + fi + + if [ "$(vmrun list | head -n 1 | awk '{ print $4 }')" -lt "1" ]; then + echo -n "Starting VM... " + vmrun -T fusion start "$vmpath" nogui + echo "done" + vmrun list + fi + # 1. In vmware fusion gui app, configure network adapter to "Internet + # Sharing: Share with my Mac". Copy the MAC address under "Advanced options" + # 2. Insert an entry like the following to + # /Library/Preferences/VMware\ Fusion/vmnet8/dhcpd.conf : + # host Windows8x64 { + # hardware ethernet 00:0C:29:B6:22:3E; + # fixed-address 192.168.167.80; + # } + ip=192.168.167.81 + #ip=$(vmrun getGuestIPAddress "$vmpath") + echo "IP of VM: $ip" + + mkdir -p $sshfsmount + sshfs $ip:/home/ad $sshfsmount + ssh -Y $ip -t $cmd + + #read -p "$(tput setaf 3)Suspend VM? [Y/n] $(tput sgr0)" -n 1 -r + #echo + #if [[ $REPLY =~ ^[Nn]$ ]]; then + #vmrun -T fusion suspend "$vmpath" + #vmrun list + #fi +fi diff --git a/links/bin/phony-headless b/links/bin/phony-headless @@ -25,7 +25,7 @@ elif [[ "$1" = "status" ]]; then vmrun list elif [[ "$1" = "copysshkey" ]]; then - ssh-copy-id -i ~/.ssh/id_rsa.pub $ip + ssh-copy-id -i ~/.ssh/id_rsa.pub "$ip" else if [[ "$1" = "notmux" ]]; then @@ -38,7 +38,15 @@ else echo "done" vmrun list fi - ip=192.168.44.135 # device ens33 from `ip addr` in VM + # 1. In vmware fusion gui app, configure network adapter to "Internet + # Sharing: Share with my Mac". Copy the MAC address under "Advanced options" + # 2. Insert an entry like the following to + # /Library/Preferences/VMware\ Fusion/vmnet8/dhcpd.conf : + # host Windows8x64 { + # hardware ethernet 00:0C:29:B6:22:3E; + # fixed-address 192.168.167.80; + # } + ip=192.168.167.80 #ip=$(vmrun getGuestIPAddress "$vmpath") echo "IP of VM: $ip"