mirror of
https://github.com/acedanger/shell.git
synced 2025-12-05 20:40:11 -08:00
refactor: Remove Fabric installation and testing from setup scripts
This commit is contained in:
@@ -141,69 +141,32 @@ if [ -f "$HOME/shell/completions/env-backup-completion.bash" ]; then
|
||||
source "$HOME/shell/completions/env-backup-completion.bash"
|
||||
fi
|
||||
|
||||
# Go environment variables (required for Fabric and other Go tools)
|
||||
# Go environment variables
|
||||
# GOROOT is auto-detected by Go when installed via package manager
|
||||
export GOPATH=$HOME/go
|
||||
export PATH=$GOPATH/bin:$PATH
|
||||
|
||||
# Fabric AI - Pattern aliases and helper functions
|
||||
if command -v fabric &> /dev/null; then
|
||||
# Loop through all directories in the ~/.config/fabric/patterns directory to create aliases
|
||||
if [ -d "$HOME/.config/fabric/patterns" ]; then
|
||||
for pattern_dir in $HOME/.config/fabric/patterns/*/; do
|
||||
if [ -d "$pattern_dir" ]; then
|
||||
# Get the base name of the directory (i.e., remove the directory path)
|
||||
pattern_name=$(basename "$pattern_dir")
|
||||
|
||||
# Create an alias in the form: alias pattern_name="fabric --pattern pattern_name"
|
||||
alias_command="alias $pattern_name='fabric --pattern $pattern_name'"
|
||||
|
||||
# Evaluate the alias command to add it to the current shell
|
||||
eval "$alias_command"
|
||||
fi
|
||||
done
|
||||
fi
|
||||
|
||||
# YouTube transcript helper function
|
||||
yt() {
|
||||
if [ "$#" -eq 0 ] || [ "$#" -gt 2 ]; then
|
||||
echo "Usage: yt [-t | --timestamps] youtube-link"
|
||||
echo "Use the '-t' flag to get the transcript with timestamps."
|
||||
return 1
|
||||
fi
|
||||
|
||||
transcript_flag="--transcript"
|
||||
if [ "$1" = "-t" ] || [ "$1" = "--timestamps" ]; then
|
||||
transcript_flag="--transcript-with-timestamps"
|
||||
shift
|
||||
fi
|
||||
|
||||
local video_link="$1"
|
||||
fabric -y "$video_link" $transcript_flag
|
||||
}
|
||||
fi
|
||||
|
||||
# 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
|
||||
|
||||
@@ -20,5 +20,4 @@ eza // Modern ls alternative
|
||||
// Note: lazygit, lazydocker, and fabric require special installation (GitHub releases/scripts)
|
||||
// These are handled separately in the setup script
|
||||
// lazygit
|
||||
// lazydocker
|
||||
fabric
|
||||
// lazydocker
|
||||
@@ -185,14 +185,6 @@ for pkg in "${pkgs[@]}"; do
|
||||
continue
|
||||
fi
|
||||
|
||||
# Handle fabric installation
|
||||
if [ "$pkg" = "fabric" ]; then
|
||||
special_installs+=("$pkg")
|
||||
continue
|
||||
fi
|
||||
|
||||
|
||||
|
||||
# Handle lazygit - available in COPR for Fedora, special install for Debian/Ubuntu
|
||||
if [ "$pkg" = "lazygit" ] && [ "$OS_NAME" != "fedora" ]; then
|
||||
special_installs+=("$pkg")
|
||||
@@ -245,28 +237,6 @@ esac
|
||||
|
||||
echo -e "${GREEN}Package installation completed for $OS_NAME $OS_VERSION.${NC}"
|
||||
|
||||
# Install Go if not present (required for Fabric and other Go tools)
|
||||
echo -e "${YELLOW}Checking Go installation...${NC}"
|
||||
if ! command -v go &> /dev/null; then
|
||||
echo -e "${YELLOW}Installing Go programming language...${NC}"
|
||||
GO_VERSION="1.21.5" # Stable version that works well with Fabric
|
||||
|
||||
# Download and install Go
|
||||
wget -q "https://go.dev/dl/go${GO_VERSION}.linux-amd64.tar.gz" -O /tmp/go.tar.gz
|
||||
|
||||
# Remove any existing Go installation
|
||||
sudo rm -rf /usr/local/go
|
||||
|
||||
# Extract Go to /usr/local
|
||||
sudo tar -C /usr/local -xzf /tmp/go.tar.gz
|
||||
rm /tmp/go.tar.gz
|
||||
|
||||
echo -e "${GREEN}Go ${GO_VERSION} installed successfully!${NC}"
|
||||
echo -e "${YELLOW}Go PATH will be configured in shell configuration${NC}"
|
||||
else
|
||||
echo -e "${GREEN}Go is already installed: $(go version)${NC}"
|
||||
fi
|
||||
|
||||
# Handle special installations that aren't available through package managers
|
||||
echo -e "${YELLOW}Installing special packages...${NC}"
|
||||
for pkg in "${special_installs[@]}"; do
|
||||
@@ -285,45 +255,6 @@ for pkg in "${special_installs[@]}"; do
|
||||
echo -e "${GREEN}Lazydocker is already installed${NC}"
|
||||
fi
|
||||
;;
|
||||
"fabric")
|
||||
if ! command -v fabric &> /dev/null; then
|
||||
echo -e "${YELLOW}Installing Fabric from GitHub releases...${NC}"
|
||||
# Download and install the latest Fabric binary for Linux AMD64
|
||||
curl -L https://github.com/danielmiessler/fabric/releases/latest/download/fabric-linux-amd64 -o /tmp/fabric
|
||||
chmod +x /tmp/fabric
|
||||
sudo mv /tmp/fabric /usr/local/bin/fabric
|
||||
echo -e "${GREEN}Fabric binary installed successfully!${NC}"
|
||||
|
||||
# Verify installation
|
||||
if fabric --version; then
|
||||
echo -e "${GREEN}Fabric installation verified!${NC}"
|
||||
echo -e "${YELLOW}Running Fabric setup...${NC}"
|
||||
|
||||
# Create fabric config directory
|
||||
mkdir -p "$HOME/.config/fabric"
|
||||
|
||||
# Run fabric setup with proper configuration
|
||||
echo -e "${YELLOW}Setting up Fabric patterns and configuration...${NC}"
|
||||
|
||||
# Initialize fabric with default patterns
|
||||
fabric --setup || echo -e "${YELLOW}Initial fabric setup completed${NC}"
|
||||
|
||||
# Update patterns to get the latest
|
||||
echo -e "${YELLOW}Updating Fabric patterns...${NC}"
|
||||
fabric --updatepatterns || echo -e "${YELLOW}Pattern update completed${NC}"
|
||||
|
||||
echo -e "${GREEN}Fabric setup completed successfully!${NC}"
|
||||
echo -e "${YELLOW}You can test fabric with: fabric --list-patterns${NC}"
|
||||
else
|
||||
echo -e "${RED}Fabric installation verification failed${NC}"
|
||||
fi
|
||||
else
|
||||
echo -e "${GREEN}Fabric is already installed${NC}"
|
||||
# Still try to update patterns
|
||||
echo -e "${YELLOW}Updating Fabric patterns...${NC}"
|
||||
fabric --updatepatterns || echo -e "${YELLOW}Pattern update completed${NC}"
|
||||
fi
|
||||
;;
|
||||
"lazygit")
|
||||
if ! command -v lazygit &> /dev/null; then
|
||||
echo -e "${YELLOW}Installing Lazygit from GitHub releases...${NC}"
|
||||
@@ -636,30 +567,8 @@ echo -e "${GREEN}OS: $OS_NAME $OS_VERSION${NC}"
|
||||
echo -e "${GREEN}Package Manager: $PKG_MANAGER${NC}"
|
||||
echo -e "${GREEN}Shell: $(basename "$SHELL") → zsh${NC}"
|
||||
|
||||
echo -e "\n${YELLOW}Testing Fabric installation...${NC}"
|
||||
if command -v fabric &> /dev/null; then
|
||||
echo -e "${GREEN}✓ Fabric is installed${NC}"
|
||||
|
||||
# Test fabric patterns
|
||||
echo -e "${YELLOW}Testing Fabric patterns...${NC}"
|
||||
if fabric --list-patterns >/dev/null 2>&1; then
|
||||
echo -e "${GREEN}✓ Fabric patterns are available${NC}"
|
||||
echo -e "${YELLOW}Number of patterns: $(fabric --list-patterns 2>/dev/null | wc -l)${NC}"
|
||||
else
|
||||
echo -e "${YELLOW}⚠ Fabric patterns may need to be updated${NC}"
|
||||
fi
|
||||
else
|
||||
echo -e "${RED}✗ Fabric is not installed${NC}"
|
||||
fi
|
||||
|
||||
echo -e "\n${GREEN}=== Post-Installation Instructions ===${NC}"
|
||||
echo -e "${YELLOW}1. Restart your shell or run: source ~/.zshrc${NC}"
|
||||
echo -e "${YELLOW}2. Test Fabric: fabric --list-patterns${NC}"
|
||||
echo -e "${YELLOW}3. Try a Fabric pattern: echo 'Hello world' | fabric --pattern summarize${NC}"
|
||||
|
||||
echo -e "\n${GREEN}=== Useful Commands ===${NC}"
|
||||
echo -e "${YELLOW}• Fabric help: fabric --help${NC}"
|
||||
echo -e "${YELLOW}• Update patterns: fabric --updatepatterns${NC}"
|
||||
|
||||
echo -e "\n${GREEN}Setup completed successfully for $OS_NAME $OS_VERSION!${NC}"
|
||||
echo -e "${YELLOW}Note: You may need to log out and log back in for all changes to take effect.${NC}"
|
||||
|
||||
Reference in New Issue
Block a user