macos vm with tmux env
This commit is contained in:
parent
74ecfddf65
commit
128d2ba79b
@ -14,7 +14,7 @@
|
||||
# --no-tmux -> skips attaching to tmux session
|
||||
|
||||
# TMP: Tmux will be disabled (switch to 0 to enable it again)
|
||||
skip_tmux=1
|
||||
skip_tmux=0
|
||||
|
||||
# Check for --no-tmux flag
|
||||
if [[ "$1" == "--no-tmux" ]]; then
|
||||
@ -34,20 +34,20 @@ if [[ "$full" == *@* ]]; then
|
||||
host="${full#*@}"
|
||||
fi
|
||||
|
||||
# Map host patterns to SSH target and tmux session
|
||||
# Map host patterns to SSH target and machine type
|
||||
case "$host" in
|
||||
*-orb)
|
||||
ssh_host="${host%-orb}@orb"
|
||||
tmux_session="$host"
|
||||
TARGET_MACHINE="orb"
|
||||
;;
|
||||
*-utm)
|
||||
ssh_host="${host%-utm}.utm.local"
|
||||
tmux_session="$host"
|
||||
TARGET_MACHINE="utm"
|
||||
ssh_identity="$HOME/.ssh/id_ed25519_internal"
|
||||
;;
|
||||
*-workstation)
|
||||
ssh_host="${host%-workstation}.workstation.lan"
|
||||
tmux_session="$host"
|
||||
TARGET_MACHINE="workstation"
|
||||
ssh_identity="$HOME/.ssh/id_ed25519_internal"
|
||||
;;
|
||||
*)
|
||||
@ -56,6 +56,9 @@ case "$host" in
|
||||
;;
|
||||
esac
|
||||
|
||||
# Always use "default" tmux session
|
||||
tmux_session="default"
|
||||
|
||||
# Build SSH command safely using an array
|
||||
ssh_cmd=(ssh -tt)
|
||||
|
||||
@ -67,13 +70,12 @@ ssh_cmd+=("$user@$ssh_host")
|
||||
|
||||
# Add tmux session unless skipped
|
||||
if [[ $skip_tmux -eq 0 ]]; then
|
||||
ssh_cmd+=("tmux" "new" "-A" "-s" "$tmux_session")
|
||||
ssh_cmd+=("tmux" "new-session" "-As" "$tmux_session" "-e" "TARGET_MACHINE=$TARGET_MACHINE")
|
||||
else
|
||||
# Pass through any extra args user supplied
|
||||
ssh_cmd+=("$@")
|
||||
fi
|
||||
|
||||
# Replace current shell with SSH command
|
||||
# echo "Executing: ${ssh_cmd[*]}" >&2
|
||||
exec "${ssh_cmd[@]}"
|
||||
|
||||
|
||||
@ -43,3 +43,7 @@ alias grs='git reset'
|
||||
alias grv='git remote -v'
|
||||
alias tree='tree -I node_modules'
|
||||
|
||||
# -----------------------------
|
||||
# Other
|
||||
# -----------------------------
|
||||
alias k='kubectl'
|
||||
|
||||
Loading…
Reference in New Issue
Block a user