2013-06-03 20:18:14 +02:00
|
|
|
#!/bin/sh
|
|
|
|
################################################################################
|
|
|
|
## .profile
|
|
|
|
################################################################################
|
|
|
|
## This file is sourced by .xprofile and shell rc files to make sure it work in
|
|
|
|
## TTY as well as under X.
|
|
|
|
|
|
|
|
## Mask
|
|
|
|
## Result for 027 is: rwxr-x---
|
|
|
|
umask 027
|
|
|
|
|
2013-07-27 11:11:48 +02:00
|
|
|
## Note that it is important for MANPATH to have an empty entry to keep
|
|
|
|
## searching in the default db path. Same for INFOPATH, which should have an
|
|
|
|
## empty entry at the end, otherwise Emacs will not use standard locations. For
|
|
|
|
## security (and bad programming assumptions) you should always append entries
|
|
|
|
## to PATH, not prepend them.
|
|
|
|
appendpath()
|
2013-07-25 20:50:37 +02:00
|
|
|
{
|
|
|
|
[ $# -eq 2 ] && PATHVAR=$2 || PATHVAR=PATH
|
2013-07-25 21:12:09 +02:00
|
|
|
if [ -z "$(eval echo \$$PATHVAR | grep "\(:\|^\)$1\(:\|$\)")" ]; then
|
2013-07-25 20:50:37 +02:00
|
|
|
eval export $PATHVAR="\$$PATHVAR:$1"
|
|
|
|
fi
|
|
|
|
}
|
2013-07-27 11:11:48 +02:00
|
|
|
prependpath()
|
|
|
|
{
|
|
|
|
[ $# -eq 2 ] && PATHVAR=$2 || PATHVAR=PATH
|
|
|
|
if [ -z "$(eval echo \$$PATHVAR | grep "\(:\|^\)$1\(:\|$\)")" ]; then
|
|
|
|
eval export $PATHVAR="$1:\$$PATHVAR"
|
|
|
|
fi
|
|
|
|
}
|
2013-07-25 20:50:37 +02:00
|
|
|
|
2013-07-27 11:11:48 +02:00
|
|
|
appendpath "${HOME}/.launchers/"
|
|
|
|
appendpath "${HOME}/.scripts/"
|
2014-03-21 16:27:38 +01:00
|
|
|
prependpath "${HOME}/.hackpool/"
|
2013-10-17 23:02:22 +02:00
|
|
|
[ -d /usr/lib/surfraw ] && appendpath "/usr/lib/surfraw"
|
2013-06-03 20:18:14 +02:00
|
|
|
|
|
|
|
## TeXlive
|
|
|
|
TEXDIR="${TEXDIR:-/usr/local/texlive}"
|
|
|
|
if [ -d "${TEXDIR}" ]; then
|
|
|
|
TEXYEAR=$(/bin/ls -1r "${TEXDIR}" | grep -m1 "[0-9]\{4\}")
|
|
|
|
TEXDISTRO=$(uname -m)-$(uname | tr "[[:upper:]]" "[[:lower:]]")
|
|
|
|
TEXFOLDER="${TEXDIR}/${TEXYEAR}/bin/${TEXDISTRO}/"
|
|
|
|
if [ -d "${TEXFOLDER}" ]; then
|
2013-07-27 11:11:48 +02:00
|
|
|
appendpath $TEXFOLDER
|
|
|
|
prependpath ${TEXDIR}/${TEXYEAR}/texmf/doc/info INFOPATH
|
2013-06-03 20:18:14 +02:00
|
|
|
|
|
|
|
## BSD uses 'manpath' utility, so MANPATH variable may be empty.
|
|
|
|
if [ "$OSTYPE" = "linux-gnu" ]; then
|
2013-07-27 11:11:48 +02:00
|
|
|
prependpath ${TEXDIR}/${TEXYEAR}/texmf/doc/man MANPATH
|
2013-06-03 20:18:14 +02:00
|
|
|
fi
|
|
|
|
fi
|
|
|
|
unset TEXYEAR
|
|
|
|
unset TEXDISTRO
|
|
|
|
unset TEXFOLDER
|
|
|
|
fi
|
|
|
|
unset TEXDIR
|
2014-03-31 11:43:44 +02:00
|
|
|
export BIBINPUTS=~/personal/dataperso/bibliography
|
2013-06-03 20:18:14 +02:00
|
|
|
|
2014-01-06 15:18:42 +01:00
|
|
|
## Plan9
|
|
|
|
PLAN9DIR="/opt/plan9"
|
|
|
|
if [ -d "$PLAN9DIR" ]; then
|
|
|
|
appendpath "$PLAN9DIR/bin"
|
|
|
|
if [ "$OSTYPE" = "linux-gnu" ]; then
|
|
|
|
appendpath "$PLAN9DIR/share/man" MANPATH
|
|
|
|
fi
|
|
|
|
fi
|
|
|
|
unset PLAN9DIR
|
|
|
|
|
2013-06-03 20:18:14 +02:00
|
|
|
## Make 'less' more friendly for non-text input files, see lesspipe(1).
|
2014-01-03 19:13:07 +01:00
|
|
|
command -v lesspipe >/dev/null 2>&1 && eval "$(lesspipe)"
|
2013-06-03 20:18:14 +02:00
|
|
|
|
|
|
|
## Manpage.
|
|
|
|
export MANPAGER="less -s"
|
|
|
|
export MANWIDTH=80
|
|
|
|
## The following options are useful for FreeBSD default 'less' command which has
|
|
|
|
## an empty prompt. Sadly this gets messy with 'apropos'.
|
|
|
|
# export MANPAGER="less -sP '?f%f .?m(file %i of %m) .?ltlines %lt-%lb?L/%L. .byte %bB?s/%s. ?e(END) :?pB%pB\%..%t'"
|
|
|
|
|
|
|
|
## Less config. -R is needed for lesspipe.
|
|
|
|
export LESS=' -R '
|
|
|
|
|
|
|
|
## Time display (with ls command for example)
|
|
|
|
## TODO: BSD version?
|
|
|
|
export TIME_STYLE=+"|%Y-%m-%d %H:%M:%S|"
|
|
|
|
|
|
|
|
## System locale
|
2013-12-28 15:56:56 +01:00
|
|
|
if [ "$USER" = "peter" ]; then
|
|
|
|
LANG=sv_SE.UTF-8
|
|
|
|
LC_CTYPE="sv_SE.UTF-8"
|
|
|
|
LC_NUMERIC="sv_SE.UTF-8"
|
|
|
|
LC_TIME="sv_SE.UTF-8"
|
|
|
|
LC_COLLATE="sv_SE.UTF-8"
|
|
|
|
LC_MONETARY="sv_SE.UTF-8"
|
|
|
|
LC_MESSAGES=sv_SE.UTF-8
|
|
|
|
LC_PAPER="sv_SE.UTF-8"
|
|
|
|
LC_NAME="sv_SE.UTF-8"
|
|
|
|
LC_ADDRESS="sv_SE.UTF-8"
|
|
|
|
LC_TELEPHONE="sv_SE.UTF-8"
|
|
|
|
LC_MEASUREMENT="sv_SE.UTF-8"
|
|
|
|
LC_IDENTIFICATION="sv_SE.UTF-8"
|
|
|
|
|
|
|
|
# LC_ALL=
|
|
|
|
LC_ALL=sv_SE.UTF-8
|
|
|
|
fi
|
2013-06-03 20:18:14 +02:00
|
|
|
|
|
|
|
## Default text editor
|
|
|
|
EDITOR="nano"
|
2014-01-03 19:13:07 +01:00
|
|
|
command -v vim >/dev/null 2>&1 && EDITOR="vim"
|
|
|
|
command -v emacs >/dev/null 2>&1 && EDITOR="emacs"
|
2013-06-03 20:18:14 +02:00
|
|
|
GIT_EDITOR="$EDITOR"
|
|
|
|
|
2014-01-03 19:13:07 +01:00
|
|
|
## 'em' is a script for emacsclient. See '.scripts/em'.
|
|
|
|
if command -v em >/dev/null 2>&1; then
|
2013-12-28 15:56:56 +01:00
|
|
|
EDITOR='em'
|
|
|
|
GIT_EDITOR='emc'
|
2013-06-03 20:18:14 +02:00
|
|
|
fi
|
2013-12-21 20:02:24 +01:00
|
|
|
|
2013-06-03 20:18:14 +02:00
|
|
|
export EDITOR
|
|
|
|
export GIT_EDITOR
|
|
|
|
|
|
|
|
## Internet Browser
|
2014-03-18 16:21:45 +01:00
|
|
|
for i in dwb luakit google-chrome; do
|
|
|
|
command -v $i >/dev/null 2>&1 && export BROWSER=$i && break
|
|
|
|
done
|
2013-06-03 20:18:14 +02:00
|
|
|
|
|
|
|
## SSH-Agent
|
2013-12-29 10:10:22 +01:00
|
|
|
## WARNING: this is insecure on machines where someone else has root access.
|
2014-01-03 19:13:07 +01:00
|
|
|
command -v ssh-agent >/dev/null 2>&1 && eval "$(ssh-agent)"
|
2014-03-04 10:25:42 +01:00
|
|
|
## Kill ssh-agent on session end. Console login only.
|
|
|
|
command -v sessionclean >/dev/null 2>&1 && trap 'sessionclean' 0
|
2013-07-04 23:56:05 +02:00
|
|
|
|
2013-10-14 09:12:28 +02:00
|
|
|
## Set TEMP dir if you want to override /tmp for some applications that check
|
2013-12-29 10:10:22 +01:00
|
|
|
## for this variable. Usually not a good idea since some applications will write
|
|
|
|
## junk files in it.
|
2013-09-18 15:05:52 +02:00
|
|
|
# [ -d "$HOME/temp" ] && export TEMP="$HOME/temp"
|
|
|
|
|
2013-07-04 23:56:05 +02:00
|
|
|
## Wine DLL override. This removes the annoying messages for Mono and Gecko.
|
|
|
|
export WINEDLLOVERRIDES="mscoree,mshtml="
|
|
|
|
|
2013-08-20 14:49:36 +02:00
|
|
|
## Hook. Should be sourced last
|
|
|
|
[ -f ~/.profile_hook ] && . ~/.profile_hook
|
2013-10-14 09:12:28 +02:00
|
|
|
################################################################################
|
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
|
|
|
# appendpath "${HOME}/local/usr/bin"
|
|
|
|
# prependpath "${HOME}/local/usr/share/info" INFOPATH
|
|
|
|
# prependpath "${HOME}/local/usr/share/man" MANPATH
|
2013-10-14 09:12:28 +02:00
|
|
|
#
|
|
|
|
# appendpath "$HOME/local/usr/include" C_INCLUDE_PATH
|
|
|
|
# appendpath "$HOME/local/usr/include" CPLUS_INCLUDE_PATH
|
|
|
|
# appendpath "$HOME/local/usr/lib" LIBRARY_PATH
|
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/pkgconfig" PKG_CONFIG_PATH
|
|
|
|
#
|
|
|
|
# appendpath "${HOME}/local/usr/lib/" LD_LIBRARY_PATH
|
|
|
|
# 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
|
2013-10-14 09:12:28 +02:00
|
|
|
################################################################################
|