dotfiles/.bash_login
Andrei Jiroh Halili 7197da69d7
chore(global): do some quick stash apply after a rebase against main branch
Signed-off-by: Andrei Jiroh Halili <ajhalili2006@andreijiroh.xyz>
2024-08-17 11:07:10 +08:00

76 lines
2.2 KiB
Bash

#!/data/data/com.termux/files/usr/bin/env bash
# shellcheck disable=SC2046,SC1091,SC2155
# This is a minimal bash login scrupt for loading local
# configs as well as hooking in byobu on login.
# source local vars
# TODO: Hook up with dotenvx for decrypting encrypted secrets
source "$HOME/.env"
if [[ -f "$HOME/.env.local" ]]; then
source "$HOME/.env.local"
export LOCAL_DOTENV_LOADED=true
fi
# how about detecting local configs
if [ -f "$HOME/.config/localconfig.env" ]; then
. "$HOME/.config/localconfig.env"
fi
# Load bash
# shellcheck source=./.bashrc
source ./.bashrc
# 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
##########################################################################################
if [[ $FF_BYOBU_ON_LOGIN == "true" || $LC_BYOBU == "1" ]]; then
_byobu_sourced=1 . /data/data/com.termux/files/usr/bin/byobu-launch 2>/dev/null || true
fi