Last active
February 24, 2016 12:06
-
-
Save sirkkalap/7ba23292f7c4fe262199 to your computer and use it in GitHub Desktop.
Some comfort settings for me
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
#!/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