summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorLuke Shumaker <LukeShu@sbcglobal.net>2012-10-10 01:20:24 -0400
committerLuke Shumaker <LukeShu@sbcglobal.net>2012-10-15 20:04:32 -0400
commit34a6c23f99988a75729b04880824b8d79d1391a2 (patch)
tree188dfe887d233700f1c88d997fd5e6267d3a8317
parent1557b290b98286d8c44ea066b64cc0910eecc0f7 (diff)
Use XDG for bash, remove alsa, clean up bash & profile, add CACHEDIR.TAG
.profile: fix up
l---------.bash_login1
l---------[-rw-r--r--].bash_logout10
l---------[-rw-r--r--].bashrc121
-rw-r--r--.config/bash/aliases.sh (renamed from .bash_aliases)13
-rw-r--r--.config/bash/login.sh9
-rw-r--r--.config/bash/logout.sh9
-rw-r--r--.config/bash/rc.d/emacs.sh (renamed from .bash.d/emacs.sh)0
-rw-r--r--.config/bash/rc.sh80
-rw-r--r--.git.info.exclude.in (renamed from .git.info.exclude)5
-rw-r--r--.login-daemons10
-rw-r--r--.profile74
-rw-r--r--Makefile9
12 files changed, 150 insertions, 191 deletions
diff --git a/.bash_login b/.bash_login
new file mode 120000
index 0000000..31231da
--- /dev/null
+++ b/.bash_login
@@ -0,0 +1 @@
+.config/bash/login.sh \ No newline at end of file
diff --git a/.bash_logout b/.bash_logout
index a8b88c1..d8117ff 100644..120000
--- a/.bash_logout
+++ b/.bash_logout
@@ -1,9 +1 @@
-# ~/.bash_logout: executed by bash(1) when login shell exits.
-
-# when leaving the console clear the screen to increase privacy
-
-if [ "$SHLVL" = 1 ]; then
- [ -x /usr/bin/clear_console ] && /usr/bin/clear_console -q
-fi
-
-make -C "$HOME"
+.config/bash/logout.sh \ No newline at end of file
diff --git a/.bashrc b/.bashrc
index ff11c5b..18faac1 100644..120000
--- a/.bashrc
+++ b/.bashrc
@@ -1,120 +1 @@
-# ~/.bashrc: executed by bash(1) for non-login shells.
-# see /usr/share/doc/bash/examples/startup-files (in the package bash-doc)
-# for examples
-
-# I include this file for all interactive invocations of bash(1), whether
-# they are login shells or not.
-
-# If not running interactively, don't do anything
-[ -z "$PS1" ] && return
-
-# don't put duplicate lines in the history. See bash(1) for more options
-# don't overwrite GNU Midnight Commander's setting of `ignorespace'.
-export HISTCONTROL=$HISTCONTROL${HISTCONTROL+,}ignoredups
-# ... or force ignoredups and ignorespace
-export HISTCONTROL=ignoreboth
-
-# append to the history file, don't overwrite it
-shopt -s histappend
-
-# for setting history length see HISTSIZE and HISTFILESIZE in bash(1)
-
-# check the window size after each command and, if necessary,
-# update the values of LINES and COLUMNS.
-shopt -s checkwinsize
-
-# Let ** recursively scan directories
-shopt -s globstar
-
-# Why is this not on by default?
-# "We have a cached value, but it isn't valid anymore. Should we trash it?"
-shopt -s checkhash
-
-# make less more friendly for non-text input files, see lesspipe(1)
-[ -x /usr/bin/lesspipe ] && eval "$(SHELL=/bin/sh lesspipe)"
-
-# set variable identifying the chroot you work in (used in the prompt below)
-if [ -z "$debian_chroot" ] && [ -r /etc/debian_chroot ]; then
- debian_chroot=$(cat /etc/debian_chroot)
-fi
-
-case "$TERM" in
- xterm) export TERM=xterm-256color;;
-esac
-
-# set a fancy prompt (non-color, unless we know we "want" color)
-case "$TERM" in
- linux) color_prompt=yes;;
- *-*color*) color_prompt=yes;;
-esac
-
-# uncomment for a colored prompt, if the terminal has the capability; turned
-# off by default to not distract the user: the focus in a terminal window
-# should be on the output of commands, not on the prompt
-#force_color_prompt=yes
-
-if [ -n "$force_color_prompt" ]; then
- if [ -x /usr/bin/tput ] && tput setaf 1 >&/dev/null; then
- # We have color support; assume it's compliant with Ecma-48
- # (ISO/IEC-6429). (Lack of such support is extremely rare, and such
- # a case would tend to support setf rather than setaf.)
- color_prompt=yes
- else
- color_prompt=
- fi
-fi
-
-if [ "$color_prompt" = yes ]; then
- PS1='${debian_chroot:+($debian_chroot)}\[\033[01;32m\]\u@\h\[\033[00m\]:\[\033[01;34m\]\w\[\033[00m\]\n\$ '
-else
- PS1='${debian_chroot:+($debian_chroot)}\u@\h:\w\n\$ '
-fi
-unset color_prompt force_color_prompt
-
-# If this is an xterm set the title to user@host:dir
-case "$TERM" in
-xterm*|rxvt*)
- PS1="\[\e]0;${debian_chroot:+($debian_chroot)}\u@\h: \w\a\]$PS1"
- ;;
-*)
- ;;
-esac
-
-# Include modular config files
-if [ -d ~/.bash.d ]; then
- for file in ~/.bash.d/*.sh; do
- . $file;
- done
-fi
-
-# Alias definitions.
-# You may want to put all your additions into a separate file like
-# ~/.bash_aliases, instead of adding them here directly.
-# See /usr/share/doc/bash-doc/examples in the bash-doc package.
-
-if [ -f ~/.bash_aliases ]; then
- . ~/.bash_aliases
-fi
-
-# enable programmable completion features (you don't need to enable
-# this, if it's already enabled in /etc/bash.bashrc and /etc/profile
-# sources /etc/bash.bashrc).
-if [ -f /etc/bash_completion ]; then
- . /etc/bash_completion
-fi
-
-if [ -f "$HOME/.login-daemons" ]; then
- . "$HOME/.login-daemons"
-fi
-
-if [ -f "${HOME}/.gnupg/agent-info" ]; then
- . "${HOME}/.gnupg/agent-info"
- export GPG_AGENT_INFO
- #export SSH_AUTH_SOCK
-fi
-
-export PERL_LOCAL_LIB_ROOT="/home/luke/perl5";
-export PERL_MB_OPT="--install_base /home/luke/perl5";
-export PERL_MM_OPT="INSTALL_BASE=/home/luke/perl5";
-export PERL5LIB="/home/luke/perl5/lib/perl5/i686-linux-thread-multi:/home/luke/perl5/lib/perl5";
-export PATH="/home/luke/perl5/bin:$PATH";
+.config/bash/rc.sh \ No newline at end of file
diff --git a/.bash_aliases b/.config/bash/aliases.sh
index de1a321..8241b95 100644
--- a/.bash_aliases
+++ b/.config/bash/aliases.sh
@@ -48,19 +48,12 @@ alias gitk='gitk --all --date-order'
redshift='redshift -l39.9030:85.9979'
alias gtk-redshift="gtk-$redshift"
alias redshift="$redshift"
+unset redshift
######################################################################
# Some almost-function aliases #
######################################################################
-#alias serva='ssh luke@servb.ath.cx -p3440'
-#alias phpdoctor='php /usr/gnu/www/0-other/phpdoctor-head/phpdoc.php'
-function xterm-title () { echo "];$@"; } # Oh, wait this one *is* a function
+xterm-title() { echo "];$@"; } # Oh, wait this one *is* a function
alias lock="clear; away -C 'This terminal is locked'"
alias plock="xterm-title Terminal Locked;lock"
-
-######################################################################
-# Other #
-######################################################################
-case "$TERM" in
- eterm*) alias editor='editor -n';;
-esac
+mvln() { mv $1 $2; ln -s $2 $1; }
diff --git a/.config/bash/login.sh b/.config/bash/login.sh
new file mode 100644
index 0000000..1269a03
--- /dev/null
+++ b/.config/bash/login.sh
@@ -0,0 +1,9 @@
+# ~/.bash_login: executed by bash(1) when login shell starts.
+
+# I think this is sane default behavior
+
+# Load user settings
+. "$HOME/.profile"
+
+# Load bash settings (automatic for non-login shells)
+. "$HOME/.bashrc"
diff --git a/.config/bash/logout.sh b/.config/bash/logout.sh
new file mode 100644
index 0000000..a8b88c1
--- /dev/null
+++ b/.config/bash/logout.sh
@@ -0,0 +1,9 @@
+# ~/.bash_logout: executed by bash(1) when login shell exits.
+
+# when leaving the console clear the screen to increase privacy
+
+if [ "$SHLVL" = 1 ]; then
+ [ -x /usr/bin/clear_console ] && /usr/bin/clear_console -q
+fi
+
+make -C "$HOME"
diff --git a/.bash.d/emacs.sh b/.config/bash/rc.d/emacs.sh
index f484bbb..f484bbb 100644
--- a/.bash.d/emacs.sh
+++ b/.config/bash/rc.d/emacs.sh
diff --git a/.config/bash/rc.sh b/.config/bash/rc.sh
new file mode 100644
index 0000000..ed55f75
--- /dev/null
+++ b/.config/bash/rc.sh
@@ -0,0 +1,80 @@
+# ~/.bashrc: executed by bash(1) for non-login shells.
+# see /usr/share/doc/bash/examples/startup-files (in the package bash-doc)
+# for examples
+
+# I include this file for all interactive invocations of bash(1), whether
+# they are login shells or not.
+
+# If not running interactively, don't do anything
+[ -z "$PS1" ] && return
+
+# don't put duplicate lines in the history. See bash(1) for more options
+export HISTCONTROL=ignoredups
+export HISTFILE=${XDG_CACHE_HOME}/bash/history
+export HISTTIMEFORMAT='[%Y-%m-%d %H:%M] '
+shopt -s histappend # append to the history file, don't overwrite it
+
+shopt -s checkwinsize # update the values of LINES and COLUMNS
+shopt -s globstar # Let ** recursively scan directories
+
+# Why is this not on by default?
+# "We have a cached value, but it isn't valid anymore. Should we trash it?"
+shopt -s checkhash
+
+# make less more friendly for non-text input files, see lesspipe(1)
+[ -x "`which lesspipe 2>/dev/null`" ] && eval "$(SHELL=/bin/sh lesspipe)"
+
+# set variable identifying the chroot you work in (used in the prompt below)
+if [ -z "$debian_chroot" ] && [ -r /etc/debian_chroot ]; then
+ debian_chroot=$(cat /etc/debian_chroot)
+fi
+
+make_prompt() {
+ local RESET=''
+ local BOLD=''
+ local GREEN=''
+ local BLUE=''
+ if $1; then
+ RESET="$(tput sgr0)"
+ BOLD="$(tput bold)"
+ GREEN="$(tput setaf 2)"
+ BLUE="$(tput setaf 4)"
+ fi
+ local CHROOT='${debian_chroot:+($debian_chroot)}'
+ echo "${RESET}${BOLD}${CHROOT}${GREEN}"'\u@\h'"${RESET}:${BOLD}${BLUE}"'\w'"${RESET}"
+}
+
+if [ -x /usr/bin/tput ] && tput setaf 1 >&/dev/null; then
+ # We have color support; assume it's compliant with Ecma-48
+ # (ISO/IEC-6429). (Lack of such support is extremely rare, and such
+ # a case would tend to support setf rather than setaf.)
+ PS1="$(make_prompt true )"'\n\$ '
+else
+ PS1="$(make_prompt false)"'\n\$ '
+fi
+
+# If this is an xterm set the title to user@host:dir
+case "$TERM" in
+ xterm*|rxvt*)
+ PS1="\[\e]0;$(make_prompt false)\a\]$PS1";;
+esac
+
+unset make_prompt
+
+# Include modular config files
+if [ -d "${XDG_CONFIG_HOME}/rc.d" ]; then
+ for file in "${XDG_CONFIG_HOME}/rc.d"/*.sh; do
+ . "$file"
+ done
+fi
+
+if [ -f ${XDG_CONFIG_HOME}/bash/aliases.sh ]; then
+ . ${XDG_CONFIG_HOME}/bash/aliases.sh
+fi
+
+# enable programmable completion features (you don't need to enable
+# this, if it's already enabled in /etc/bash.bashrc and /etc/profile
+# sources /etc/bash.bashrc).
+if [ -f /etc/bash_completion ]; then
+ . /etc/bash_completion
+fi
diff --git a/.git.info.exclude b/.git.info.exclude.in
index 871ebf6..37c1ee4 100644
--- a/.git.info.exclude
+++ b/.git.info.exclude.in
@@ -16,7 +16,7 @@
# Ignore temp/log/history files
*.log
-log*
+log.*
*.tmp
*.tmp.*
@@ -83,9 +83,10 @@ lock
.xsession-errors*
# Ignore files that are autogenerated
+.config/libretools/blacklist.txt
.folders
+.git.info.exclude
.nanorc
-.config/libretools/blacklist.txt
# Ignore these files for no good reason
.bogofilter
diff --git a/.login-daemons b/.login-daemons
deleted file mode 100644
index bf8cf21..0000000
--- a/.login-daemons
+++ /dev/null
@@ -1,10 +0,0 @@
-#!/bin/sh
-
-if [ -x "`which daemon`" ]; then
- daemon maildirproc
- daemon gpg-agent --daemon --write-env-file "${HOME}/.gnupg/agent-info"
- daemon batterymon 20 "
- alsactl restore --file $HOME/.full.asound;
- espeak 'PLUG ME IN';
- sleep .2;"
-fi
diff --git a/.profile b/.profile
index 2e2e1d0..a6c4d91 100644
--- a/.profile
+++ b/.profile
@@ -1,4 +1,8 @@
# ~/.profile: executed by the command interpreter for login shells.
+# Should be whether logging in graphically or not.
+#
+# This file should be executable by /bin/sh, but I'm going to assume bash(1)
+#
# This file is not read by bash(1), if ~/.bash_profile or ~/.bash_login
# exists.
@@ -9,33 +13,44 @@ umask 022
## Paths #############################################################
# Unix
-bins=$(echo $HOME/bin $HOME/.local.`uname -m`/bin $HOME/.local/bin $HOME/.prefix.`uname -m`/bin $HOME/.prefix/bin $HOME/.gem/ruby/*/bin)
-for dir in $bins; do
- if [ -d "$dir" ]; then
- export PATH="$dir:$PATH"
- fi
+bins=($HOME/bin $HOME/.local.`uname -m`/bin $HOME/.local/bin $HOME/.prefix.`uname -m`/bin $HOME/.prefix/bin $HOME/.gem/ruby/*/bin)
+for dir in "${bins[@]}"; do
+ if [ -d "$dir" ]; then
+ export PATH="$dir:$PATH"
+ fi
done
# Ruby
for dir in $HOME/.prefix/lib; do
- if [ -d "$dir" ]; then
- export RUBYLIB="$dir"
- fi
+ if [ -d "$dir" ]; then
+ export RUBYLIB="$dir"
+ fi
done
# Settings ###########################################################
# Text editor
if [ -f "$HOME/.selected_editor" ]; then
- . "$HOME/.selected_editor"
- export SELECTED_EDITOR
- export ALTERNATE_EDITOR
- export EDITOR="${EDITOR:-$SELECTED_EDITOR}"
- export VISUAL="${VISUAL:-$SELECTED_EDITOR}"
+ . "$HOME/.selected_editor"
+ export SELECTED_EDITOR
+ export ALTERNATE_EDITOR
+ export EDITOR="${EDITOR:-$SELECTED_EDITOR}"
+ export VISUAL="${VISUAL:-$SELECTED_EDITOR}"
fi
# GPG
-export GPGKEY=D4FFBFC9
+if [ -z "$GPGKEY" ] && [ -f "${HOME}/.gnupg/gpg.conf" ]; then
+ export GPGKEY=`sed -nr 's/^\s*default-key\s+//p' "${HOME}/.gnupg/gpg.conf"`
+fi
+if [ -z "$(pgrep -u `whoami` gpg-agent)" ]; then
+ mkdir -p ${XDG_RUNTIME_DIR}/sessions/gpg
+ gpg-agent --daemon --write-env-file "${XDG_RUNTIME_DIR}/sessions/gpg"
+fi
+if [ -f "${XDG_RUNTIME_DIR}/sessions/gpg" ]; then
+ . "${XDG_RUNTIME_DIR}/sessions/gpg"
+ export GPG_AGENT_INFO
+ #export SSH_AUTH_SOCK
+fi
# Java
_JAVA_OPTIONS=''
@@ -43,36 +58,27 @@ _JAVA_OPTIONS+=' -Dawt.useSystemAAFontSettings=on'
_JAVA_OPTIONS+=' -Dswing.aatext=true'
_JAVA_OPTIONS+=' -Dswing.defaultlaf=com.sun.java.swing.plaf.gtk.GTKLookAndFeel'
if [ -n "$TMPDIR" ]; then
- _JAVA_OPTIONS+=" -Djava.io.tmpdir=$TMPDIR"
+ _JAVA_OPTIONS+=" -Djava.io.tmpdir=$TMPDIR"
fi
export _JAVA_OPTIONS
-# ALSA
-if [ -x "`which alsactl 2>/dev/null`" ]; then
- alsactl restore "$HOME/.current.asound" &> /dev/null || true
-fi
-
# X11
if [ -z "$XAUTHORITY" ]; then
- export XAUTHORITY=$HOME/.Xauthority
+ export XAUTHORITY=$HOME/.Xauthority
fi
# D-Bus
if [ -z "$DBUS_SESSION_BUS_ADDRESS" ]; then
- eval `dbus-launch`
- export DBUS_SESSION_BUS_ADDRESS
- export DBUS_SESSION_BUS_PID
-fi
+ # I want a separate instance for each login
+ #dbus-launch > "${HOME}/.cache/sessions/dbus"
+ #. "${HOME}/.cache/sessions/dbus"
+ eval `dbus-launch`
-# Start background programs ##########################################
-if [ -f "$HOME/.login-daemons" ]; then
- . "$HOME/.login-daemons"
+ export DBUS_SESSION_BUS_ADDRESS
+ export DBUS_SESSION_BUS_PID
fi
-# BASH ###############################################################
-if [ -n "$BASH_VERSION" ]; then
- # include .bashrc if it exists
- if [ -f "$HOME/.bashrc" ]; then
- . "$HOME/.bashrc"
- fi
+# Load any box-specific stuff
+if [ -f "$HOME/.profile.local" ]; then
+ . "$HOME/.profile.local"
fi
diff --git a/Makefile b/Makefile
index 3cecf33..160a64c 100644
--- a/Makefile
+++ b/Makefile
@@ -4,22 +4,19 @@ NANO_BIN_PREFIX = $(patsubst %/bin/nano,%,$(shell which nano))
NANO_CHECK = $(HOME)/.prefix:$(HOME):/usr/local:/usr:$(NANO_BIN_PREFIX)
NANO_SHARE = $(firstword $(wildcard $(addsuffix /share/nano,$(subst :, ,$(NANO_CHECK)))))
-ALSACTL=$(firstword $(shell . $(HOME)/.profile &>/dev/null; which alsactl) echo)
-
-targets=.nanorc .folders .crontab.cookie .current.asound
+targets=.nanorc .folders .crontab.cookie .git.info.exclude
all: $(targets)
clean:
rm -f $(targets)
-%.asound: FORCE
- $(ALSACTL) store --file '$@'
-
.nanorc: .nanorc.in $(NANO_SHARE)
cat '$<' > '$@'
for file in $(NANO_SHARE)/*.nanorc; do echo "include \"$$file\""; done >> '$@'
.folders: Maildir
( echo '..'; find ~/Maildir -maxdepth 2 -type f -name "maildirfolder" -printf '%h\n'|sed -r 's@.*/(.*\.)(.*)@.\1\2@' )|sort>'$@'
+.git.info.exclude: .git.info.exclude.in .
+ ( cat $<; find . -type f -name 'CACHEDIR.TAG' -printf '%h\n'|sed 's@^\./@/@' ) > $@
.crontab.cookie: .crontab .crontab.local
-(cat $^; echo) | crontab - 2>/dev/null