12345678910111213141516171819202122232425262728 |
- #############################################################################
- #
- # SSH Login Hooks
- #
- #############################################################################
- function _setup_ssh_hook_env () {
- # Run to set the SESSION_TYPE
- if [ -n "$SSH_CLIENT" ] || [ -n "$SSH_TTY" ]; then
- SESSION_TYPE=remote/ssh # Add more tests
- else
- case $(ps -o comm= -p $PPID) in sshd|*/sshd)
- SESSION_TYPE=remote/ssh;;
- esac
- fi
- }
- _setup_ssh_hook_env;
- if file_exists ~/.ssh_hooks; then
- source ~/.ssh_hooks
- fi
- if is_function ssh_login_hook; then
- if [ $SESSION_TYPE = 'remote/ssh' ]; then
- ssh_login_hook
- fi
- fi
|