64 lines
2.8 KiB
Bash
64 lines
2.8 KiB
Bash
#!/bin/bash - not strictly necessary, but helps nano with syntax highlighting.
|
|
# Bash shell environmental set up.
|
|
|
|
# Common environment.
|
|
export LANG="en_GB.UTF-8"
|
|
export LC_COLLATE="POSIX" # 'C' causes issues with some applications
|
|
# export LC_CTYPE="POSIX" # Not sure why I set this in the first place...
|
|
export LESS='-RM -j.5 -i -PM?f%F:stdin. -- Page %dt of %D -- %lt/%L (%Pt\%)$'
|
|
hash less >/dev/null 2>&1 && export PAGER="less"
|
|
hash lesspipe >/dev/null 2>&1 && eval "$(SHELL=/bin/sh lesspipe)"
|
|
hash nano >/dev/null 2>&1 && export EDITOR="nano" && export VISUAL="$EDITOR"
|
|
|
|
# Platform specific set up.
|
|
PLATFORM="${PLATFORM:-$(uname -s)}"
|
|
if [[ "$PLATFORM" = "Linux" ]]; then
|
|
# shellcheck disable=SC2155
|
|
export GPG_TTY="$(tty)"
|
|
export I_WANT_A_BROKEN_PS=1
|
|
export LYNX_CFG="$HOME/.lynx.cfg"
|
|
export LYNX_LSS="$HOME/.lynx.lss"
|
|
export MANPAGER="$PAGER"
|
|
export MANPATH="$HOME/.local/share/man:$MANPATH"
|
|
export PATH="/opt/sbin:/opt/bin:/usr/local/sbin:/usr/local/bin:/usr/sbin:/usr/bin:/sbin:/bin"
|
|
|
|
hash dircolors >/dev/null 2>&1 && eval "$(dircolors -b "$HOME/.dir_colors")"
|
|
hash gpgconf >/dev/null 2>&1 && {
|
|
GPG_SOCK_DIR="$(gpgconf --list-dirs | awk -F : '/socketdir:/ { print $2 }')"
|
|
# shellcheck disable=SC2174
|
|
[[ ! -e "$GPG_SOCK_DIR" ]] && mkdir -m 700 -p "$GPG_SOCK_DIR"
|
|
[[ ! -e "$GPG_SOCK_DIR/S.gpg-agent" ]] && [[ -e "$HOME/.gnupg/S.gpg-agent" ]] && ln -sf "$HOME/.gnupg/S.gpg-agent" "$GPG_SOCK_DIR"/
|
|
unset GPG_SOCK_DIR
|
|
}
|
|
hash gpg-connect-agent >/dev/null 2>&1 && gpg-connect-agent updatestartuptty /bye >/dev/null 2>&1
|
|
|
|
[[ ! -e "$HOME/.config/lxterminal/lxterminal.conf" ]] && (
|
|
cd "$HOME/.config/lxterminal" 2>/dev/null || exit 1
|
|
[[ -e "lxterminal.conf-${HOSTNAME%%.*}" ]] && ln -sf "lxterminal.conf-${HOSTNAME%%.*}" "lxterminal.conf"
|
|
)
|
|
elif [[ "$PLATFORM" = "Darwin" ]]; then
|
|
export LSCOLORS="ExGxdxdxCxDxDxbcacbeae"
|
|
export MANPAGER="less -Mis -PM'Page %dt$'"
|
|
export MANPATH="/opt/local/share/man:$MANPATH"
|
|
export PATH="/opt/local/libexec/gnubin:/opt/local/sbin:/opt/local/bin:/usr/local/sbin:/usr/local/bin:/usr/sbin:/usr/bin:/sbin:/bin"
|
|
else
|
|
printf "%s: %s\\n" "${BASH_SOURCE##*/}" "unsupported platform: $PLATFORM" >&2
|
|
fi
|
|
|
|
# Add local perl directories to PATH if they exist.
|
|
[[ -d "$HOME/.local/perl5/bin" ]] && export PATH="$HOME/.local/perl5/bin:$PATH"
|
|
[[ -d "$HOME/.local/perl5/sbin" ]] && export PATH="$HOME/.local/perl5/sbin:$PATH"
|
|
|
|
# Add extra bin directories to PATH if they exist.
|
|
[[ -d "$HOME/files/bin" ]] && export PATH="$HOME/files/bin:$PATH"
|
|
[[ -d "$HOME/.local/bin" ]] && export PATH="$HOME/.local/bin:$PATH"
|
|
[[ -d "$HOME/bin" ]] && export PATH="$HOME/bin:$PATH"
|
|
|
|
# Read in the environment from .bash_profile.d/*.
|
|
for FILE in "$HOME"/.bash_profile.d/*; do
|
|
[[ -x "$FILE" ]] && source "$FILE"
|
|
done
|
|
unset FILE
|
|
|
|
# Source bash specific set up,
|
|
[[ -f "$HOME/.bashrc" ]] && . "$HOME/.bashrc"
|