2013-06-03 20:18:14 +02:00
|
|
|
#!/bin/sh
|
2017-07-12 23:52:58 +02:00
|
|
|
## 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.
|
2013-06-03 20:18:14 +02:00
|
|
|
|
2017-06-06 20:22:40 +02:00
|
|
|
## Preliminary path definitions. For security reasons (and bad programming
|
|
|
|
## assumptions) you should always append entries to PATH, not prepend them.
|
2016-10-13 11:23:41 +02:00
|
|
|
appendpath () {
|
2014-11-12 18:00:08 +01:00
|
|
|
[ $# -eq 2 ] && PATHVAR=$2 || PATHVAR=PATH
|
2016-10-13 11:23:41 +02:00
|
|
|
[ -d "$1" ] || return
|
|
|
|
eval echo \$$PATHVAR | grep -q "\(:\|^\)$1\(:\|$\)" && return
|
|
|
|
eval export $PATHVAR="\$$PATHVAR:$1"
|
2013-07-25 20:50:37 +02:00
|
|
|
}
|
2016-10-13 11:23:41 +02:00
|
|
|
prependpath () {
|
2014-11-12 18:00:08 +01:00
|
|
|
[ $# -eq 2 ] && PATHVAR=$2 || PATHVAR=PATH
|
2016-10-13 11:23:41 +02:00
|
|
|
[ -d "$1" ] || return
|
|
|
|
eval echo \$$PATHVAR | grep -q "\(:\|^\)$1\(:\|$\)" && return
|
|
|
|
eval export $PATHVAR="$1:\$$PATHVAR"
|
2013-07-27 11:11:48 +02:00
|
|
|
}
|
2013-07-25 20:50:37 +02:00
|
|
|
|
2017-12-09 10:14:54 +01:00
|
|
|
## Cask
|
|
|
|
appendpath "$HOME/.cask/bin"
|
|
|
|
|
2019-09-25 12:19:34 +02:00
|
|
|
## 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
|
|
|
|
|
2019-10-17 11:00:47 +02:00
|
|
|
## Use this to override system executables.
|
|
|
|
prependpath "${HOME}/personal/hackpool"
|
|
|
|
|
2017-06-06 20:22:40 +02:00
|
|
|
## Last PATH entries.
|
2017-11-23 11:17:19 +01:00
|
|
|
appendpath "${HOME}/.local/bin"
|
2017-06-06 20:22:40 +02:00
|
|
|
|
2018-04-09 08:37:31 +02:00
|
|
|
## mcron: needs to be run after PATH is fully set or else local programs could
|
|
|
|
## be missing.
|
|
|
|
if command -v mcron >/dev/null 2>&1; then
|
2019-03-18 10:52:06 +01:00
|
|
|
# TODO: Only start if not already started?
|
|
|
|
# pkill mcron
|
|
|
|
mcron &
|
2018-04-09 08:37:31 +02:00
|
|
|
fi
|
2017-06-08 18:39:04 +02:00
|
|
|
|
2014-10-22 17:54:33 +02:00
|
|
|
## Remove less history.
|
|
|
|
LESSHISTFILE='-'
|
2013-06-03 20:18:14 +02:00
|
|
|
|
|
|
|
## Manpage.
|
|
|
|
export MANWIDTH=80
|
|
|
|
|
|
|
|
## SSH-Agent
|
2018-02-05 15:20:49 +01:00
|
|
|
## 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)"
|
2016-05-31 10:42:33 +02:00
|
|
|
fi
|
2018-02-05 15:20:49 +01:00
|
|
|
# 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
|
2013-07-04 23:56:05 +02:00
|
|
|
|
2017-06-06 20:22:40 +02:00
|
|
|
## Linux specific
|
2016-10-13 11:23:41 +02:00
|
|
|
if [ "$(uname -o)" = "GNU/Linux" ] ; then
|
|
|
|
## Startup error log.
|
|
|
|
log_dmesg="$(dmesg | grep -i error)"
|
2017-07-15 19:23:27 +02:00
|
|
|
[ -n "$log_dmesg" ] && echo "$log_dmesg" > "$HOME/errors-dmesg.log" || rm "$HOME/errors-dmesg.log" 2>/dev/null
|
2019-09-27 19:49:32 +02:00
|
|
|
unset log_dmesg
|
2016-10-13 11:23:41 +02:00
|
|
|
|
|
|
|
## External device auto-mounting.
|
2019-11-02 11:54:46 +01:00
|
|
|
if command -v udiskie >/dev/null 2>&1; then
|
|
|
|
udiskie &
|
|
|
|
fi
|
2016-10-13 11:23:41 +02:00
|
|
|
fi
|
|
|
|
|
2017-11-25 19:02:10 +01:00
|
|
|
## Wine DLL overrides.
|
|
|
|
## Remove the annoying messages for Mono and Gecko.
|
2013-07-04 23:56:05 +02:00
|
|
|
export WINEDLLOVERRIDES="mscoree,mshtml="
|
2017-11-25 19:02:10 +01:00
|
|
|
## Do not create desktop links or start menu entries.
|
|
|
|
export WINEDLLOVERRIDES="$WINEDLLOVERRIDES;winemenubuilder.exe=d"
|
2013-07-04 23:56:05 +02:00
|
|
|
|
2016-10-13 11:23:41 +02:00
|
|
|
## Default text editor
|
2017-07-09 00:15:02 +02:00
|
|
|
## 'em' is a custom wrapper for emacsclient. See '.bin/em'.
|
2017-05-25 19:15:17 +02:00
|
|
|
## VISUAL is given priority by some programs like Mutt. This way we can separate
|
|
|
|
## editors that wait from those that don't.
|
2019-09-27 19:54:14 +02:00
|
|
|
for i in emacsclient em emacs zile vim nano vi; do
|
2016-10-13 11:23:41 +02:00
|
|
|
command -v $i >/dev/null 2>&1 && export EDITOR=$i && break
|
|
|
|
done
|
2016-10-13 14:57:17 +02:00
|
|
|
GIT_EDITOR="$EDITOR"
|
2017-05-08 18:11:47 +02:00
|
|
|
VISUAL="$EDITOR"
|
2016-10-13 14:57:17 +02:00
|
|
|
[ "$GIT_EDITOR" = em ] && GIT_EDITOR=emc
|
2017-05-08 18:11:47 +02:00
|
|
|
[ "$VISUAL" = em ] && VISUAL=emw
|
2016-10-13 14:57:17 +02:00
|
|
|
export GIT_EDITOR
|
2017-05-08 18:11:47 +02:00
|
|
|
export VISUAL
|
2016-10-13 11:23:41 +02:00
|
|
|
|
2013-08-20 14:49:36 +02:00
|
|
|
## Hook. Should be sourced last
|
|
|
|
[ -f ~/.profile_hook ] && . ~/.profile_hook
|
2013-09-19 12:00:25 +02:00
|
|
|
## Hook example
|
2013-10-14 09:12:28 +02:00
|
|
|
#
|
2013-09-19 12:00:25 +02:00
|
|
|
# export CPPFLAGS=-I$HOME/local/usr/include
|
|
|
|
# export LDFLAGS=-L$HOME/local/usr/lib
|
2013-10-14 09:12:28 +02:00
|
|
|
#
|
|
|
|
# appendpath "$HOME/local/usr/lib/python2.7/dist-packages/" PYTHONPATH
|
2014-03-26 15:49:29 +01:00
|
|
|
# export LUA_CPATH="$HOME/local/usr/lib/lib?.so;$(lua -e "print(package.cpath)")"
|
2013-09-19 12:00:25 +02:00
|
|
|
#
|
|
|
|
# umask 077
|
2016-10-13 11:23:41 +02:00
|
|
|
|
|
|
|
## End: Source .bashrc. The rc file should guard against non-interactive shells.
|
|
|
|
[ "$(ps -o comm= $$)" != bash ] && return
|
|
|
|
[ -f ~/.bashrc ] && . ~/.bashrc
|
2017-07-29 10:32:14 +02:00
|
|
|
|
|
|
|
[ -z "$DISPLAY" ] && [ "$(tty)" = '/dev/tty1' ] && exec xinit -- vt01
|