-
Notifications
You must be signed in to change notification settings - Fork 1
Expand file tree
/
Copy path.sshrc
More file actions
executable file
·27 lines (26 loc) · 1.04 KB
/
.sshrc
File metadata and controls
executable file
·27 lines (26 loc) · 1.04 KB
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
controller_user="$(echo "$SSHHOME" | cut -d '.' -f 2)"
new_home="$HOME/$controller_user"
if [ -e "$new_home" ]; then
echo "Setting $new_home as new \$HOME to enable ypid/dotfiles." 1>&2
export HOME="$new_home"
cd
else
# Assume non-root account is my personalized account.
if [[ "$USER" != 'root' ]]; then
# Unintended side-effect. `.bashrc` is sourced first and than execs tmux before `.sshrc` is sourced.
# `~/.bashrc` is not used for now.
ln -sf "$SSHHOME/.sshrc.d/.bashrc" ~/.bashrc-
ln -sf "$SSHHOME/.sshrc.d/.tmux.conf" ~/.tmux.conf
mkdir -p ~/.local/share ~/.config/htop
ln -sf "$SSHHOME/.sshrc.d/.local/share/tmux" ~/.local/share/tmux
ln -sf "$SSHHOME/.sshrc.d/.config/htop/htoprc" ~/.config/htop/htoprc
fi
export VIMINIT="let \$MYVIMRC='$SSHHOME/.sshrc.d/.vimrc.min' | source \$MYVIMRC"
export ZDOTDIR="$SSHHOME/.sshrc.d"
export XDG_CONFIG_HOME="$SSHHOME/.config"
fi
if command -v zsh >/dev/null 2>&1; then
exec zsh
else
exec bash --rcfile ~/.bashrc-
fi