From 42e0c63eb21c2d23fe1afd1aaa5ed7379e93d1d8 Mon Sep 17 00:00:00 2001 From: Peter Wood Date: Fri, 27 Jun 2025 07:45:44 -0400 Subject: [PATCH 1/2] feat: Update aliases for Plex management and clean up comments --- completions/env-backup-completion.bash | 0 dotfiles/my-aliases.zsh.original | 9 +++------ 2 files changed, 3 insertions(+), 6 deletions(-) mode change 100644 => 100755 completions/env-backup-completion.bash diff --git a/completions/env-backup-completion.bash b/completions/env-backup-completion.bash old mode 100644 new mode 100755 diff --git a/dotfiles/my-aliases.zsh.original b/dotfiles/my-aliases.zsh.original index fcb0e94..cbddc97 100644 --- a/dotfiles/my-aliases.zsh.original +++ b/dotfiles/my-aliases.zsh.original @@ -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) From 3e01ea6358b04c0d30dc70b060fa96f7ed331d4d Mon Sep 17 00:00:00 2001 From: Peter Wood Date: Fri, 27 Jun 2025 21:10:51 -0400 Subject: [PATCH 2/2] feat: Improve SSH agent management and enhance VS Code repository setup with error handling; fixes bug recently introduced. the error messge "mkdtemp: private socket dir: Permission denied" was being displayed when a new terminal window was opened. --- dotfiles/.zshrc | 39 +++++++++++++++++++++++++++++++++++---- setup/setup.sh | 14 ++++++++++---- 2 files changed, 45 insertions(+), 8 deletions(-) diff --git a/dotfiles/.zshrc b/dotfiles/.zshrc index 642cc1f..1528b13 100644 --- a/dotfiles/.zshrc +++ b/dotfiles/.zshrc @@ -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 diff --git a/setup/setup.sh b/setup/setup.sh index 3516f62..5c3a446 100755 --- a/setup/setup.sh +++ b/setup/setup.sh @@ -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}"