diff options
-rw-r--r-- | .config/Makefile | 9 | ||||
-rwxr-xr-x | .config/X11/clientrc | 1 | ||||
-rw-r--r--[l---------] | .config/X11/serverrc | 7 | ||||
-rw-r--r-- | .config/cron/make-config | 2 | ||||
-rw-r--r-- | .config/login.d/01_xdg.sh | 31 | ||||
-rw-r--r-- | .config/login.d/02_tmpdir.sh | 2 | ||||
-rw-r--r-- | .config/login.d/02_xdg_runtime_dir.sh | 28 | ||||
-rw-r--r-- | .config/login.d/03_tmpdir.sh | 4 | ||||
-rw-r--r-- | .config/login.d/90_dot-runtime.sh | 4 | ||||
-rw-r--r-- | .config/login.d/90_symlink_xdg_runtime_dir.sh | 6 | ||||
-rw-r--r-- | .config/login.sh | 4 | ||||
-rw-r--r-- | .config/ssh/config | 3 | ||||
-rw-r--r-- | .config/symlinks | 2 |
13 files changed, 65 insertions, 38 deletions
diff --git a/.config/Makefile b/.config/Makefile index 18672b0..94d0cca 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 @@ -15,7 +19,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' | grep -vP '^\.FOLDERS.Ham.20(?!15)' > '$@' + 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' | grep -vP '^\.FOLDERS.Ham.20(?!15)' > '$@' ${GIT_DIR}/info/exclude: ${HOME}/.git.info.exclude.in $(shell echo .??*/) ( cat $<; find $^ -type f -name 'CACHEDIR.TAG' -printf '%h\n'|sed 's@^\./@/@' ) > $@ @@ -39,3 +43,4 @@ ${HOME}/Maildir/%: | ${HOME}/Maildir .PHONY: FORCE PHONY FORCE: ; PHONY: ; +endif 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/X11/serverrc b/.config/X11/serverrc index ce14133..6b57eeb 120000..100644 --- a/.config/X11/serverrc +++ b/.config/X11/serverrc @@ -1 +1,6 @@ -/etc/X11/xinit/xserverrc
\ No newline at end of file +#!/bin/sh +if [ -z "$XDG_VTNR" ]; then + exec /usr/bin/X -nolisten tcp "$@" +else + exec /usr/bin/X -nolisten tcp "$@" vt$XDG_VTNR +fi 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 diff --git a/.config/login.d/01_xdg.sh b/.config/login.d/01_xdg.sh index 4464764..22bbc01 100644 --- a/.config/login.d/01_xdg.sh +++ b/.config/login.d/01_xdg.sh @@ -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..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..bc6109d --- /dev/null +++ b/.config/login.d/90_symlink_xdg_runtime_dir.sh @@ -0,0 +1,6 @@ +# This is really only needed for ssh ControlPath; as I don't have a +# way to communicate XDG_RUNTIME_DIR +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 diff --git a/.config/ssh/config b/.config/ssh/config index cc796ed..8649e61 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 diff --git a/.config/symlinks b/.config/symlinks index 24bd5fe..83f6a2f 100644 --- a/.config/symlinks +++ b/.config/symlinks @@ -43,6 +43,8 @@ # .maildirproc is not used, but must exist /tmp/ .maildirproc +# There's a silly maximum length on Domain Sockets, so alias +.cache/xdg-runtime-dir/ .runtime # KDE .config/ .kde/share/apps # |