Skip to content

Instantly share code, notes, and snippets.

@sirkkalap
Last active February 24, 2016 12:06
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 sirkkalap/7ba23292f7c4fe262199 to your computer and use it in GitHub Desktop.
Save sirkkalap/7ba23292f7c4fe262199 to your computer and use it in GitHub Desktop.
Some comfort settings for me
#!/bin/sh
WORK=${$1:-proj}
require() {
command -v $1 >/dev/null 2>&1 || { echo >&2 "I require $1 but it's not installed. Installing."; sudo $2; }
}
# Determine OS platform
UNAME=$(uname | tr "[:upper:]" "[:lower:]")
# If Linux, try to determine specific distribution
if [ "$UNAME" == "linux" ]; then
# If available, use LSB to identify distribution
if [ -f /etc/lsb-release -o -d /etc/lsb-release.d ]; then
export DISTRO=$(lsb_release -i | cut -d: -f2 | sed s/'^\t'//)
# Otherwise, use release info file
else
export DISTRO=$(ls -d /etc/[A-Za-z]*[_-][rv]e[lr]* | grep -v "lsb" | cut -d'/' -f3 | cut -d'-' -f1 | cut -d'_' -f1)
fi
fi
# For everything else (or if above failed), just use generic identifier
[ "$DISTRO" == "" ] && export DISTRO=$UNAME
unset UNAME
if [[ $DISTRO == centos* ]]; then
require git 'yum -y install git'
require vim 'yum -y install vim-enhanced'
fi
if [[ $DISTRO == ubuntu* ]]; then
require git 'apt-get -y install git'
require vim 'apt-get -y install vim-enhanced'
fi
if [[ $DISTRO == darvin* ]]; then
require brew 'echo "sorry" && exit 1'
require git 'brew install git'
require vim 'brew install vim'
fi
(
cd "$WORK"
git clone https://github.com/sirkkalap/dotfiles-sirkkalap.git
cd dotfiles-sirkkalap
./zsh/install-prezto.sh
./zsh/install-my-conf.sh
./vim/install-spf13.sh
./tmux/install-my-conf.sh
)
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment