diff options
author | Luke Shumaker <shumakl@purdue.edu> | 2015-09-19 15:49:29 -0400 |
---|---|---|
committer | Luke Shumaker <shumakl@purdue.edu> | 2015-09-19 15:49:29 -0400 |
commit | 118f849aed5aef3bf2750ca102007b4a38e44486 (patch) | |
tree | 47eb202ab5e4ed21a43122a44ed331e76a7bf258 /.config/login.d | |
parent | 739fa0ff2b7b0581b2d294f8de8b9e79234ed66c (diff) | |
parent | 641fc49fc651b6a67fb8ff90198e889e0e3920bb (diff) |
Merge remote-tracking branch 'origin/master' into purdue-cs/master
# Conflicts:
# .config/X11/clientrc
# .config/bash/rc.sh
# .config/cron/make-config
# .config/emacs/custom.el
# .config/emacs/init.el
# .config/login.d/10_selected-editor.sh
# .config/login.sh
Diffstat (limited to '.config/login.d')
-rw-r--r-- | .config/login.d/00_coredumps.sh | 1 | ||||
-rw-r--r-- | .config/login.d/00_path.sh | 1 | ||||
-rw-r--r-- | .config/login.d/00_umask.sh | 1 | ||||
-rw-r--r-- | .config/login.d/01_xdg.sh | 33 | ||||
-rw-r--r-- | .config/login.d/02_tmpdir.sh | 2 | ||||
-rw-r--r-- | .config/login.d/02_xdg_runtime_dir.sh | 29 | ||||
-rw-r--r-- | .config/login.d/03_tmpdir.sh | 5 | ||||
-rw-r--r-- | .config/login.d/10_gpg.sh | 1 | ||||
-rw-r--r-- | .config/login.d/10_java.sh | 1 | ||||
-rw-r--r-- | .config/login.d/10_less.sh | 1 | ||||
-rw-r--r-- | .config/login.d/10_makeflags.sh | 2 | ||||
-rw-r--r-- | .config/login.d/10_selected-editor.sh | 5 | ||||
-rw-r--r-- | .config/login.d/10_spell-check.sh | 3 | ||||
-rw-r--r-- | .config/login.d/10_xauthority.sh | 3 |
14 files changed, 54 insertions, 34 deletions
diff --git a/.config/login.d/00_coredumps.sh b/.config/login.d/00_coredumps.sh index 8fcc61b..45d19b8 100644 --- a/.config/login.d/00_coredumps.sh +++ b/.config/login.d/00_coredumps.sh @@ -1 +1,2 @@ +#!/hint/sh ulimit -c unlimited # save core dumps diff --git a/.config/login.d/00_path.sh b/.config/login.d/00_path.sh index f4ca3a6..2d5f4a5 100644 --- a/.config/login.d/00_path.sh +++ b/.config/login.d/00_path.sh @@ -1,3 +1,4 @@ +#!/hint/sh if type config-path &>/dev/null; then config_path=config-path else diff --git a/.config/login.d/00_umask.sh b/.config/login.d/00_umask.sh index 8e71ad5..c6187dd 100644 --- a/.config/login.d/00_umask.sh +++ b/.config/login.d/00_umask.sh @@ -1 +1,2 @@ +#!/hint/sh umask 022 diff --git a/.config/login.d/01_xdg.sh b/.config/login.d/01_xdg.sh index 4464764..ed17ddb 100644 --- a/.config/login.d/01_xdg.sh +++ b/.config/login.d/01_xdg.sh @@ -1,4 +1,4 @@ -# This should be readable by /bin/sh +#!/hint/sh # Sets up XDG environmental variables, so programs using them don't have to # worry about checking if they are set. @@ -9,35 +9,12 @@ [ -n "$XDG_DATA_DIRS" ] || export XDG_DATA_DIRS="/usr/local/share/:/usr/share/" [ -n "$XDG_CONFIG_DIRS" ] || export XDG_CONFIG_DIRS="/etc/xdg" [ -n "$XDG_CACHE_HOME" ] || export XDG_CACHE_HOME="$HOME/.cache" +[ -n "$XDG_VTNR" ] || export XDG_VTNR="$(tty 2>/dev/null | sed -n 's,^/dev/tty,,p')" + +# Check if XDG_VTNR got set to empty +[ -n "$XDG_VTNR" ] || unset XDG_VTNR # Check if XDG_RUNTIME_DIR is set, but has a bogus setting if [ -n "$XDG_RUNTIME_DIR" ] && [ ! -d "$XDG_RUNTIME_DIR" ]; then unset XDG_RUNTIME_DIR fi - -# Set XDG_RUNTIME_DIR if we can -if [ -z "$XDG_RUNTIME_DIR" ] && type flock &>/dev/null; then - _diy_xdg_runtime_login() { - export XDG_RUNTIME_DIR="$XDG_CACHE_HOME/xdg-runtime-dir/$HOSTNAME" - # There's a race condition here, between the `ln -s` and `flock`. - # But it's not like I'll be hammering a box with logins. - if [ ! -d "$XDG_RUNTIME_DIR" ]; then - local tmp="$(mktemp -d --tmpdir -- "${USER}@${HOSTNAME}-runtime.XXXXXXXXXX")" - mkdir -p -- "$XDG_CACHE_HOME/xdg-runtime-dir" - ln -sfT -- "$tmp" "$XDG_RUNTIME_DIR" - fi - if ! [ /dev/fd/7 -ef "$XDG_CACHE_HOME/xdg-runtime-dir/.lock" ]; then - exec 7>"$XDG_CACHE_HOME/xdg-runtime-dir/.lock" - if flock -sn 7; then - # Unfortunately this doesn't survive across exec(1). - trap _diy_xdg_runtime_logout EXIT - fi - fi - } - _diy_xdg_runtime_logout() { - if flock -xn 7; then - rm -rf -- "$(readlink "$XDG_RUNTIME_DIR")" - fi - } - _diy_xdg_runtime_login -fi diff --git a/.config/login.d/02_tmpdir.sh b/.config/login.d/02_tmpdir.sh deleted file mode 100644 index c0d5f18..0000000 --- a/.config/login.d/02_tmpdir.sh +++ /dev/null @@ -1,2 +0,0 @@ -mkdir -p -- "$XDG_RUNTIME_DIR/tmpdir" -export TMPDIR="$XDG_RUNTIME_DIR/tmpdir" diff --git a/.config/login.d/02_xdg_runtime_dir.sh b/.config/login.d/02_xdg_runtime_dir.sh new file mode 100644 index 0000000..864eadd --- /dev/null +++ b/.config/login.d/02_xdg_runtime_dir.sh @@ -0,0 +1,29 @@ +#!/hint/sh + +# Set XDG_RUNTIME_DIR if we can +if [ -z "$XDG_RUNTIME_DIR" ] && shopt -q login_shell && type flock &>/dev/null; then + _diy_xdg_runtime_login() { + export XDG_RUNTIME_DIR="$XDG_CACHE_HOME/xdg-runtime-dir/$HOSTNAME" + if ! [ /dev/fd/7 -ef "$XDG_CACHE_HOME/xdg-runtime-dir/.lock" ]; then + exec 7>"$XDG_CACHE_HOME/xdg-runtime-dir/.lock" + if flock -xn 7; then + if [ ! -d "$XDG_RUNTIME_DIR" ]; then + local tmp="$(mktemp -d --tmpdir -- "${USER}@${HOSTNAME}-runtime.XXXXXXXXXX")" + mkdir -p -- "$XDG_CACHE_HOME/xdg-runtime-dir" + ln -sfT -- "$tmp" "$XDG_RUNTIME_DIR" + fi + # Unfortunately this doesn't survive across exec(1). + trap _diy_xdg_runtime_logout EXIT + flock -sn 7 + fi + fi + } + _diy_xdg_runtime_logout() { + exec 7>&- + exec 7>"$XDG_CACHE_HOME/xdg-runtime-dir/.lock" + if flock -xn 7; then + rm -rf -- "$(readlink "$XDG_RUNTIME_DIR")" + fi + } + _diy_xdg_runtime_login +fi diff --git a/.config/login.d/03_tmpdir.sh b/.config/login.d/03_tmpdir.sh new file mode 100644 index 0000000..62413a7 --- /dev/null +++ b/.config/login.d/03_tmpdir.sh @@ -0,0 +1,5 @@ +#!/hint/sh +if [ -n "$XDG_RUNTIME_DIR" ]; then + mkdir -p -- "$XDG_RUNTIME_DIR/tmpdir" + export TMPDIR="$XDG_RUNTIME_DIR/tmpdir" +fi diff --git a/.config/login.d/10_gpg.sh b/.config/login.d/10_gpg.sh index cf3c88c..c1c5f82 100644 --- a/.config/login.d/10_gpg.sh +++ b/.config/login.d/10_gpg.sh @@ -1,3 +1,4 @@ +#!/hint/sh if [[ -z $GPGKEY ]] && [[ -f "${HOME}/.gnupg/gpg.conf" ]]; then export GPGKEY=`sed -nr 's/^\s*default-key\s+//p' "${GNUPG_HOME:-${HOME}/.gnupg}/gpg.conf"` fi diff --git a/.config/login.d/10_java.sh b/.config/login.d/10_java.sh index 3c49368..94452a9 100644 --- a/.config/login.d/10_java.sh +++ b/.config/login.d/10_java.sh @@ -1,3 +1,4 @@ +#!/hint/sh _JAVA_OPTIONS='' _JAVA_OPTIONS+=' -Dawt.useSystemAAFontSettings=on' _JAVA_OPTIONS+=' -Dswing.aatext=true' diff --git a/.config/login.d/10_less.sh b/.config/login.d/10_less.sh index c5934d6..314a8b9 100644 --- a/.config/login.d/10_less.sh +++ b/.config/login.d/10_less.sh @@ -1,2 +1,3 @@ +#!/hint/sh export LESSHISTFILE="$XDG_CACHE_HOME/less/histfile" mkdir -p -- "${LESSHISTFILE%/*}" diff --git a/.config/login.d/10_makeflags.sh b/.config/login.d/10_makeflags.sh new file mode 100644 index 0000000..671c6d3 --- /dev/null +++ b/.config/login.d/10_makeflags.sh @@ -0,0 +1,2 @@ +#!/hint/sh +export MAKEFLAGS="-j$(nproc)" diff --git a/.config/login.d/10_selected-editor.sh b/.config/login.d/10_selected-editor.sh index c1c18fb..1a33e76 100644 --- a/.config/login.d/10_selected-editor.sh +++ b/.config/login.d/10_selected-editor.sh @@ -1,8 +1,9 @@ +#!/hint/sh # PAM seems to be setting EDITOR... -if [[ $EDITOR = /usr/bin/vi ]]; then +if [ "$EDITOR" = /usr/bin/vi ]; then unset EDITOR fi -if [[ -f "$HOME/.selected_editor" ]]; then +if [ -f "$HOME/.selected_editor" ]; then . "$HOME/.selected_editor" export SELECTED_EDITOR export ALTERNATE_EDITOR diff --git a/.config/login.d/10_spell-check.sh b/.config/login.d/10_spell-check.sh index 9a24b7e..3f67b8f 100644 --- a/.config/login.d/10_spell-check.sh +++ b/.config/login.d/10_spell-check.sh @@ -1,3 +1,4 @@ -if [[ -z "$DICTIONARY" ]] && [[ -n "$LANG" ]]; then +#!/hint/sh +if [ -z "$DICTIONARY" ] && [ -n "$LANG" ]; then export DICTIONARY="${LANG%%.*}" fi diff --git a/.config/login.d/10_xauthority.sh b/.config/login.d/10_xauthority.sh index a27202c..787b6ed 100644 --- a/.config/login.d/10_xauthority.sh +++ b/.config/login.d/10_xauthority.sh @@ -1,4 +1,5 @@ +#!/hint/sh # This was needed once with SSH and Fedora boxes. -if [[ -z $XAUTHORITY ]]; then +if [ -z $XAUTHORITY ]; then export XAUTHORITY="$HOME/.Xauthority" fi |