Skip to content

Instantly share code, notes, and snippets.

@coenjacobs
Created July 22, 2014 07:39
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save coenjacobs/6f80533bef9f913b2c84 to your computer and use it in GitHub Desktop.
Save coenjacobs/6f80533bef9f913b2c84 to your computer and use it in GitHub Desktop.
I use this script to run commands over SSH in a new Vagrant machine to setup my own dotfiles.
#!/bin/bash
vagrant up
vagrant ssh << EOF
# If directory doesn't exist, clone the repository in ~/.dotfiles
if [ ! -d ~/.dotfiles ];
then
git clone --recursive https://github.com/coenjacobs/dotfiles.git ~/.dotfiles
fi
# Check if zsh is already installed
if ! dpkg-query -l zsh | grep -q ^.i
then
sudo apt-get update && sudo apt-get -y install zsh
fi
# Check for line in .profile that makes zsh default shell
if ! grep -Fxq "[ -f /usr/bin/zsh ] && exec /usr/bin/zsh -l" ~/.profile
then
echo "[ -f /usr/bin/zsh ] && exec /usr/bin/zsh -l" >> ~/.profile
fi
# Run install file inside dotfiles repository
sh ~/.dotfiles/scripts/install.sh
EOF
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment