97 lines
2.8 KiB
Bash
97 lines
2.8 KiB
Bash
# ~/.profile: executed by the command interpreter for login shells.
|
|
# This file is not read by bash(1), if ~/.bash_profile or ~/.bash_login
|
|
# exists.
|
|
# see /usr/share/doc/bash/examples/startup-files for examples.
|
|
# the files are located in the bash-doc package.
|
|
|
|
# set PATH so it includes user's private bin if it exists
|
|
if [ -d "$HOME/bin" ] ; then
|
|
PATH="$HOME/bin:$PATH"
|
|
fi
|
|
|
|
# set PATH so it includes user's private bin if it exists
|
|
if [ -d "$HOME/.local/bin" ] ; then
|
|
PATH="$HOME/.local/bin:$PATH"
|
|
fi
|
|
|
|
### AAA ##########################################
|
|
|
|
isMac() { uname -s | grep -q "Darwin"; }
|
|
isLinux() { uname -s | grep -q "Linux"; }
|
|
addPath() { [ -d "$1" ] && export PATH="$1:$PATH"; }
|
|
safeSource() { [ -s "$1" ] && source "$1" 2>/dev/null || true; }
|
|
|
|
export EDITOR="nano"
|
|
export NVM_DIR="$HOME/.nvm"
|
|
export GOPATH="$HOME/.go"
|
|
|
|
### MacBook section
|
|
if isMac; then
|
|
# brew software
|
|
if [ -d "/opt/homebrew/bin/" ]; then
|
|
# brew itself
|
|
eval "$(/opt/homebrew/bin/brew shellenv zsh)"
|
|
addPath "/opt/homebrew/bin/"
|
|
|
|
# java
|
|
export JAVA_HOME="/Library/Java/JavaVirtualMachines/openjdk-17.jdk/Contents/Home"
|
|
|
|
# nvm (not nvim!)
|
|
safeSource "/opt/homebrew/opt/nvm/nvm.sh" # This loads nvm
|
|
safeSource "/opt/homebrew/opt/nvm/etc/bash_completion.d/nvm" # This loads nvm bash_completion
|
|
fi
|
|
|
|
# jbtoolbox
|
|
addPath "$HOME/Library/Application Support/JetBrains/Toolbox/scripts"
|
|
|
|
# orbstack
|
|
safeSource "$HOME/.orbstack/shell/init.zsh"
|
|
fi
|
|
### MacBook section end
|
|
|
|
### Ubuntu section
|
|
if isLinux; then
|
|
# golang
|
|
export PATH="$PATH:/usr/local/go/bin"
|
|
|
|
# java
|
|
# export JAVA_HOME="/usr/lib/jvm/java-21-openjdk-amd64"
|
|
export JAVA_HOME="/usr/lib/jvm/java-17-openjdk-amd64"
|
|
|
|
# nvim (not nvm!)
|
|
[ -d "/opt/nvim/bin/" ] && export PATH="$PATH:/opt/nvim/bin/"
|
|
|
|
# rust cargo
|
|
[ -f "$HOME/.cargo/env" ] && source "$HOME/.cargo/env"
|
|
|
|
# nvm (not nvim!)
|
|
safeSource "$NVM_DIR/nvm.sh" # This loads nvm
|
|
safeSource "$NVM_DIR/bash_completion" # This loads nvm bash_completion
|
|
|
|
if hash composer >/dev/null; then
|
|
composer_home=$(composer config -g home 2>/dev/null)
|
|
export PATH="$PATH:$composer_home/vendor/bin"
|
|
fi
|
|
|
|
# phpbrew
|
|
# export PHPBREW_SET_PROMPT=1
|
|
# export PHPBREW_RC_ENABLE=1
|
|
# [ -f $HOME/.phpbrew/bashrc ] && source $HOME/.phpbrew/bashrc
|
|
|
|
# The next line updates PATH for Yandex Cloud CLI.
|
|
safeSource "$HOME/yandex-cloud/path.bash.inc"
|
|
|
|
# The next line enables shell command completion for yc.
|
|
safeSource "$HOME/yandex-cloud/completion.zsh.inc"
|
|
|
|
# jbtoolbox
|
|
if [ -d "$HOME/.local/share/JetBrains/Toolbox/scripts/" ]; then
|
|
export PATH="$PATH:$HOME/.local/share/JetBrains/Toolbox/scripts/"
|
|
fi
|
|
fi
|
|
### Ubuntu section end
|
|
|
|
addPath "$JAVA_HOME/bin/"
|
|
|
|
safeSource "$HOME/.profile.local"
|