A powerful and intelligent bash script for automatically installing and managing command-line tools from GitHub releases. The script handles version detection, normalization, downloading, extraction, and installation with robust error handling and comprehensive toolchain management.
- Automatic Installation: Install CLI tools directly from GitHub releases
- Version Management: Detect installed vs latest versions with smart comparison
- Bulk Operations: Install, upgrade, or uninstall multiple tools at once
- Version Normalization: Handles different version formats (
v1.2.3,1.2.3,tool-1.2.3) seamlessly - Architecture Support: Automatically detects and supports
amd64,arm64,arm, and386architectures - Archive Handling: Supports
.tar.gz,.zip, and single binary downloads - Dry Run Mode: Preview operations before execution
- Force Reinstall: Override version checks for debugging or rollbacks
- Comprehensive Help: Built-in documentation for adding new tools
- Color Output: Enhanced readability with color-coded status messages
- Process Management: Automatically stops running processes before upgrades
- Flexible Configuration: INI-style config file with tool definitions
The script requires these common tools (available on most Linux systems):
curl- For downloading files and API callstar- For extracting .tar.gz archivesunzip- For extracting .zip archivessudo- For installing to system directoriesgrep,awk,sed- For text processing
-
Download the script:
wget https://your-domain.com/install_from_github.sh chmod +x install_from_github.sh
-
Create or download a config file:
wget https://your-domain.com/install_from_github.config
-
Optional: Set up GitHub token (recommended to avoid API rate limits):
export GITHUB_TOKEN="your_personal_access_token"
# List available tools
./install_from_github.sh --list
# Install specific tools
./install_from_github.sh jq yq kubectl
# Check what's installed vs latest
./install_from_github.sh --show-installed
# Upgrade all outdated tools
./install_from_github.sh --upgrade-installed
# Install all tools from config
./install_from_github.sh --install-all
# Preview what would be installed
./install_from_github.sh flux stern dive --dry-run# Install single tool
./install_from_github.sh helm -y
# Install multiple tools without confirmation
./install_from_github.sh jq yq bat fd -y
# Force reinstall existing tool
./install_from_github.sh kubectl --force -y
# Uninstall tools
./install_from_github.sh --uninstall helm kubectl# Install everything
./install_from_github.sh --install-all
# Upgrade only outdated tools
./install_from_github.sh --upgrade-installed
# Remove all managed tools
./install_from_github.sh --uninstall-all# Use custom config file
./install_from_github.sh --config /path/to/custom.config helm
# Install to custom directory
./install_from_github.sh --path /opt/bin kubectl
# Verbose output for debugging
./install_from_github.sh helm -v
# Dry run to preview actions
./install_from_github.sh --install-all --dry-runThe script uses an INI-style configuration file (install_from_github.config) to define available tools:
[helm]
DESCRIPTION="Kubernetes package manager"
APPLICATION="helm"
GITHUB_REPO="helm/helm"
VERSION_CMD_ARGS="version --short"
VERSION_REGEX='v\d+\.\d+\.\d+'
ARCHIVE_PATTERN="helm-%VERSION%-linux-%ARCH%.tar.gz"
BINARY_NAME="linux-%ARCH%/helm"
[jq]
DESCRIPTION="Command-line JSON processor"
APPLICATION="jq"
GITHUB_REPO="jqlang/jq"
VERSION_CMD_ARGS="--version"
VERSION_REGEX='jq-\d+\.\d+(\.\d+)?'
ARCHIVE_PATTERN="jq-linux-amd64"
BINARY_NAME="jq-linux-amd64"- DESCRIPTION: Brief description of the tool
- APPLICATION: Binary name for PATH lookup and execution
- GITHUB_REPO: GitHub repository in
owner/repoformat - VERSION_CMD_ARGS: Command arguments to get version (e.g.,
--version) - VERSION_REGEX: Perl regex to extract version from command output
- ARCHIVE_PATTERN: Download filename pattern with placeholders
- BINARY_NAME: Path to binary inside extracted archive
- %VERSION%: Replaced with normalized version number
- %ARCH%: Replaced with system architecture (
amd64,arm64, etc.)
The script includes comprehensive help for adding new tools. Run:
./install_from_github.sh --help- Find the GitHub repository and verify it has releases
- Test the version command:
tool_name --version # Output: "tool 1.2.3" โ VERSION_REGEX='\d+\.\d+\.\d+' - Check release assets at
https://github.com/owner/repo/releases/latest - Create config entry:
[tool_name] DESCRIPTION="Tool description" APPLICATION="tool_name" GITHUB_REPO="owner/repo" VERSION_CMD_ARGS="--version" VERSION_REGEX='\d+\.\d+\.\d+' ARCHIVE_PATTERN="tool_%VERSION%_linux_amd64.tar.gz" BINARY_NAME="tool"
- Test the configuration:
./install_from_github.sh tool_name --dry-run ./install_from_github.sh tool_name -y
The included configuration supports these popular DevOps and development tools:
- k9s - Kubernetes cluster management TUI
- helm - Kubernetes package manager
- kubectl - Kubernetes command-line tool (via other configs)
- kind - Kubernetes in Docker
- stern - Multi-pod log tailing
- flux - GitOps toolkit
- argocd - GitOps continuous delivery
- terragrunt - Terraform wrapper
- tenv - Terraform/OpenTofu version manager
- docker-compose - Multi-container orchestration
- trivy - Vulnerability scanner
- grype - Container vulnerability scanner
- dive - Docker image layer explorer
- jq - JSON processor
- yq - YAML processor
- bat - Enhanced cat with syntax highlighting
- fd - User-friendly find alternative
- ripgrep - Fast grep alternative
# Basic installation
./install_from_github.sh TOOL [TOOL2 ...]
# Explicit installation
./install_from_github.sh --install TOOL [TOOL2 ...]
# Install all configured tools
./install_from_github.sh --install-all
# Force reinstall (only affects installed tools)
./install_from_github.sh TOOL --force# List available tools
./install_from_github.sh --list
# Show version status
./install_from_github.sh --show-installed
# Upgrade outdated tools
./install_from_github.sh --upgrade-installed
# Uninstall tools
./install_from_github.sh --uninstall TOOL [TOOL2 ...]
# Uninstall all managed tools
./install_from_github.sh --uninstall-all-h, --help Show comprehensive help
-c, --config FILE Use custom config file
-p, --path PATH Install to custom directory
-f, --force Force reinstall existing tools
-d, --dry-run Preview actions without execution
-y, --yes Skip confirmation prompts
-v, --verbose Show detailed output"API rate limit exceeded"
- Solution: Set up a GitHub personal access token
- Create token at: https://github.com/settings/tokens
- Export:
export GITHUB_TOKEN="your_token"
"Failed to get latest version"
- Check if
GITHUB_REPOis correct in config - Verify the repository has releases
- Check internet connectivity
"Download/extract failed"
- Verify
ARCHIVE_PATTERNmatches actual filename on GitHub releases - Check if the file format is supported (
.tar.gz,.zip, or single binary)
"Binary not found"
- Check
BINARY_NAMEpath is correct for the archive structure - Use
--verboseto see extraction details - Manually download and extract to verify structure
"Tool not detected after installation"
- Ensure
VERSION_REGEXmatches the tool's version output format - Verify
APPLICATIONname matches the installed binary name - Check if binary is executable and in PATH
Run with verbose output to diagnose issues:
./install_from_github.sh tool_name -v- No checksum verification: Currently doesn't verify download integrity
- Sudo required: Installs to system directories requiring elevated privileges
- GitHub trust: Relies on GitHub's security for download authenticity
- Process termination: Automatically kills running processes during upgrades
- GitHub releases only: Only works with tools distributed via GitHub releases
- Linux focus: Optimized for Linux systems (some tools may work on macOS)
- No dependency management: Doesn't handle tool dependencies
- No rollback: No built-in mechanism to revert to previous versions
- Architecture detection: Limited to common architectures
- Checksum verification for downloads
- Support for additional archive formats
- Dependency management
- Configuration validation
- Version pinning
- Rollback functionality
- Windows and macOS support improvements
This project is provided as-is for educational and practical use. Please ensure compliance with the licenses of the individual tools being installed.
Contributions welcome! Areas for improvement:
- Additional tool configurations
- Enhanced error handling
- New features and capabilities
- Documentation improvements
- Testing and validation
Note: This tool manages external software installations. Always review what you're installing and ensure it comes from trusted sources. The script author is not responsible for the security or functionality of third-party tools.