Moved env variables to .profile.

Fixed home* scripts.
Various shell fixes.
master
Pierre Neidhardt 2013-06-03 20:18:14 +02:00
parent 3435dcafdb
commit e6e6d88957
11 changed files with 137 additions and 144 deletions

View File

@ -15,13 +15,18 @@
(setq-default save-place t)
;; Disable autosave features
;; TODO: folder is still created and filled with dummy files?
;; TODO: does not work?
(setq auto-save-default nil)
(setq auto-save-list-file-name nil)
;; (setq auto-save-file-name-transforms
;; '((".*" ,temporary-file-directory t)))
;; Place Backup Files in Specific Directory
;; TODO: use cache variable.
(setq backup-directory-alist
(quote ((".*" . "~/.cache/emacs/backups/"))))
;; `(quote ((".*" . ,(concat emacs-cache-folder "backups/")))))
;; '((".*" . (concat emacs-cache-folder "backups/"))))
;; (setq backup-inhibited t) ;; Disable backup files.
;; (setq make-backup-files t) ;; Enable backup files.
;; (setq version-control t) ;; Enable numbered versioning.

View File

@ -1,17 +0,0 @@
;; This file is automatically generated by the multiple-cursors extension.
;; It keeps track of your preferences for running commands with multiple cursors.
(setq mc/cmds-to-run-for-all
'(
c-electric-semi&comma
kill-region
c-electric-delete-forward
dabbrev-expand
repeat
yas/expand
))
(setq mc/cmds-to-run-once
'(
c-compile
))

93
.profile Normal file
View File

@ -0,0 +1,93 @@
#!/bin/sh
################################################################################
## .profile
## 2013-06-03
################################################################################
## 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
## Path
## WARNING: putting current dir '.' in PATH is mostly a bad idea!
# export PATH=.:$PATH
export PATH=$PATH:${HOME}/.launchers/
export PATH=$PATH:${HOME}/.scripts/
## 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
export PATH=${TEXFOLDER}:$PATH
export INFOPATH=${TEXDIR}/${TEXYEAR}/texmf/doc/info:$INFOPATH
## BSD uses 'manpath' utility, so MANPATH variable may be empty.
if [ "$OSTYPE" = "linux-gnu" ]; then
export MANPATH=${TEXDIR}/${TEXYEAR}/texmf/doc/man:$MANPATH
fi
fi
unset TEXYEAR
unset TEXDISTRO
unset TEXFOLDER
fi
unset TEXDIR
## Make 'less' more friendly for non-text input files, see lesspipe(1).
[ -n "$(command -v lesspipe)" ] && eval "$(lesspipe)"
## 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
# export LC_MESSAGES=fr_FR.utf8
## Default text editor
EDITOR="nano"
[ -n "$(command -v vim)" ] && EDITOR="vim"
[ -n "$(command -v emacs)" ] && EDITOR="emacs"
GIT_EDITOR="$EDITOR"
## 'em' is a script for emacsclient. See 'homeinit'.
if [ -n "$(command -v em)" ]; then
EDITOR='em'
GIT_EDITOR='emc'
fi
export EDITOR
export GIT_EDITOR
## Internet Browser
[ -n "$(command -v luakit)" ] && export BROWSER="luakit"
[ -n "$(command -v dwb)" ] && export BROWSER="dwb"
## SSH-Agent
## WARNING: this is somewhat insecure. Avoid using it on a mutli-user machine.
if [ -n "$(command -v ssh-agent)" ]; then
SSH_ENV_FILE="/tmp/ssh-agent-env"
if [ $(ps ax -o command="" | grep -c "ssh-agent") -eq 1 ]; then
SSH_AGENT_VARS=$(ssh-agent)
eval $(echo "${SSH_AGENT_VARS}")
echo "${SSH_AGENT_VARS}" | sed '2q' | cut -d'=' -f2 | cut -d';' -f1 > "$SSH_ENV_FILE"
chmod 444 "$SSH_ENV_FILE"
unset $SSH_AGENT_VARS
elif [ -f "$SSH_ENV_FILE" ]; then
SSH_AUTH_SOCK=$(sed -n '1{p;q}' "$SSH_ENV_FILE") ; export SSH_AUTH_SOCK
SSH_AGENT_PID=$(sed -n '2{p;q}' "$SSH_ENV_FILE") 2>/dev/null ; export SSH_AGENT_PID
fi
unset SSH_ENV_FILE
fi

View File

@ -1,6 +1,7 @@
#!/bin/sh
RMLIST="$HOME/.cache/dwb
$HOME/.cache/emacs
$HOME/.cache/mutt
$HOME/.cmus/autosave
$HOME/.cmus/cache

View File

@ -3,7 +3,7 @@
## Home session initialization.
## 2013-03-01
################################################################################
SOURCEDIR="${HOME}/personal/dataperso"
SOURCEDIR="$HOME/personal/dataperso"
[ -z "$XDG_CONFIG_HOME" ] && XDG_CONFIG_HOME="$HOME/.config"
[ -z "$XDG_DATA_HOME" ] && XDG_DATA_HOME="$HOME/.local/share"
[ -z "$XDG_DATA_DIRS" ] && XDG_DATA_DIRS="/usr/local/share"
@ -45,36 +45,35 @@ if [ -f "$HOME/.xkb/symbols/frex" ] && [ ! -f "/usr/share/X11/xkb/symbols/frex"
fi
if [ -d "$SOURCEDIR" ]; then
if [ -d "$SOURCEDIR/contacts" ]; then
echo "==> Abook"
# [ -d "$SOURCEDIR" ] && ln -snf "$(realpath ${SOURCEDIR}/contacts)" "${HOME}/.abook"
ln -snf "${SOURCEDIR}/contacts" "${HOME}/.abook"
ln -snf "$SOURCEDIR/contacts" "$HOME/.abook"
echo
fi
if [ -n "$(command -v mutt)" ]; then
echo "==> Mutt"
[ -d "$SOURCEDIR" ] && ln -snf "${SOURCEDIR}/mails" "${HOME}/.mutt.d"
mkdir -p "${HOME}/.cache/mutt/hcache"
[ -d "$SOURCEDIR" ] && ln -snf "$SOURCEDIR/mails" "$HOME/.mutt.d"
mkdir -p "$HOME/.cache/mutt/hcache"
echo
fi
if [ -d "$SOURCEDIR" ]; then
echo "==> To-Do"
ln -snf "${SOURCEDIR}/todo/todo.org" "${HOME}/todo.org"
ln -snf "$SOURCEDIR/todo/todo.org" "$HOME/todo.org"
echo
fi
if [ -n "$(command -v rtorrent)" ]; then
echo "==> rtorrent"
mkdir -p "${HOME}/.session"
mkdir -p "$HOME/.session"
echo
fi
## Luakit -- Install the adblock modules
if [ -n "$(command -v luakit)" ]; then
echo "==> Luakit"
git clone https://github.com/Plaque-fcc/luakit-adblock/ "${HOME}/luakit-adblock"
git clone https://github.com/Plaque-fcc/luakit-adblock/ "$HOME/luakit-adblock"
cp -fv ~/luakit-adblock/*.lua "$XDG_CONFIG_HOME/luakit"
rm -rvf "$HOME/luakit-adblock"
@ -106,8 +105,8 @@ if [ -d "$SOURCEDIR" ]; then
if [ "$BROWSER" = "dwb" ]; then
BROWSER_DATA_DIR="$XDG_CONFIG_HOME/$BROWSER/default/"
fi
[ -d "$SOURCEDIR" ] && ln -sf "${SOURCEDIR}/bookmarks/bookmarks" "$BROWSER_DATA_DIR"
[ -d "$SOURCEDIR" ] && ln -sf "${SOURCEDIR}/bookmarks/quickmarks" "$BROWSER_DATA_DIR"
[ -d "$SOURCEDIR" ] && ln -sf "$SOURCEDIR/bookmarks/bookmarks" "$BROWSER_DATA_DIR"
[ -d "$SOURCEDIR" ] && ln -sf "$SOURCEDIR/bookmarks/quickmarks" "$BROWSER_DATA_DIR"
fi
echo
fi
@ -116,14 +115,14 @@ fi
if [ -n "$(command -v newsbeuter)" ]; then
echo "==> Newsbeuter"
mkdir -p "$XDG_DATA_HOME/newsbeuter"
[ -d "$SOURCEDIR" ] && ln -sf "${SOURCEDIR}/news/urls" "$XDG_CONFIG_HOME/newsbeuter/"
[ -d "$SOURCEDIR" ] && ln -sf "${SOURCEDIR}/news/news_starred" "$XDG_CONFIG_HOME/newsbeuter/"
[ -d "$SOURCEDIR" ] && ln -sf "$SOURCEDIR/news/urls" "$XDG_CONFIG_HOME/newsbeuter/"
[ -d "$SOURCEDIR" ] && ln -sf "$SOURCEDIR/news/news_starred" "$XDG_CONFIG_HOME/newsbeuter/"
echo
fi
## Launchers
if [ -d "$SOURCEDIR" ]; then
echo "==> Launchers"
ln -snf "${SOURCEDIR}/launchers" "${HOME}/.launchers"
ln -snf "$SOURCEDIR/launchers" "$HOME/.launchers"
echo
fi

View File

@ -1,7 +1,12 @@
#!/bin/sh
if [ -z "$(command -v ffmpeg)" ]; then
echo "ffmpeg required."
echo "ffmpeg required for transcoding."
exit
fi
if [ -z "$(command -v realpath)" ]; then
echo "realpath required to get input file folder."
exit
fi

View File

@ -77,6 +77,9 @@ else
alias halt='sudo halt -p'
fi
## TODO file.
alias todo='$EDITOR ~/todo.org'
## Start X and lock current terminal (press ENTER when back in terminal to prompt for password).
[ -n "$(command -v vlock)" ] && alias sx='startx & vlock'

View File

@ -4,6 +4,18 @@
## Date 2013-05-24
################################################################################
## Terminal
## WARNING: this is always a bad idea!
## FreeBSD urxvt $TERM variable is not set properly for some reasons.
## TODO: check how to do this properly.
if [ ! "$OSTYPE" = "linux-gnu" ] && [[ "$TERM" = *rxvt* ]]; then
export TERM="rxvt-unicode-256color"
fi
## Most xterm-based terminals support 256 colors, so let's turn this on.
if [ "$TERM" = "xterm" ]; then
export TERM="xterm-256color"
fi
## Enable color support of ls.
if [ "$TERM" != "dumb" ] && [ "$OSTYPE" = "linux-gnu" ]; then
eval "`dircolors $HOME/.shell.d/dircolorsdb`"

View File

@ -1,8 +0,0 @@
## -*- mode:sh -*- #
########################################################################
## Shell -- Personal Definitions.
## Date 2013-02-09
########################################################################
[ -d "$HOME/temp" ] && TEMP="$HOME/temp"
alias todo='$EDITOR ~/todo.org'

104
.xprofile
View File

@ -5,108 +5,6 @@
################################################################################
## This file is sourced by some DM and should not contain any desktop execution.
## Mask
## Result for 027 is: rwxr-x---
umask 027
## Path
## WARNING: putting current dir '.' in PATH is mostly a bad idea!
# export PATH=.:$PATH
export PATH=$PATH:${HOME}/.launchers/
export PATH=$PATH:${HOME}/.scripts/
## 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
export PATH=${TEXFOLDER}:$PATH
export INFOPATH=${TEXDIR}/${TEXYEAR}/texmf/doc/info:$INFOPATH
## BSD uses 'manpath' utility, so MANPATH variable may be empty.
if [ "$OSTYPE" = "linux-gnu" ]; then
export MANPATH=${TEXDIR}/${TEXYEAR}/texmf/doc/man:$MANPATH
fi
fi
unset TEXYEAR
unset TEXDISTRO
unset TEXFOLDER
fi
unset TEXDIR
## Terminal
## WARNING: this is always a bad idea!
## FreeBSD urxvt $TERM variable is not set properly for some reasons.
## TODO: check how to do this properly.
if [ ! "$OSTYPE" = "linux-gnu" ] && [[ "$TERM" = *rxvt* ]]; then
export TERM="rxvt-unicode-256color"
fi
## Most xterm-based terminals support 256 colors, so let's turn this on.
if [ "$TERM" = "xterm" ]; then
export TERM="xterm-256color"
fi
## Make 'less' more friendly for non-text input files, see lesspipe(1).
[ -x /usr/bin/lesspipe ] && eval "$(lesspipe)"
## 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
# export LC_MESSAGES=fr_FR.utf8
## Default text editor
EDITOR=nano
if [ -n "$(command -v vim)" ]; then
EDITOR=vim
fi
if [ -n "$(command -v emacs)" ]; then
EDITOR='emacs'
fi
GIT_EDITOR="$EDITOR"
## 'em' is a script for emacsclient. See 'homeinit'.
if [ -n "$(command -v em)" ]; then
EDITOR='em'
GIT_EDITOR='emc'
fi
export EDITOR
export GIT_EDITOR
## Internet Browser
[ -n "$(command -v luakit)" ] && export BROWSER="luakit"
[ -n "$(command -v dwb)" ] && export BROWSER="dwb"
## SSH-Agent
## WARNING: this is somewhat insecure. Avoid using it on a mutli-user machine.
if [ -n "$(command -v ssh-agent)" ]; then
SSH_ENV_FILE="/tmp/ssh-agent-env"
if [ $(ps ax -o command="" | grep -c "ssh-agent") -eq 1 ]; then
SSH_AGENT_VARS=$(ssh-agent)
eval $(echo "${SSH_AGENT_VARS}")
echo "${SSH_AGENT_VARS}" | sed '2q' | cut -d'=' -f2 | cut -d';' -f1 > "$SSH_ENV_FILE"
chmod 444 "$SSH_ENV_FILE"
unset $SSH_AGENT_VARS
elif [ -f "$SSH_ENV_FILE" ]; then
SSH_AUTH_SOCK=$(sed -n '1{p;q}' "$SSH_ENV_FILE") ; export SSH_AUTH_SOCK
SSH_AGENT_PID=$(sed -n '2{p;q}' "$SSH_ENV_FILE") 2>/dev/null ; export SSH_AGENT_PID
fi
unset SSH_ENV_FILE
fi
## X config (for URxvt, etc.)
[ -f "${HOME}/.Xresources" ] && xrdb -merge "${HOME}/.Xresources"
@ -123,3 +21,5 @@ if [ "$OSTYPE" = "linux-gnu" ] ; then
## External device auto-mounting.
[ -n "$(command -v udiskie)" ] && udiskie &
fi
[ -d "$HOME/temp" ] && export TEMP="$HOME/temp"

2
.zshrc
View File

@ -11,6 +11,7 @@ SHELL_CURRENT="$(ps -o command="" $$)"
SHELL_DIR="$HOME/.shell.d"
## Should be sourced first.
. "$HOME/.profile"
. "${SHELL_DIR}/main_rc"
. "${SHELL_DIR}/options_zsh"
@ -20,7 +21,6 @@ SHELL_DIR="$HOME/.shell.d"
. "${SHELL_DIR}/completion_rc"
. "${SHELL_DIR}/funs_rc"
. "${SHELL_DIR}/keys_zsh"
. "${SHELL_DIR}/personal_rc"
## Should be sourced last
[ -f "${SHELL_DIR}/hook" ] && . "${SHELL_DIR}/hook"