Split up env.d and profile.d into topical files (*/env and */profile)
This commit is contained in:
parent
3583fd75fd
commit
62ba9c76c7
13
env
13
env
|
@ -7,12 +7,6 @@ case "$-" in
|
|||
(*) return;;
|
||||
esac
|
||||
|
||||
export VISUAL=$(
|
||||
for e in nano mcedit vi vim ed; do
|
||||
hash "$e" >/dev/null 2>&1 && echo "$e" && break
|
||||
done
|
||||
)
|
||||
|
||||
# short prompt with basename of PWD
|
||||
unset PS1
|
||||
if test "$(id -u)" -eq 0; then
|
||||
|
@ -56,7 +50,8 @@ else
|
|||
fi
|
||||
|
||||
# load drop-ins
|
||||
for f in "$ENV".d/*; do
|
||||
[ -e "$f" ] && . "$f"
|
||||
for f in "$XDG_CONFIG_HOME"/*/env; do
|
||||
c=${f%/*}
|
||||
command -v "${c##*/}" >/dev/null 2>&1 && . "$f"
|
||||
done
|
||||
unset f
|
||||
unset c f
|
||||
|
|
25
env.d/quirks
25
env.d/quirks
|
@ -1,25 +0,0 @@
|
|||
# color support if available
|
||||
case "$(ls --help 2>&1)" in
|
||||
(*--color*) alias ls='ls --color=auto';;
|
||||
esac
|
||||
case "$(grep --help 2>&1)" in
|
||||
(*--color*) alias grep='grep --color=auto';;
|
||||
esac
|
||||
|
||||
# feh stores 's' captures in $PWD per default, which i dont like
|
||||
alias feh='feh --output-dir "$HOME"'
|
||||
|
||||
# disable .lesshst file
|
||||
alias less='LESSHISTFILE=- less'
|
||||
|
||||
# bend over tmux so the symlink in $HOME is not required anymore
|
||||
alias tmux='tmux -f "${XDG_CONFIG_HOME:-$HOME/.config}/tmux/tmux.conf"'
|
||||
|
||||
# FreeBSD Almquist shell does not do parameter expansion in PS1
|
||||
# https://bugs.freebsd.org/bugzilla/show_bug.cgi?id=46441
|
||||
case "$0:$(uname -s)" in
|
||||
(sh:FreeBSD|-sh:FreeBSD) PS1='\W\$ '
|
||||
esac
|
||||
|
||||
# Tell sway to use i3 config
|
||||
alias sway='sway -c $XDG_CONFIG_HOME/i3/config'
|
|
@ -1,10 +0,0 @@
|
|||
case "$(uname -s)" in
|
||||
(Linux)
|
||||
kver=$(uname -r)
|
||||
kmods="/lib/modules/$kver"
|
||||
# in containers, dir '/' wont have inode 2
|
||||
if test x$(stat -c %i /) = x2 && ! test -d "$kmods"; then
|
||||
printf "Kernel %s running, but %s does not exist\n" "$kver" "$kmods"
|
||||
fi
|
||||
;;
|
||||
esac
|
|
@ -1,9 +0,0 @@
|
|||
#!/bin/sh
|
||||
now="$(date +%s)"
|
||||
for cert in ~/.ssh/*-cert.pub; do
|
||||
[ -e "$cert" ] || continue
|
||||
strdate=$(ssh-keygen -L -f $cert|awk '/Valid/ {sub(/T/," ",$5);print($5)}')
|
||||
awk -v c=${cert##*/} -v n=$now -v e=$(date -d "$strdate" "+%s") \
|
||||
'BEGIN {d=(e-n) / (60*60*24); if (d<30) {printf("%s expires in %d days\n",c,d)}}'
|
||||
done
|
||||
unset now cert strdate
|
|
@ -0,0 +1,2 @@
|
|||
# feh stores 's' captures in $PWD per default, which i dont like
|
||||
alias feh='feh --output-dir "$HOME"'
|
9
install
9
install
|
@ -1,3 +1,8 @@
|
|||
#!/bin/sh
|
||||
cfg="$(dirname "$PWD/${0#./}")"
|
||||
ln -sfn "${cfg#$HOME/}"/profile "${HOME}"/.profile
|
||||
XDG_CONFIG_HOME="$(dirname "$PWD/${0#./}")"
|
||||
ln -sfn "${XDG_CONFIG_HOME#$HOME/}"/profile "${HOME}"/.profile
|
||||
|
||||
for f in "$XDG_CONFIG_HOME"/*/install; do
|
||||
c=${f%/*}
|
||||
command -v "${c##*/}" >/dev/null 2>&1 && . "$f"
|
||||
done
|
||||
|
|
|
@ -0,0 +1 @@
|
|||
export VISUAL=nano
|
7
profile
7
profile
|
@ -64,7 +64,8 @@ case "$-" in
|
|||
esac
|
||||
|
||||
# load drop-ins
|
||||
for f in "$XDG_CONFIG_HOME"/profile.d/*; do
|
||||
[ -e "$f" ] && . "$f"
|
||||
for f in "$XDG_CONFIG_HOME"/*/profile; do
|
||||
c=${f%/*}
|
||||
command -v "${c##*/}" >/dev/null 2>&1 && . "$f"
|
||||
done
|
||||
unset f
|
||||
unset c f
|
||||
|
|
|
@ -0,0 +1,13 @@
|
|||
# color support if available
|
||||
case "$(ls --help 2>&1)" in
|
||||
(*--color*) alias ls='ls --color=auto';;
|
||||
esac
|
||||
case "$(grep --help 2>&1)" in
|
||||
(*--color*) alias grep='grep --color=auto';;
|
||||
esac
|
||||
|
||||
# FreeBSD Almquist shell does not do parameter expansion in PS1
|
||||
# https://bugs.freebsd.org/bugzilla/show_bug.cgi?id=46441
|
||||
case "$0:$(uname -s)" in
|
||||
(sh:FreeBSD|-sh:FreeBSD) PS1='\W\$ '
|
||||
esac
|
|
@ -18,3 +18,12 @@ if grep -qr 'PRIVATE KEY' ~/.ssh 2>/dev/null; then
|
|||
esac
|
||||
unset SSH_AGENT_PID
|
||||
fi
|
||||
|
||||
now="$(date +%s)"
|
||||
for cert in ~/.ssh/*-cert.pub; do
|
||||
[ -e "$cert" ] || continue
|
||||
strdate=$(ssh-keygen -L -f $cert|awk '/Valid/ {sub(/T/," ",$5);print($5)}')
|
||||
awk -v c=${cert##*/} -v n=$now -v e=$(date -d "$strdate" "+%s") \
|
||||
'BEGIN {d=(e-n) / (60*60*24); if (d<30) {printf("%s expires in %d days\n",c,d)}}'
|
||||
done
|
||||
unset now cert strdate
|
|
@ -0,0 +1,2 @@
|
|||
# Tell sway to use i3 config
|
||||
alias sway='sway -c $XDG_CONFIG_HOME/i3/config'
|
|
@ -0,0 +1,7 @@
|
|||
# 3.1 introduced ~/.config/tmux/tmux.conf and in 3.2 XDG_CONFIG_HOME/tmux/tmux.conf was added
|
||||
# before that, ~/.tmux.conf is the default
|
||||
case "$(tmux -V)" in
|
||||
('tmux 2.*'|'tmux 3.0*')
|
||||
ln -sfn "${XDG_CONFIG_HOME#$HOME/}"/tmux/tmux.conf "${HOME}"/.tmux.conf
|
||||
;;
|
||||
esac
|
Loading…
Reference in New Issue