diff --git a/curlrc b/curlrc new file mode 100644 index 0000000..b7a6004 --- /dev/null +++ b/curlrc @@ -0,0 +1,8 @@ +user-agent = "Mozilla/5.0 (Windows NT 6.1; rv:45.0) Gecko/20100101 Firefox/45.0" +referer = ";auto" +connect-timeout = 10 +progress-bar +max-time = 90 +show-error +remote-time +ipv4 diff --git a/install.sh b/install.sh index 54bd40d..2c52d3b 100755 --- a/install.sh +++ b/install.sh @@ -29,30 +29,104 @@ if [[ $platform != 'Linux' && $platform != 'Darwin' ]]; then exit fi -if [ ! -d "$HOME/.dotfiles" ]; then - printf "${YELLOW}Creating dotfiles symlink${NORMAL}\n" - ln -s $cwd $HOME/.dotfiles -fi - -printf "Installing zsh..." -TEST_CURRENT_SHELL=$(expr "$SHELL" : '.*/\(.*\)') -if [ "$TEST_CURRENT_SHELL" != "zsh" ]; then - if hash chsh >/dev/null 2>&1; then - printf "\n${BLUE}Changing the default shell to zsh${NORMAL}\n" - chsh -s $(grep /zsh$ /etc/shells | tail -1) - else - printf "\n${RED}Unable to change the shell because this system does not have chsh.\n" - printf "${BLUE}If this is Windows then you probably want to run the bash installer.${NORMAL}\n" +setup_dotfile_repo() { + if [ ! -d "$HOME/.dotfiles" ]; then + printf "${YELLOW}Creating dotfiles symlink${NORMAL}\n" + ln -s $cwd $HOME/.dotfiles fi -else - printf "${YELLOW}already installed!${NORMAL}\n" -fi +} + +link_file() { + file=$1 + dest="$HOME/.$file" + if [ ! -e $dest ]; then + printf "${YELLOW}Creating ${file} symlink${NORMAL}\n" + ln -s "$HOME/.dotfiles/$file" $dest + fi +} + +setup_git() { + printf "Setting up git...\n" + + FILES=() + FILES+=('gitconfig') + FILES+=('githelpers') + + for file in "${FILES[@]}" + do + link_file "$file" + done +} + +setup_zsh() { + printf "Setting up zsh...\n" + TEST_CURRENT_SHELL=$(expr "$SHELL" : '.*/\(.*\)') + if [ "$TEST_CURRENT_SHELL" != "zsh" ]; then + if hash chsh >/dev/null 2>&1; then + printf "\n${BLUE}Changing the default shell to zsh${NORMAL}\n" + chsh -s $(grep /zsh$ /etc/shells | tail -1) + else + printf "\n${RED}Unable to change the shell because this system does not have chsh.\n" + printf "${BLUE}If this is Windows then you probably want to run the bash installer.${NORMAL}\n" + fi + fi + + FILES=() + FILES+=('zsh') + FILES+=('zshrc') + FILES+=('zshenv') + FILES+=('zlogin') + FILES+=('zprofile') + + for file in "${FILES[@]}" + do + link_file "$file" + done +} + +setup_vim() { + printf "Setting up vim...\n" + + FILES=() + FILES+=('vim') + FILES+=('vimrc') + + for file in "${FILES[@]}" + do + link_file "$file" + done +} + +setup_misc() { + printf "Setting up misc...\n" + + FILES=() + FILES+=('curlrc') + FILES+=('racketrc') + + for file in "${FILES[@]}" + do + link_file "$file" + done +} # //////////////////////////////////////////////////////////////////////////////////////// # OSX +setup_osx() { + ./osx/install.sh +} + +# //////////////////////////////////////////////////////////////////////////////////////// +# Run + +setup_dotfile_repo +setup_git +setup_zsh +setup_vim +setup_misc + if [[ $platform == 'Darwin' ]]; then printf "\n${BOLD}Running the OS X installer${NORMAL}\n" - ./osx/install.sh + setup_osx fi - diff --git a/osx/install.sh b/osx/install.sh index 5e64df4..18e0b90 100755 --- a/osx/install.sh +++ b/osx/install.sh @@ -1,4 +1,4 @@ -#!/bin/sh +#!/bin/bash if which tput >/dev/null 2>&1; then ncolors=$(tput colors) @@ -27,26 +27,21 @@ ln -sf $HOME/.dotfiles/osx/env.platform $HOME/.env.platform printf "Installing git customizations...\n" ln -sf $HOME/.dotfiles/osx/gitconfig.platform $HOME/.gitconfig.platform -printf "Installing Homebrew..." -if [ ! -d "/usr/local/Homebrew" ]; then - /usr/bin/ruby -e "$(curl -fsSL https://raw.githubusercontent.com/Homebrew/install/master/install)" -else - printf "${YELLOW}already installed!${NORMAL}\n" -fi - brew tap homebrew/core printf "Installing xquartz..." -brew cask install xquartz +#brew cask install xquartz brew_packages=( 'tree' 'openssl' - 'xclip' +# 'xclip' 'rlwrap' 'cmake' 'pkg-config' - 'rust' + 'vim' +# 'rust' +# 'go' 'sdl') for package in "${brew_packages[@]}" diff --git a/zshenv b/zshenv index f225316..0f20391 100644 --- a/zshenv +++ b/zshenv @@ -10,6 +10,11 @@ export TERM=xterm-256color # Use vim as the editor export EDITOR=vim +# Homebrew setup +export HOMEBREW_NO_ANALYTICS=1 +export HOMEBREW_NO_INSECURE_REDIRECT=1 +export HOMEBREW_CASK_OPTS=--require-sha + # Grep tweaks export GREP_OPTIONS="-nRi --color --exclude-dir=.git --exclude-dir=tmp --exclude-dir=log --exclude-dir=node_modules --exclude-dir=bower_components --exclude-dir=coverage --exclude-dir=.bundle --exclude=*.csv --exclude=*.pdf --exclude-dir=vendor --exclude-dir=rdoc --exclude-dir=target --exclude-dir=personal --exclude-dir=resources/public/js/*.*" # --exclude-dir=images --exclude-dir=coverage