dotfiles

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

phony-headless (1866B)


      1 #!/bin/bash
      2 #vmpath="Documents/Virtual Machines.localized/Debian 8.x 64-bit.vmwarevm/Debian 8.x 64-bit.vmx"
      3 vmpath="$HOME/VMware Fusion VMs/Debian 9.x 64-bit.vmwarevm/Debian 9.x 64-bit.vmx"
      4 #ip=172.16.106.42
      5 sshfsmount=~/phony
      6 cmd="tmux new-session -A -s misc"
      7 
      8 if [[ "$1" = "-h" ]]; then
      9     echo "usage: $0 [start|suspend|stop|status|copysshkey|notmux]"
     10     echo "If no arguments are passed this script will connect to the VM via ssh"
     11 
     12 elif [[ "$1" = "start" ]]; then
     13     vmrun -T fusion start "$vmpath" nogui
     14     vmrun list
     15 
     16 elif [[ "$1" = "suspend" ]]; then
     17     vmrun -T fusion suspend "$vmpath"
     18     vmrun list
     19 
     20 elif [[ "$1" = "stop" ]]; then
     21     vmrun -T fusion stop "$vmpath"
     22     vmrun list
     23 
     24 elif [[ "$1" = "status" ]]; then
     25     vmrun list
     26 
     27 elif [[ "$1" = "copysshkey" ]]; then
     28     ssh-copy-id -i ~/.ssh/id_rsa.pub "$ip"
     29 
     30 else
     31     if [[ "$1" = "notmux" ]]; then
     32         cmd=""
     33     fi
     34           
     35     if [ "$(vmrun list | head -n 1 | awk '{ print $4 }')" -lt "1" ]; then
     36         echo -n "Starting VM... "
     37         vmrun -T fusion start "$vmpath" nogui
     38         echo "done"
     39         vmrun list
     40     fi
     41     # 1. In vmware fusion gui app, configure network adapter to "Internet
     42     # Sharing: Share with my Mac". Copy the MAC address under "Advanced options"
     43     # 2. Insert an entry like the following to 
     44     # /Library/Preferences/VMware\ Fusion/vmnet8/dhcpd.conf :
     45     #    host Windows8x64 {
     46     #        hardware ethernet 00:0C:29:B6:22:3E;
     47     #        fixed-address  192.168.167.80;
     48     #    }
     49     ip=192.168.167.80
     50     #ip=$(vmrun getGuestIPAddress "$vmpath")
     51     echo "IP of VM: $ip"
     52 
     53     mkdir -p $sshfsmount
     54     sshfs $ip:/home/ad $sshfsmount
     55     ssh -Y $ip -t $cmd
     56 
     57     #read -p "$(tput setaf 3)Suspend VM? [Y/n] $(tput sgr0)" -n 1 -r
     58     #echo
     59     #if [[ $REPLY =~ ^[Nn]$ ]]; then
     60         #vmrun -T fusion suspend "$vmpath"
     61         #vmrun list
     62     #fi
     63 fi