#!/bin/bash

dir=~/dotfiles
for file in $dir/*.symlink; do
    echo "Creating symlink to $file in home directory."
    filename=${file##*/}
    ln -sf $file ~/.${filename%.symlink}
done

# Homebrew setup, if OSX
if [[ $OSTYPE == darwin* ]]; then

    # install homebrew
    if [[ ! $(command -v brew 2>/dev/null) ]]; then
        echo "Mac without homebrew?!?! Fixing..."
        ruby -e "$(curl -fsSL https://raw.githubusercontent.com/Homebrew/install/master/install)"
    else
        echo "Homebrew already installed"
    fi

    # install brew bundle
    if [[ ! $(brew bundle check) ]]; then
        echo "Found missing packages, installing Homebrew bundle"
        brew bundle
    else
        echo "Homebrew bundle reports all packages installed"
    fi

fi

#!/bin/bash

dir=~/dotfiles
for file in $dir/*.symlink; do
    echo "Creating symlink to $file in home directory."
    filename=${file##*/}
    ln -sfn $file ~/.${filename%.symlink}
done

# Homebrew setup, if OSX
if [[ $OSTYPE == darwin* ]]; then

    # install homebrew
    if [[ ! $(command -v brew 2>/dev/null) ]]; then
        echo "Mac without homebrew?!?! Fixing..."
        ruby -e "$(curl -fsSL https://raw.githubusercontent.com/Homebrew/install/master/install)"
    else
        echo "Homebrew already installed"
    fi

    # install brew bundle
    if [[ ! $(brew bundle check) ]]; then
        echo "Found missing packages, installing Homebrew bundle"
        brew bundle
    else
        echo "Homebrew bundle reports all packages installed"
    fi

fi

Add -n flag to LN to avoid following directory symlinks
Add -n flag to LN to avoid following directory symlinks

Previously, I was using -h for this, but it wasn't portable to GNU
systems. The -n flag will work on either.
