2023-01-05 17:22:50 +00:00
|
|
|
#!/usr/bin/env bash
|
2024-07-07 09:46:25 +00:00
|
|
|
# # shellcheck disable=SC2046,SC1091,SC2155
|
2023-01-05 17:22:50 +00:00
|
|
|
|
|
|
|
# Stage 0: Source dotenv stuff from homedir
|
|
|
|
source "$HOME/.env"
|
|
|
|
if [[ -f "$HOME/.env.local" ]]; then
|
|
|
|
source "$HOME/.env.local"
|
2024-07-07 09:46:25 +00:00
|
|
|
export LOCAL_DOTENV_LOADED=true
|
2023-01-05 17:22:50 +00:00
|
|
|
fi
|
|
|
|
|
2023-10-21 01:08:39 +00:00
|
|
|
if [[ $TERMUX ]]; then
|
|
|
|
export SSH_AGENT_=todo
|
|
|
|
elif command -v keychain >> /dev/null; then
|
2024-07-07 09:46:25 +00:00
|
|
|
export KEYCHAIN_PATH=$(command -v keychain)
|
2023-10-21 01:08:39 +00:00
|
|
|
eval $(keychain --agents gpg,ssh --eval)
|
|
|
|
fi
|
2023-01-19 11:22:37 +00:00
|
|
|
|
2023-10-21 01:08:39 +00:00
|
|
|
# how about detecting local configs
|
|
|
|
if [ -f "$HOME/.config/localconfig.env" ]; then
|
|
|
|
. "$HOME/.config/localconfig.env"
|
|
|
|
fi
|
2023-01-19 11:22:37 +00:00
|
|
|
|
2024-08-15 09:52:52 +00:00
|
|
|
# Load bash
|
|
|
|
# shellcheck source=./.bashrc
|
2024-07-07 09:46:25 +00:00
|
|
|
source ./.bashrc
|
2024-08-15 09:52:52 +00:00
|
|
|
|
|
|
|
# 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
|
|
|
|
|
|
|
|
export PATH="/usr/local/bin:$HOME/.local/bin:$HOME/bin${PATH:+:}$PATH:$HOME/.local/share/JetBrains/Toolbox/scripts" # ~vern specifics and more
|
|
|
|
mesg n 2> /dev/null || true
|
|
|
|
|
|
|
|
# then import the rest
|
|
|
|
source "$HOME/.env"
|
|
|
|
source "$HOME/.config/aliases"
|
|
|
|
export POSIX_PROFILE_SOURCED=true
|
|
|
|
|
|
|
|
# how about detecting local configs
|
|
|
|
if [ -f "$HOME/.config/localconfig.env" ]; then
|
|
|
|
. "$HOME/.config/localconfig.env"
|
|
|
|
fi
|
|
|
|
|
|
|
|
##########################################################################################
|
|
|
|
# Code snippets from https://git.sr.ht/~sircmpwn/dotfiles/tree/db5945a4/item/.env
|
|
|
|
##########################################################################################
|
|
|
|
if ls --version 2>&1 | grep -i gnu >/dev/null
|
|
|
|
then
|
|
|
|
alias ls='ls --color=auto '
|
|
|
|
elif ls --version 2>&1 | grep -i busybox >/dev/null
|
|
|
|
then
|
|
|
|
alias ls='ls --color=auto '
|
|
|
|
fi
|
|
|
|
|
|
|
|
alias recent='ls -ltch'
|
|
|
|
|
|
|
|
# Add optmizations for multicore builds
|
|
|
|
if [ $(uname) = "Linux" ]
|
|
|
|
then
|
|
|
|
nproc=$(grep '^processor' /proc/cpuinfo | wc -l)
|
|
|
|
if [ $nproc -gt 4 ]
|
|
|
|
then
|
|
|
|
# Reserve two cores
|
|
|
|
nproc=$((nproc - 2))
|
|
|
|
fi
|
|
|
|
export MAKEFLAGS="-j$nproc"
|
|
|
|
export SAMUFLAGS="-j$nproc"
|
|
|
|
fi
|
|
|
|
##########################################################################################
|