105 lines
3.2 KiB
Bash
105 lines
3.2 KiB
Bash
#!/bin/sh
|
|
## This file should be automatically sourced by the login manager or Bash if
|
|
## .bash_profile does not exist. If this file is not automatically sourced,
|
|
## do it from the shell config to me sure it applies to TTY as well.
|
|
|
|
## Preliminary path definitions. For security reasons (and bad programming
|
|
## assumptions) you should always append entries to PATH, not prepend them.
|
|
appendpath () {
|
|
[ $# -eq 2 ] && PATHVAR=$2 || PATHVAR=PATH
|
|
[ -d "$1" ] || return
|
|
eval echo \$$PATHVAR | grep -q "\(:\|^\)$1\(:\|$\)" && return
|
|
eval export $PATHVAR="\$$PATHVAR:$1"
|
|
}
|
|
prependpath () {
|
|
[ $# -eq 2 ] && PATHVAR=$2 || PATHVAR=PATH
|
|
[ -d "$1" ] || return
|
|
eval echo \$$PATHVAR | grep -q "\(:\|^\)$1\(:\|$\)" && return
|
|
eval export $PATHVAR="$1:\$$PATHVAR"
|
|
}
|
|
|
|
## Cask
|
|
appendpath "$HOME/.cask/bin"
|
|
|
|
## Guix
|
|
## WARNING: GUIX_PACKAGE_PATH is deprecated in favor of channels.
|
|
# if command -v guix >/dev/null 2>&1; then
|
|
# export GUIX_PACKAGE_PATH="$HOME/.guix-packages"
|
|
# fi
|
|
for i in ~/.guix-extra-profiles/*; do
|
|
profile=$i/$(basename "$i")
|
|
if [ -f "$profile"/etc/profile ]; then
|
|
GUIX_PROFILE="$profile" ; . "$profile"/etc/profile
|
|
fi
|
|
unset profile
|
|
done
|
|
|
|
## Use this to override system executables.
|
|
prependpath "${HOME}/personal/hackpool"
|
|
|
|
## Last PATH entries.
|
|
appendpath "${HOME}/.local/bin"
|
|
|
|
## Remove less history.
|
|
LESSHISTFILE='-'
|
|
|
|
## Manpage.
|
|
export MANWIDTH=80
|
|
|
|
## SSH-Agent
|
|
## Set SSH to use 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
|
|
# Set GPG TTY
|
|
export GPG_TTY=$(tty)
|
|
# Refresh gpg-agent tty in case user switches into an X session
|
|
gpg-connect-agent updatestartuptty /bye >/dev/null
|
|
|
|
## Linux specific
|
|
if [ "$(uname -o)" = "GNU/Linux" ] ; then
|
|
## Startup error log.
|
|
log_dmesg="$(dmesg | grep -i error)"
|
|
[ -n "$log_dmesg" ] && echo "$log_dmesg" > "$HOME/errors-dmesg.log" || rm "$HOME/errors-dmesg.log" 2>/dev/null
|
|
unset log_dmesg
|
|
fi
|
|
|
|
## Wine DLL overrides.
|
|
## Remove the annoying messages for Mono and Gecko.
|
|
export WINEDLLOVERRIDES="mscoree,mshtml="
|
|
## Do not create desktop links or start menu entries.
|
|
export WINEDLLOVERRIDES="$WINEDLLOVERRIDES;winemenubuilder.exe=d"
|
|
|
|
## Default text editor
|
|
## 'em' is a custom wrapper for emacsclient. See '.bin/em'.
|
|
## VISUAL is given priority by some programs like Mutt. This way we can separate
|
|
## editors that wait from those that don't.
|
|
for i in emacsclient em emacs zile vim nano vi; do
|
|
command -v $i >/dev/null 2>&1 && export EDITOR=$i && break
|
|
done
|
|
GIT_EDITOR="$EDITOR"
|
|
VISUAL="$EDITOR"
|
|
[ "$GIT_EDITOR" = em ] && GIT_EDITOR=emc
|
|
[ "$VISUAL" = em ] && VISUAL=emw
|
|
export GIT_EDITOR
|
|
export VISUAL
|
|
|
|
## Hook. Should be sourced last
|
|
[ -f ~/.profile_hook ] && . ~/.profile_hook
|
|
## Hook example
|
|
#
|
|
# export CPPFLAGS=-I$HOME/local/usr/include
|
|
# export LDFLAGS=-L$HOME/local/usr/lib
|
|
#
|
|
# appendpath "$HOME/local/usr/lib/python2.7/dist-packages/" PYTHONPATH
|
|
# export LUA_CPATH="$HOME/local/usr/lib/lib?.so;$(lua -e "print(package.cpath)")"
|
|
#
|
|
# umask 077
|
|
|
|
## End: Source .bashrc. The rc file should guard against non-interactive shells.
|
|
[ "$(ps -o comm= $$)" != bash ] && return
|
|
[ -f ~/.bashrc ] && . ~/.bashrc
|
|
|
|
[ -z "$DISPLAY" ] && [ "$(tty)" = '/dev/tty1' ] && exec xinit -- vt01
|