Add CLI installers for Tea, Borg, and Git Credential Manager, and enhance setup script with improved authentication
This commit is contained in:
196
TEA_CLI_INSTALLER_README.md
Normal file
196
TEA_CLI_INSTALLER_README.md
Normal file
@@ -0,0 +1,196 @@
|
||||
# Tea CLI Installer
|
||||
|
||||
A comprehensive installer script for Gitea Tea CLI that supports multiple Linux distributions and installation methods.
|
||||
|
||||
## Features
|
||||
|
||||
- **Version Checking**: Only downloads and installs if newer version is available
|
||||
- **Multiple Installation Methods**:
|
||||
- Package manager (apt, yum, dnf, zypper)
|
||||
- Binary download from Gitea releases
|
||||
- **Cross-Platform Support**: Debian, Ubuntu, RHEL, CentOS, Fedora, Arch, openSUSE
|
||||
- **Architecture Support**: x86_64 (amd64), ARM64, ARM
|
||||
- **Automatic Updates**: Fetches latest version from Gitea API
|
||||
- **Force Reinstall**: Option to force reinstall even if up-to-date
|
||||
|
||||
## Usage
|
||||
|
||||
### Basic Usage
|
||||
```bash
|
||||
# Install latest version (only if newer than current)
|
||||
./install-tea-cli.sh
|
||||
|
||||
# Install specific version
|
||||
./install-tea-cli.sh -v v0.11.0
|
||||
|
||||
# Force reinstall even if up-to-date
|
||||
./install-tea-cli.sh --force
|
||||
```
|
||||
|
||||
### Installation Methods
|
||||
```bash
|
||||
# Force installation from package manager
|
||||
./install-tea-cli.sh --package
|
||||
|
||||
# Force installation from binary
|
||||
./install-tea-cli.sh --binary
|
||||
```
|
||||
|
||||
### Help
|
||||
```bash
|
||||
./install-tea-cli.sh --help
|
||||
```
|
||||
|
||||
## Installation Logic
|
||||
|
||||
### Version Checking
|
||||
1. **Check Current Version**: Detects installed Tea CLI version
|
||||
2. **Fetch Latest**: Gets latest version from Gitea API
|
||||
3. **Compare Versions**: Only proceeds if newer version available
|
||||
4. **Force Override**: `--force` flag bypasses version check
|
||||
|
||||
### Installation Priority
|
||||
1. **Package Manager** (preferred):
|
||||
- Debian/Ubuntu: Checks for official Tea CLI package
|
||||
- RHEL/CentOS/Fedora: Checks for available Tea CLI package
|
||||
- Arch Linux: Available in AUR (pacman)
|
||||
- openSUSE: Checks for available Tea CLI package
|
||||
|
||||
2. **Binary Download** (fallback):
|
||||
- Downloads platform-specific binary from Gitea releases
|
||||
- Supports x86_64, ARM64, ARM architectures
|
||||
- Installs to `/usr/local/bin/tea`
|
||||
|
||||
## File Locations
|
||||
|
||||
### Installation Directory
|
||||
- Binary: `/usr/local/bin/tea`
|
||||
- Symlink: `/usr/local/bin/tea-<version>`
|
||||
|
||||
## Version Comparison
|
||||
|
||||
The installer uses semantic version comparison:
|
||||
- **Format**: `vX.Y.Z` (e.g., `v0.11.1`)
|
||||
- **Logic**: Compares major, minor, patch versions
|
||||
- **Build Info**: Ignores build hashes/identifiers
|
||||
|
||||
### Examples
|
||||
```bash
|
||||
# Current: 0.11.0, Latest: v0.11.1 → Update needed
|
||||
# Current: 0.11.1, Latest: v0.11.1 → No update needed
|
||||
# Current: 0.11.2, Latest: v0.11.1 → No update needed (newer installed)
|
||||
```
|
||||
|
||||
## System Requirements
|
||||
|
||||
### Required
|
||||
- `curl` or `wget` (for downloading)
|
||||
- `sudo` access (for system-wide installation)
|
||||
|
||||
### Optional
|
||||
- Package manager access (for package installations)
|
||||
- Internet connection (for downloading releases)
|
||||
|
||||
## Supported Distributions
|
||||
|
||||
### Package Manager Support
|
||||
- **Debian/Ubuntu**: Checks for official Tea CLI package
|
||||
- **RHEL/CentOS/Fedora**: Checks for available Tea CLI package
|
||||
- **Arch Linux**: Available in AUR (pacman)
|
||||
- **openSUSE**: Checks for available Tea CLI package
|
||||
|
||||
### Binary Support
|
||||
- **Linux x86_64**: `tea-0.11.1-linux-amd64`
|
||||
- **Linux ARM64**: `tea-0.11.1-linux-arm64`
|
||||
- **Linux ARM**: `tea-0.11.1-linux-arm-5`, `tea-0.11.1-linux-arm-6`, `tea-0.11.1-linux-arm-7`
|
||||
|
||||
## Troubleshooting
|
||||
|
||||
### Version Detection Issues
|
||||
```bash
|
||||
# Check current version manually
|
||||
tea --version
|
||||
|
||||
# Force reinstall if version detection fails
|
||||
./install-tea-cli.sh --force
|
||||
```
|
||||
|
||||
### Permission Issues
|
||||
```bash
|
||||
# Ensure proper permissions
|
||||
sudo chown root:root /usr/local/bin/tea
|
||||
sudo chmod 755 /usr/local/bin/tea
|
||||
```
|
||||
|
||||
### PATH Issues
|
||||
```bash
|
||||
# Check which tea is being used
|
||||
which tea
|
||||
|
||||
# Check all tea installations
|
||||
find /usr -name tea 2>/dev/null
|
||||
find /home -name tea 2>/dev/null
|
||||
|
||||
# Update PATH if needed
|
||||
export PATH="/usr/local/bin:$PATH"
|
||||
```
|
||||
|
||||
## Examples
|
||||
|
||||
### Typical Workflow
|
||||
```bash
|
||||
# Check if update needed
|
||||
./install-tea-cli.sh
|
||||
|
||||
# Output if up-to-date:
|
||||
# [SUCCESS] You already have the latest version (0.11.1)
|
||||
# [SUCCESS] No installation needed. Exiting.
|
||||
|
||||
# Output if update available:
|
||||
# [INFO] Current version: 0.11.0
|
||||
# [INFO] Latest version: v0.11.1
|
||||
# [INFO] Newer version available: v0.11.1 > 0.11.0
|
||||
# [SUCCESS] Installation completed successfully!
|
||||
```
|
||||
|
||||
### Force Binary Installation
|
||||
```bash
|
||||
# Force binary installation
|
||||
./install-tea-cli.sh --force --binary
|
||||
|
||||
# Output:
|
||||
# [SUCCESS] Tea CLI binary installed successfully
|
||||
# Next steps:
|
||||
# 1. Test installation: tea --version
|
||||
# 2. Configure login: tea login add
|
||||
# 3. Use Tea CLI: tea --help
|
||||
```
|
||||
|
||||
## Integration with Setup Script
|
||||
|
||||
The Tea CLI installer is automatically integrated with the main Git repository setup script:
|
||||
|
||||
1. **Detection**: Checks for existing Tea CLI installations
|
||||
2. **Offer Installation**: Prompts to install Tea CLI if none found
|
||||
3. **Configuration**: Guides through login setup
|
||||
4. **Repository Management**: Enables Gitea repository operations
|
||||
|
||||
## Security Features
|
||||
|
||||
- **Official Releases**: Downloads from official Gitea releases
|
||||
- **Package Verification**: Uses official package repositories
|
||||
- **Proper Permissions**: Sets appropriate file ownership and permissions
|
||||
|
||||
## Contributing
|
||||
|
||||
To add support for new distributions or architectures:
|
||||
|
||||
1. Update `detect_os()` function for new package managers
|
||||
2. Add architecture detection in `get_arch()` function
|
||||
3. Update installation methods in `install_tea_from_*()` functions
|
||||
4. Test with target distribution
|
||||
5. Update documentation
|
||||
|
||||
## License
|
||||
|
||||
This installer script follows the same license as Gitea Tea CLI (MIT).
|
||||
Reference in New Issue
Block a user