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