]>
Commit | Line | Data |
---|---|---|
d569f3f7 | 1 | ### exports |
2 | ## reset PATH to prevent /etc/zprofile from changing it | |
3 | # some distros put non-interactive PATH in env and interactive PATH in profile; | |
4 | # we want to make sure to always use ours regardless | |
5 | if [[ -v _sev_backup_path ]] { | |
6 | path=("${_backup_path[@]}" "${path[@]}") | |
7 | export PATH | |
8 | unset _sev_backup_path | |
9 | } | |
10 | ## common | |
8eb81f95 | 11 | export EDITOR=vim |
12 | export PAGER=less | |
d569f3f7 | 13 | ## grep |
14 | # XXX: deprecated in GNU | |
15 | export GREP_OPTIONS=--color=auto | |
8eb81f95 | 16 | ## histfile |
17 | export HISTFILE=~/.histfile | |
18 | export HISTSIZE=1000 | |
19 | export SAVEHIST=1000 | |
8eb81f95 | 20 | ## python |
21 | export PYTHONSTARTUP=~/.pythonrc | |
22 | ## perl | |
d569f3f7 | 23 | [[ -v commands[perl] ]] && eval $(perl -I $XDG_DATA_HOME/perl5/lib/perl5 -Mlocal::lib=$XDG_DATA_HOME/perl5 2>/dev/null) |
24 | ||
25 | ### ssh agents | |
26 | # NOTE: preferred order of agents to check: okcagent, gnupg, openssh | |
27 | # first block takes care of okcagent and openssh, second handles gnupg | |
28 | if [[ ! -v SSH_AUTH_SOCK && ( -v commands[okc-ssh-agent] || | |
29 | ( -v commands[ssh-agent] && ! -v commands[gpg] ) ) ]] { | |
30 | okc=${commands[okc-ssh-agent]:+okc-} | |
31 | agentfile=~/tmp/${okc}ssh-agent-exports | |
32 | typeset sock= | |
33 | typeset -i pid= | |
34 | if [[ -f "$agentfile" ]] { | |
35 | IFS=$'\0' read -r sock pid <"$agentfile" | |
36 | } | |
43016843 | 37 | if [[ -S "$sock" && $pid > 0 ]] && kill -0 $pid; then |
38 | echo "Reusing agent pid $pid" | |
d569f3f7 | 39 | export SSH_AUTH_SOCK="$sock" |
40 | export SSH_AGENT_PID=$pid | |
41 | else | |
42 | # TODO: ensure ssh-agent path looks legit | |
43 | # to avoid unsafe eval? | |
44 | eval `${okc}ssh-agent` | |
45 | echo -n "$SSH_AUTH_SOCK"$'\0'$SSH_AGENT_PID >!$agentfile | |
46 | fi | |
47 | unset okc agentfile sock pid | |
48 | } elif [[ -v commands[gpg] && ! -S $_GNUPG_SOCK_DEST && \ | |
49 | ( ! -v SSH_AUTH_SOCK || -v DISPLAY ) ]] { | |
50 | export GPG_TTY=$(tty) | |
51 | export PINENTRY_USER_DATA=USE_TTY=$((!${+DISPLAY})) | |
43016843 | 52 | gpg-connect-agent UPDATESTARTUPTTY /bye >/dev/null 2>&1 |
53 | gpg-connect-agent /subst /serverpid \ | |
54 | '/echo GPG agent pid ${get serverpid}' /bye | |
d569f3f7 | 55 | [[ ! -v SSH_AUTH_SOCK ]] && \ |
8eb81f95 | 56 | export SSH_AUTH_SOCK=$(gpgconf --list-dirs agent-ssh-socket) |
d569f3f7 | 57 | } |
58 | ||
59 | ### gpg socket | |
60 | if [[ -v _GNUPG_SOCK_SRC && -v _GNUPG_SOCK_DEST && -S $_GNUPG_SOCK_DEST ]] { | |
61 | unlink $_GNUPG_SOCK_SRC >/dev/null 2>&1 | |
62 | mv $_GNUPG_SOCK_DEST $_GNUPG_SOCK_SRC >/dev/null | |
63 | } | |
64 | ||
8eb81f95 | 65 | ### load site-specific |
66 | if [[ -f ~/.zprofile.local ]] { source ~/.zprofile.local } | |
67 | ||
68 | # vim: set et sts=4 sw=4 ts=8 tw=79 : |