Skip to content

Instantly share code, notes, and snippets.

@robatron
Last active April 1, 2018 22:49
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 robatron/4ccea1ba5324ab8730996937d25aaf7b to your computer and use it in GitHub Desktop.
Save robatron/4ccea1ba5324ab8730996937d25aaf7b to your computer and use it in GitHub Desktop.
#!/bin/bash
# Remote script to install these dotfiles on a system
system_type=$(uname -s)
repo_url="https://robatron@bitbucket.org/robatron/dotfiles.git"
echo "Verifying git installed..."
if ! [ -x "$(command -v git)" ]; then
echo "Git not installed. Attempting to install..."
if [ "$system_type" = "Darwin" ]; then
echo "Mac OS X detected. Looking for brew..."
if ! [ -x "$(command -v brew)" ]; then
echo "Homebrew missing. Installing homebrew..."
/usr/bin/ruby -e \
"$(curl -fsSL https://raw.githubusercontent.com/Homebrew/install/master/install)"
fi
echo "Installing git via brew..."
brew install git
elif [ "$system_type" = "Linux" ]; then
echo "Linux detected. Looking for apt..."
if ! [ -x "$(command -v apt)" ]; then
echo "Installing git via apt..."
sudo apt install git
else
echo "Can't install git via apt and I don't know what to do :-("
exit 1
fi
fi
fi
echo "Installing yadm via git..."
mkdir -p ~/bin ~/opt
git clone https://github.com/TheLocehiliosan/yadm.git ~/opt/yadm
ln -sf ~/opt/yadm/yadm ~/bin/
export PATH="~/bin:$PATH"
echo "Cloning dotfiles..."
yadm clone $repo_url
yadm status
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment