2019-04-14 19:41:33 +02:00
|
|
|
#!/usr/bin/env sh
|
|
|
|
|
|
|
|
#
|
|
|
|
# Shell common environment variables and functions (BusyBox compatible)
|
|
|
|
#
|
|
|
|
|
|
|
|
# Favourite commands
|
|
|
|
export PAGER=less
|
|
|
|
export EDITOR=nvim
|
|
|
|
export VISUAL=nvim
|
2019-04-22 18:33:36 +02:00
|
|
|
export BROWSER=firefox
|
2019-04-14 19:41:33 +02:00
|
|
|
|
2019-04-25 22:54:51 +02:00
|
|
|
direnv() { # environment variable name, path
|
|
|
|
export "$1"="$2"
|
|
|
|
mkdir -p "$2"
|
|
|
|
}
|
|
|
|
|
2019-04-28 04:52:43 +02:00
|
|
|
# Program-specific
|
|
|
|
|
2019-04-25 22:54:51 +02:00
|
|
|
export JAVA_FONTS=/usr/share/fonts/TTF # 2019-04-25 Attempt to remove .java/fonts remove if it didn't work
|
2019-04-14 19:41:33 +02:00
|
|
|
# export ANDROID_HOME=/opt/android-sdk
|
|
|
|
# export ARDUINO=/usr/share/arduino
|
|
|
|
# export ARDUINO_DIR=$ARDUINO
|
|
|
|
# export ARDMK_VENDOR=archlinux-arduino
|
|
|
|
|
2019-04-28 04:05:45 +02:00
|
|
|
# Get out of my $HOME!
|
2019-06-16 17:14:00 +02:00
|
|
|
export BOOT9_PATH="$HOME/.local/share/citra-emu/sysdata/boot9.bin"
|
2019-04-25 22:54:51 +02:00
|
|
|
direnv CARGOHOME "$HOME/.cache/cargo" # There are config in there that we can version if one want
|
|
|
|
direnv CCACHE_BASEDIR "$HOME/.cache/ccache"
|
|
|
|
export CCACHE_CONFIGPATH="$HOME/.config/ccache.conf"
|
2020-05-03 13:24:45 +02:00
|
|
|
direnv DASHT_DOCSETS_DIR "$HOME/.cache/dash_docsets"
|
2019-04-25 22:54:51 +02:00
|
|
|
direnv GNUPGHOME "$HOME/.config/gnupg"
|
2019-06-16 17:14:00 +02:00
|
|
|
direnv GOPATH "$HOME/.cache/go"
|
2019-04-28 04:05:45 +02:00
|
|
|
direnv GRADLE_USER_HOME "$HOME/.cache/gradle"
|
2019-04-25 22:54:51 +02:00
|
|
|
export INPUTRC="$HOME/.config/inputrc"
|
|
|
|
export LESSHISTFILE="$HOME/.cache/lesshst"
|
2019-04-30 08:22:27 +02:00
|
|
|
direnv MIX_ARCHIVES "$HOME/.cache/mix/archives"
|
2019-04-25 22:54:51 +02:00
|
|
|
direnv MONO_GAC_PREFIX "$HOME/.cache/mono"
|
|
|
|
export NODE_REPL_HISTORY="$HOME/.cache/node_repl_history"
|
|
|
|
direnv npm_config_cache "$HOME/.cache/npm"
|
|
|
|
direnv PARALLEL_HOME "$HOME/.cache/parallel"
|
2019-04-28 04:05:45 +02:00
|
|
|
export PYTHONSTARTUP="$HOME/.config/pythonstartup.py"
|
|
|
|
export SCREENRC="$HOME/.config/screenrc"
|
|
|
|
export SQLITE_HISTFILE="$HOME/.cache/sqlite_history"
|
|
|
|
export TASKRC="$HOME/.config/taskrc"
|
|
|
|
direnv TASKDATA "$HOME/.config/task"
|
|
|
|
direnv TERMINFO "$HOME/.config/terminfo"
|
|
|
|
direnv TIMEWARRIORDB "$HOME/.config/timewarrior"
|
|
|
|
export RXVT_SOCKET="$HOME/.cache/urxvtd-$HOST"
|
|
|
|
export MYVIMRC="$HOME/.config/vim/vimrc"
|
|
|
|
export VIMINIT="source $MYVIMRC"
|
|
|
|
direnv WINEPREFIX "$HOME/.cache/wineprefix/default"
|
|
|
|
direnv YARN_CACHE_FOLDER "$HOME/.cache/yarn"
|
|
|
|
export YARN_DISABLE_SELF_UPDATE_CHECK=true # This also disable the creation of a ~/.yarnrc file
|
|
|
|
export XAUTHORITY="$HOME/.config/Xauthority"
|
2019-04-25 22:54:51 +02:00
|
|
|
|
2019-04-28 04:05:45 +02:00
|
|
|
# And for the rest, see aliases
|
2019-04-25 22:54:51 +02:00
|
|
|
direnv JUNKHOME "$HOME/.cache/junkhome"
|
|
|
|
|
2019-07-16 17:43:46 +02:00
|
|
|
# For software that did not understand that XDG variables have defaults
|
|
|
|
direnv XDG_DATA_HOME "$HOME/.local/share"
|
|
|
|
direnv XDG_CONFIG_HOME "$HOME/.config"
|
|
|
|
export XDG_DATA_DIRS="/usr/local/share/:/usr/share/"
|
|
|
|
export XDG_CONFIG_DIRS="/etc/xdg"
|
|
|
|
direnv XDG_CACHE_HOME "$HOME/.cache"
|
2019-11-09 15:28:16 +01:00
|
|
|
# Please don't set XDG_RUNTIME_DIR as it
|
|
|
|
# screw with user daemons such as PulseAudio
|
2019-07-16 17:43:46 +02:00
|
|
|
|
2019-04-14 19:41:33 +02:00
|
|
|
# Path
|
|
|
|
|
|
|
|
# Function stolen from Arch Linux /etc/profile
|
|
|
|
appendpath() {
|
|
|
|
if [ ! -d "$1" ]; then
|
|
|
|
return
|
|
|
|
fi
|
|
|
|
case ":$PATH:" in
|
|
|
|
*:"$1":*) ;;
|
|
|
|
|
|
|
|
*)
|
|
|
|
export PATH="${PATH:+$PATH:}$1"
|
|
|
|
;;
|
|
|
|
esac
|
|
|
|
}
|
|
|
|
|
2019-06-11 06:28:58 +02:00
|
|
|
prependpath() {
|
|
|
|
if [ ! -d "$1" ]; then
|
|
|
|
return
|
|
|
|
fi
|
|
|
|
case ":$PATH:" in
|
|
|
|
*:"$1":*) ;;
|
|
|
|
|
|
|
|
*)
|
|
|
|
export PATH="$1${PATH:+:$PATH}"
|
|
|
|
;;
|
|
|
|
esac
|
|
|
|
}
|
|
|
|
|
|
|
|
prependpath '/usr/lib/ccache/bin'
|
|
|
|
prependpath "${GOPATH}/bin"
|
|
|
|
prependpath "$HOME/.local/bin"
|
|
|
|
prependpath "$HOME/.config/scripts"
|
2019-04-14 19:41:33 +02:00
|
|
|
|
|
|
|
# If running on termux, load those extra scripts
|
|
|
|
[ -d /data/data/com.termux/ ] && (
|
2019-06-11 06:28:58 +02:00
|
|
|
prependpath "$HOME/.termux/scripts"
|
|
|
|
prependpath "$HOME/.termux/bin"
|
2019-04-14 19:41:33 +02:00
|
|
|
)
|
|
|
|
|
|
|
|
# For superseding commands with better ones if they are present
|
2020-08-20 21:38:48 +02:00
|
|
|
|
|
|
|
# SSH Agent
|
|
|
|
|
|
|
|
# If GPG agent is configured for SSH
|
|
|
|
if grep -q ^enable-ssh-support$ $GNUPGHOME/gpg-agent.conf 2> /dev/null
|
|
|
|
then
|
|
|
|
# Load GPG agent
|
|
|
|
unset SSH_AGENT_PID
|
|
|
|
if [ "${gnupg_SSH_AUTH_SOCK_by:-0}" -ne $$ ]; then
|
|
|
|
export SSH_AUTH_SOCK="$(gpgconf --list-dirs agent-ssh-socket)"
|
|
|
|
fi
|
|
|
|
export GPG_TTY=$(tty)
|
|
|
|
gpg-connect-agent updatestartuptty /bye >/dev/null
|
|
|
|
|
|
|
|
else
|
|
|
|
# Load ssh-agent... ONCE
|
|
|
|
SSH_ENV="$HOME/.ssh/environment"
|
|
|
|
|
|
|
|
start_agent() {
|
|
|
|
ssh-agent > "${SSH_ENV}"
|
|
|
|
chmod 600 "${SSH_ENV}"
|
|
|
|
. "${SSH_ENV}" > /dev/null
|
|
|
|
}
|
|
|
|
|
|
|
|
if [ -f "${SSH_ENV}" ]
|
|
|
|
then
|
|
|
|
. "${SSH_ENV}" > /dev/null
|
|
|
|
if [ ! -d "/proc/${SSH_AGENT_PID}" ] || [ "$(cat "/proc/${SSH_AGENT_PID}/comm")" != "ssh-agent" ]
|
|
|
|
then
|
|
|
|
start_agent
|
|
|
|
fi
|
|
|
|
else
|
|
|
|
start_agent
|
|
|
|
fi
|
|
|
|
fi
|