]>
Commit | Line | Data |
---|---|---|
1 | # NOTE: for the cleanups below, even if our shell is not the one that spawned | |
2 | # the directory, SHLVL == 1 means that it should be safe to clean it up. | |
3 | # since .zlogout isn't guaranteed to have been run in the same shell as | |
4 | # our .zprofile was (since we source it in .zshenv) it has to be done | |
5 | # like this. | |
6 | ||
7 | ### gpg forward cleanup | |
8 | if [[ $SHLVL == 1 && $GNUPGHOME =~ '/.ssh_forward/\d+/*$' ]] { | |
9 | x=$GNUPGHOME | |
10 | # reset GNUPGHOME | |
11 | [[ -o GLOB_ASSIGN ]]; y=$? | |
12 | setopt GLOB_ASSIGN | |
13 | GNUPGHOME=$GNUPGHOME/../..(:a) | |
14 | [[ $y != 0 ]] && unsetopt GLOB_ASSIGN | |
15 | # clean dir if it exists | |
16 | if [[ -d $x ]] { | |
17 | find $x -mindepth 1 -maxdepth 1 | while read -r y; do | |
18 | unlink $y | |
19 | done | |
20 | rmdir -p $x 2>/dev/null | |
21 | } | |
22 | # clean up any remaining sockets from gpg forwarding | |
23 | rm -f $_GNUPG_SOCK_DEST_BASE*(N=) | |
24 | } | |
25 | ||
26 | ### remove tmp runtime if our shell spawned it | |
27 | if [[ $SHLVL == 1 && $TMPDIR =~ '/.session.\d+/*$' ]] { | |
28 | rm -rf $TMPDIR 2>/dev/null | |
29 | } | |
30 | ||
31 | if [[ -o interactive ]] { | |
32 | echo logout | |
33 | clear | |
34 | } | |
35 | ||
36 | ### load site-specific | |
37 | if [[ -f ~/.zlogout.local ]] { source ~/.zlogout.local } | |
38 | ||
39 | # vim: et sts=4 sw=4 ts=8 tw=79 |