From 8b283d6f76ffd82770e65026cad21adc11b98e42 Mon Sep 17 00:00:00 2001 From: Luke Shumaker Date: Mon, 13 Apr 2015 14:31:41 -0400 Subject: X11: Arch's default xserverrc no longer looks at XDG_VTNR --- .config/X11/serverrc | 7 ++++++- 1 file changed, 6 insertions(+), 1 deletion(-) mode change 120000 => 100644 .config/X11/serverrc diff --git a/.config/X11/serverrc b/.config/X11/serverrc deleted file mode 120000 index ce14133..0000000 --- a/.config/X11/serverrc +++ /dev/null @@ -1 +0,0 @@ -/etc/X11/xinit/xserverrc \ No newline at end of file diff --git a/.config/X11/serverrc b/.config/X11/serverrc new file mode 100644 index 0000000..6b57eeb --- /dev/null +++ b/.config/X11/serverrc @@ -0,0 +1,6 @@ +#!/bin/sh +if [ -z "$XDG_VTNR" ]; then + exec /usr/bin/X -nolisten tcp "$@" +else + exec /usr/bin/X -nolisten tcp "$@" vt$XDG_VTNR +fi -- cgit v1.2.3 From c0a9c2902e60cc980343a65f5519e7c9e2dcd081 Mon Sep 17 00:00:00 2001 From: Luke Shumaker Date: Mon, 13 Apr 2015 14:32:52 -0400 Subject: xdg.sh: include XDG_VTNR --- .config/login.d/01_xdg.sh | 4 ++++ 1 file changed, 4 insertions(+) diff --git a/.config/login.d/01_xdg.sh b/.config/login.d/01_xdg.sh index 4464764..c9f789c 100644 --- a/.config/login.d/01_xdg.sh +++ b/.config/login.d/01_xdg.sh @@ -9,6 +9,10 @@ [ -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 -- cgit v1.2.3 From 969410c5af909199724973b8851fcb6bf19eaba2 Mon Sep 17 00:00:00 2001 From: Luke Shumaker Date: Mon, 13 Apr 2015 14:34:02 -0400 Subject: clean up XDG_RUNTIME_DIR handling --- .config/X11/clientrc | 1 + .config/login.d/01_xdg.sh | 27 -------------------------- .config/login.d/02_tmpdir.sh | 2 -- .config/login.d/02_xdg_runtime_dir.sh | 28 +++++++++++++++++++++++++++ .config/login.d/03_tmpdir.sh | 4 ++++ .config/login.d/90_dot-runtime.sh | 4 ---- .config/login.d/90_symlink_xdg_runtime_dir.sh | 4 ++++ .config/ssh/config | 2 +- 8 files changed, 38 insertions(+), 34 deletions(-) delete mode 100644 .config/login.d/02_tmpdir.sh create mode 100644 .config/login.d/02_xdg_runtime_dir.sh create mode 100644 .config/login.d/03_tmpdir.sh delete mode 100644 .config/login.d/90_dot-runtime.sh create mode 100644 .config/login.d/90_symlink_xdg_runtime_dir.sh diff --git a/.config/X11/clientrc b/.config/X11/clientrc index 4773ea4..2c965da 100755 --- a/.config/X11/clientrc +++ b/.config/X11/clientrc @@ -17,6 +17,7 @@ if [ -f "$usermodmap" ]; then xmodmap "$usermodmap" fi +[ -n "$XDG_RUNTIME_DIR" ] || exit 1 trap "rm -f $(printf '%q' "${XDG_RUNTIME_DIR}/x11-wm@${DISPLAY}")" EXIT mkfifo "${XDG_RUNTIME_DIR}/x11-wm@${DISPLAY}" diff --git a/.config/login.d/01_xdg.sh b/.config/login.d/01_xdg.sh index c9f789c..22bbc01 100644 --- a/.config/login.d/01_xdg.sh +++ b/.config/login.d/01_xdg.sh @@ -18,30 +18,3 @@ 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..6d93359 --- /dev/null +++ b/.config/login.d/02_xdg_runtime_dir.sh @@ -0,0 +1,28 @@ +# This should be readable by /bin/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" + # 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/03_tmpdir.sh b/.config/login.d/03_tmpdir.sh new file mode 100644 index 0000000..b94ef1a --- /dev/null +++ b/.config/login.d/03_tmpdir.sh @@ -0,0 +1,4 @@ +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/90_dot-runtime.sh b/.config/login.d/90_dot-runtime.sh deleted file mode 100644 index 87d30ec..0000000 --- a/.config/login.d/90_dot-runtime.sh +++ /dev/null @@ -1,4 +0,0 @@ -# This is really only needed for ssh ControlPath; as I don't have a -# way to communicate XD -mkdir -p -- ~/.runtime -ln -sfT -- "$XDG_RUNTIME_DIR" ~/.runtime/"$HOSTNAME" diff --git a/.config/login.d/90_symlink_xdg_runtime_dir.sh b/.config/login.d/90_symlink_xdg_runtime_dir.sh new file mode 100644 index 0000000..b89f7b1 --- /dev/null +++ b/.config/login.d/90_symlink_xdg_runtime_dir.sh @@ -0,0 +1,4 @@ +# This is really only needed for ssh ControlPath; as I don't have a +# way to communicate XDG_RUNTIME_DIR +mkdir -p -- "$XDG_CACHE_HOME/xdg-runtime-dir" +ln -sfT -- "$XDG_RUNTIME_DIR" "$XDG_CACHE_HOME/xdg-runtime-dir/$HOSTNAME" diff --git a/.config/ssh/config b/.config/ssh/config index cc796ed..5ea36ba 100644 --- a/.config/ssh/config +++ b/.config/ssh/config @@ -1,7 +1,7 @@ Host * Protocol 2 ControlMaster auto - ControlPath ~/.runtime/%l/ssh-%r@%h:%p + ControlPath ~/.cache/xdg-runtime-dir/%l/ssh-%r@%h:%p Compression yes # Purdue ################################################### -- cgit v1.2.3 From 35e5363eec303944b902b9f1603e38392ca4558b Mon Sep 17 00:00:00 2001 From: Luke Shumaker Date: Mon, 13 Apr 2015 14:34:24 -0400 Subject: fix up Purdue hosts in ssh/config --- .config/ssh/config | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-) diff --git a/.config/ssh/config b/.config/ssh/config index 5ea36ba..84df253 100644 --- a/.config/ssh/config +++ b/.config/ssh/config @@ -6,8 +6,9 @@ Host * # Purdue ################################################### -Host data lore borg* xinu* sac* sslab* +Host data lore borg?? xinu?? sac?? sslab?? HostName %h.cs.purdue.edu + User shumakl Host *.cs.purdue.edu User shumakl -- cgit v1.2.3 From 479e2d7bcdc352626a7c4f0289d8f0c75360a978 Mon Sep 17 00:00:00 2001 From: Luke Shumaker Date: Mon, 13 Apr 2015 15:09:22 -0400 Subject: Makefile: don't error if there are no Maildir folders --- .config/Makefile | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/.config/Makefile b/.config/Makefile index 909486d..c4cd5d0 100644 --- a/.config/Makefile +++ b/.config/Makefile @@ -15,7 +15,7 @@ clean: rm -f $(targets) ${HOME}/.folders: ${HOME}/Maildir $(MAKEFILE_LIST) - find $< -mindepth 2 -maxdepth 2 \( -type f -name "maildirfolder" -o -type d -name new -o -type d -name tmp -o -type d -name cur \) -printf '%P\0' | xargs -0 dirname -z -- | sort -zu | xargs -0 printf -- '.%s\n' >'$@' + find $< -mindepth 2 -maxdepth 2 \( -type f -name "maildirfolder" -o -type d -name new -o -type d -name tmp -o -type d -name cur \) -printf '%P\0' | xargs -r0 dirname -z -- | sort -zu | xargs -0 printf -- '.%s\n' >'$@' ${GIT_DIR}/info/exclude: ${HOME}/.git.info.exclude.in $(shell echo .??*/) ( cat $<; find $^ -type f -name 'CACHEDIR.TAG' -printf '%h\n'|sed 's@^\./@/@' ) > $@ -- cgit v1.2.3 From 9f5efa128ef0c1177856682659969e2bc8accfd2 Mon Sep 17 00:00:00 2001 From: Luke Shumaker Date: Mon, 13 Apr 2015 15:09:56 -0400 Subject: Makefile: Don't require to be run from a login shell --- .config/Makefile | 7 ++++++- .config/cron/make-config | 2 +- 2 files changed, 7 insertions(+), 2 deletions(-) diff --git a/.config/Makefile b/.config/Makefile index c4cd5d0..c530806 100644 --- a/.config/Makefile +++ b/.config/Makefile @@ -1,5 +1,9 @@ #!/usr/bin/make -f - +ifeq ($(XDG_CACHE_HOME),) +default: all; @: +%: + . ~/.profile && $(MAKE) '$@' +else SHELL = /bin/bash GIT_DIR = ${HOME}/.git @@ -39,3 +43,4 @@ ${HOME}/Maildir/%: | ${HOME}/Maildir .PHONY: FORCE PHONY FORCE: ; PHONY: ; +endif diff --git a/.config/cron/make-config b/.config/cron/make-config index d079c92..6a7e9d6 100644 --- a/.config/cron/make-config +++ b/.config/cron/make-config @@ -1,2 +1,2 @@ #m h dom mon dow command -*/5 * * * * cronic bash -l -c 'make -C "$XDG_CONFIG_HOME"' +*/5 * * * * cronic make -C ~/.config -- cgit v1.2.3 From 3295c5fd9b09fe0af48e11222c41d69f5bae5dbe Mon Sep 17 00:00:00 2001 From: Luke Shumaker Date: Mon, 13 Apr 2015 15:10:22 -0400 Subject: login.sh: Do a better job of handling if variables aren't set --- .config/login.d/90_symlink_xdg_runtime_dir.sh | 6 ++++-- .config/login.sh | 4 ++++ 2 files changed, 8 insertions(+), 2 deletions(-) diff --git a/.config/login.d/90_symlink_xdg_runtime_dir.sh b/.config/login.d/90_symlink_xdg_runtime_dir.sh index b89f7b1..bc6109d 100644 --- a/.config/login.d/90_symlink_xdg_runtime_dir.sh +++ b/.config/login.d/90_symlink_xdg_runtime_dir.sh @@ -1,4 +1,6 @@ # This is really only needed for ssh ControlPath; as I don't have a # way to communicate XDG_RUNTIME_DIR -mkdir -p -- "$XDG_CACHE_HOME/xdg-runtime-dir" -ln -sfT -- "$XDG_RUNTIME_DIR" "$XDG_CACHE_HOME/xdg-runtime-dir/$HOSTNAME" +if [ -n "$XDG_RUNTIME_DIR" ]; then + mkdir -p -- "$XDG_CACHE_HOME/xdg-runtime-dir" + ln -sfT -- "$XDG_RUNTIME_DIR" "$XDG_CACHE_HOME/xdg-runtime-dir/$HOSTNAME" +fi diff --git a/.config/login.sh b/.config/login.sh index b2cc80a..538920a 100644 --- a/.config/login.sh +++ b/.config/login.sh @@ -11,6 +11,10 @@ # the default umask is set in /etc/profile; for setting the umask # for ssh logins, install and configure the libpam-umask package. +if [ -z "$HOME" ]; then + eval 'HOME=~' + export HOME +fi for file in "${XDG_CONFIG_HOME:-$HOME/.config}/login.d/"*.sh; do . "$file" done -- cgit v1.2.3 From 39c0d7a5c7538350e96fc135147f56cdb7d45093 Mon Sep 17 00:00:00 2001 From: Luke Shumaker Date: Mon, 13 Apr 2015 15:59:10 -0400 Subject: There's a really silly restriction for the path length of domain sockets. --- .config/ssh/config | 2 +- .config/symlinks | 1 + 2 files changed, 2 insertions(+), 1 deletion(-) diff --git a/.config/ssh/config b/.config/ssh/config index 84df253..8649e61 100644 --- a/.config/ssh/config +++ b/.config/ssh/config @@ -1,7 +1,7 @@ Host * Protocol 2 ControlMaster auto - ControlPath ~/.cache/xdg-runtime-dir/%l/ssh-%r@%h:%p + ControlPath ~/.runtime/%l/ssh-%r@%h:%p Compression yes # Purdue ################################################### diff --git a/.config/symlinks b/.config/symlinks index 37a7267..af0f1af 100644 --- a/.config/symlinks +++ b/.config/symlinks @@ -32,6 +32,7 @@ # Directories .cache/maildirproc/ .maildirproc +.cache/xdg-runtime-dir/ .runtime .config/arduino/ .arduino .config/bazaar/ .bazaar -- cgit v1.2.3