mirror of
https://github.com/acedanger/shell.git
synced 2025-12-05 21:40:12 -08:00
Merge branch 'main' of github.com:acedanger/shell
This commit is contained in:
@@ -180,8 +180,39 @@ if command -v fabric &> /dev/null; then
|
||||
}
|
||||
fi
|
||||
|
||||
if [ -z "$SSH_AUTH_SOCK" ]; then
|
||||
# Start the SSH agent if not already running
|
||||
# Add the SSH key to the agent
|
||||
eval "$(ssh-agent -s)" >/dev/null 2>&1 && ssh-add ~/.ssh/id_ed25519 >/dev/null 2>&1
|
||||
# SSH Agent Management - Start only if needed and working properly
|
||||
ssh_agent_start() {
|
||||
local ssh_agent_env="$HOME/.ssh-agent-env"
|
||||
|
||||
# Function to check if ssh-agent is running and responsive
|
||||
ssh_agent_running() {
|
||||
[ -n "$SSH_AUTH_SOCK" ] && [ -S "$SSH_AUTH_SOCK" ] && ssh-add -l >/dev/null 2>&1
|
||||
}
|
||||
|
||||
# Load existing agent environment if it exists
|
||||
if [ -f "$ssh_agent_env" ]; then
|
||||
source "$ssh_agent_env" >/dev/null 2>&1
|
||||
fi
|
||||
|
||||
# Check if agent is running and responsive
|
||||
if ! ssh_agent_running; then
|
||||
# Start new agent only if ssh key exists
|
||||
if [ -f "$HOME/.ssh/id_ed25519" ]; then
|
||||
# Clean up any stale agent environment
|
||||
[ -f "$ssh_agent_env" ] && rm -f "$ssh_agent_env"
|
||||
|
||||
# Start new agent and save environment
|
||||
ssh-agent -s > "$ssh_agent_env" 2>/dev/null
|
||||
if [ $? -eq 0 ]; then
|
||||
source "$ssh_agent_env" >/dev/null 2>&1
|
||||
# Add key to agent
|
||||
ssh-add "$HOME/.ssh/id_ed25519" >/dev/null 2>&1
|
||||
fi
|
||||
fi
|
||||
fi
|
||||
}
|
||||
|
||||
# Only run SSH agent setup if we have SSH keys
|
||||
if [ -f "$HOME/.ssh/id_ed25519" ]; then
|
||||
ssh_agent_start
|
||||
fi
|
||||
|
||||
@@ -9,17 +9,14 @@ alias findzombie="ps -A -ostat,pid,ppid | grep -e '[zZ]'"
|
||||
# 🎬 Plex Media Server Management
|
||||
alias plex="/home/acedanger/shell/plex/plex.sh"
|
||||
alias px="/home/acedanger/shell/plex/plex.sh" # Quick shortcut
|
||||
alias plex-start="/home/acedanger/shell/plex/plex.sh start" # Start Plex
|
||||
alias plex-stop="/home/acedanger/shell/plex/plex.sh stop" # Stop Plex
|
||||
alias plex-restart="/home/acedanger/shell/plex/plex.sh restart" # Restart Plex
|
||||
alias plex-status="/home/acedanger/shell/plex/plex.sh status" # Status check
|
||||
alias plex-web="xdg-open http://localhost:32400/web" # Open web UI in browser
|
||||
|
||||
# 🐳 Docker Compose Shortcuts
|
||||
alias dcdn="docker compose down"
|
||||
alias dcupd="docker compose up -d"
|
||||
alias dcpull="docker compose pull"
|
||||
|
||||
alias lzd="lazydocker"
|
||||
alias lzg="lazygit"
|
||||
|
||||
# 🔧 Backup Management
|
||||
alias backup-tui="/home/acedanger/shell/backup-tui"
|
||||
@@ -31,6 +28,6 @@ alias update="/home/acedanger/shell/update.sh"
|
||||
|
||||
# Note: The following aliases are dynamically generated by setup.sh based on available commands:
|
||||
# - cat/bat aliases (batcat vs bat)
|
||||
# - fd aliases (fdfind vs fd)
|
||||
# - fd aliases (fdfind vs fd)
|
||||
# - fzf preview aliases
|
||||
# - ls/eza aliases (eza vs traditional ls)
|
||||
|
||||
@@ -113,10 +113,16 @@ else
|
||||
|
||||
# Setup VS Code repository
|
||||
echo -e "${YELLOW}Setting up VS Code repository...${NC}"
|
||||
wget -qO- https://packages.microsoft.com/keys/microsoft.asc | gpg --dearmor > /tmp/packages.microsoft.gpg
|
||||
sudo install -D -o root -g root -m 644 /tmp/packages.microsoft.gpg /etc/apt/keyrings/packages.microsoft.gpg
|
||||
sudo sh -c 'echo "deb [arch=amd64,arm64,armhf signed-by=/etc/apt/keyrings/packages.microsoft.gpg] https://packages.microsoft.com/repos/code stable main" > /etc/apt/sources.list.d/vscode.list'
|
||||
rm /tmp/packages.microsoft.gpg
|
||||
TEMP_GPG=$(mktemp)
|
||||
if wget -qO- https://packages.microsoft.com/keys/microsoft.asc | gpg --dearmor > "$TEMP_GPG"; then
|
||||
sudo install -D -o root -g root -m 644 "$TEMP_GPG" /etc/apt/keyrings/packages.microsoft.gpg
|
||||
sudo sh -c 'echo "deb [arch=amd64,arm64,armhf signed-by=/etc/apt/keyrings/packages.microsoft.gpg] https://packages.microsoft.com/repos/code stable main" > /etc/apt/sources.list.d/vscode.list'
|
||||
rm -f "$TEMP_GPG"
|
||||
else
|
||||
echo -e "${RED}ERROR: Failed to download Microsoft GPG key${NC}"
|
||||
rm -f "$TEMP_GPG"
|
||||
exit 1
|
||||
fi
|
||||
|
||||
# Setup GitHub CLI repository
|
||||
echo -e "${YELLOW}Setting up GitHub CLI repository...${NC}"
|
||||
|
||||
Reference in New Issue
Block a user