shoestrap/assets/default/dotfiles/bashrc
2023-10-31 08:58:30 -07:00

116 lines
3.2 KiB
Bash

DET_OS="unknown"
UNAME_STR="$(uname)"
# Some settings are mac specific
if [[ "$UNAME_STR" == "Darwin" ]]; then
DET_OS="mac"
elif [[ "$UNAME_STR" == "Linux" ]]; then
DET_OS="linux"
fi
# Source bash alaias
if [ -f "$HOME/.bash_alias" ]; then
# shellcheck source=bash_alias
source "$HOME/.bash_alias"
fi
# Common paths for me
export PATH=$PATH:$ANT_HOME/bin
# Opt directory
if [ -d /opt/local ]; then
export PATH=/opt/local/bin:/opt/local/sbin:$PATH
export LDFLAGS="$LDFLAGS-L/opt/local/lib"
export CFLAGS="$CFLAGS-L/opt/local/include"
fi
if [[ "$DET_OS" == "linux" ]]; then
ANDROID_SDK=$HOME/workspace/adt-bundle-linux/sdk
GOROOT=/usr/local/go
elif [[ "$DET_OS" == "mac" ]]; then
ANDROID_SDK=$HOME/workspace/android-sdk-macosx
# Set GOPATH
GOROOT=/opt/local/lib/go
GOPATH=$HOME/workspace/go_path
# Fix Python path on OSX to avoid considering System extras over newer versions
# Local
export PATH=$HOME/Library/Python/2.7/bin:$PATH
export PATH=$HOME/Library/Python/3.8/bin:$PATH
export PATH=$HOME/Library/Python/3.9/bin:$PATH
export PATH=$HOME/Library/Python/3.10/bin:$PATH
export PATH=$HOME/Library/Python/3.11/bin:$PATH
# Python path is causing other issues
# export PYTHONPATH=$HOME/Library/Python/2.7/lib/python/site-packages:$PYTHONPATH
# MacPorts and system
# export PYTHONPATH=/opt/local/Library/Frameworks/Python.framework/Versions/Current/lib/python2.7/site-packages:/Library/Python/2.7/site-packages:$PYTHONPATH
fi
# Android paths
if [ -d "$ANDROID_SDK" ]; then
export ANDROID_HOME=$ANDROID_SDK
export PATH=$PATH:$ANDROID_SDK/platform-tools:$ANDROID_SDK/tools
fi
# Go paths
if [ -d "$GOPATH" ]; then
export GOPATH
export PATH=$PATH:$GOPATH/bin
fi
if [ -d "$GOROOT" ]; then
export GOROOT
export PATH=$PATH:$GOROOT/bin
fi
# Home path
export PATH=$HOME/bin:$HOME/.local/bin:$PATH
# Add RVM to PATH for scripting
if type rbenv &> /dev/null; then
export PATH="$HOME/.rbenv/bin:$PATH"
eval "$(rbenv init -)"
elif [ -d "$HOME/.rvm" ]; then
export PATH="$PATH:$HOME/.rvm/bin"
# shellcheck source=/dev/null
[[ -s "$HOME/.rvm/scripts/rvm" ]] && source "$HOME/.rvm/scripts/rvm" # Load RVM into a shell session *as a function*
fi
# NPM paths
if type npm &> /dev/null ; then
# This seems to fail in some cases
npm_path=$(npm bin -g 2> /dev/null)
if [ -d "$npm_path" ] && echo "$PATH" | grep -qv "$npm_path"; then
export PATH=$PATH:$npm_path
fi
fi
# Add luarocks paths
if type luarocks &> /dev/null ; then
eval "$(luarocks path)"
luarocks_bin=$HOME/.luarocks/bin
if [ -d "$luarocks_bin" ] && echo "$PATH" | grep -qv "$luarocks_bin"; then
export PATH=$PATH:$luarocks_bin
fi
fi
# Increase memory sizes for java using Ant
export ANT_OPTS="-Xmx2048m -Xms512m"
# Set vim or nvim to default editor
if type nvim &> /dev/null ; then
export EDITOR=nvim
else
export EDITOR=vim
fi
export VISUAL="$EDITOR"
# Set file as having been loaded to avoid looping
IS_BASHRC_LOADED=true
# If an interactive shell and .bash_profile hasn't been loaded, load it
if [ -n "$PS1" ] && [ -z "$IS_BASH_PROFILE_LOADED" ] ; then
# shellcheck source=bash_profile
source "$HOME/.bash_profile"
fi
# vim: set filetype=sh: