Created
December 6, 2019 21:50
-
-
Save jeremylenz/6467b54d8c7fadfd4e641a7dd04ac1ef to your computer and use it in GitHub Desktop.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
#!/usr/bin/env bash | |
# Get the IP address of a Vagrant box using vagrant ssh-config, then connect to it using sshfs. | |
cd /home/jeremylenz/code/forklift | |
VAGRANT_BOX=$1 | |
if [ -z $VAGRANT_BOX ] # if no command-line arg provided, use stable box | |
then | |
VAGRANT_BOX="centos7-katello-devel-stable" | |
fi | |
echo VAGRANT_BOX: $VAGRANT_BOX | |
echo "Getting devel box IP..." | |
DEVEL_BOX_IP=$(vagrant ssh-config $VAGRANT_BOX | grep -Po 'HostName \K[\d.]+') | |
cd /home/jeremylenz/code | |
echo DEVEL_BOX_IP: $DEVEL_BOX_IP | |
echo mkdir /home/jeremylenz/code/$VAGRANT_BOX | |
mkdir /home/jeremylenz/code/$VAGRANT_BOX | |
echo "Connecting via sshfs" | |
sshfs vagrant@$DEVEL_BOX_IP:/home/vagrant/ /home/jeremylenz/code/$VAGRANT_BOX/ -o IdentityFile=/home/jeremylenz/code/forklift/.vagrant/machines/$VAGRANT_BOX/libvirt/private_key | |
echo "done" | |
cd /home/jeremylenz/code/$VAGRANT_BOX |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment