Add CLI installers for Tea, Borg, and Git Credential Manager, and enhance setup script with improved authentication

This commit is contained in:
kdusek
2025-11-13 17:29:06 +01:00
parent e9373ba1e1
commit a71fa38da0
12 changed files with 3379 additions and 61 deletions

130
README.md
View File

@@ -5,23 +5,137 @@ This script helps you create a git repository from existing codebase and configu
## Features
- **Multiple Authentication Methods**:
- SSH (passwordless after key setup)
- HTTPS (with token/password)
- Tea CLI (Gitea's official command-line tool)
- SSH (passwordless with key generation)
- HTTPS (with Git Credential Manager)
- Tea CLI (full Gitea API integration)
- **Advanced Installation Management**:
- **Tea CLI**: User-specific installations with version symlinks
- **Git Credential Manager**: Automatic detection and setup
- **Borg CLI**: Backup tool with smart version management
- **Smart Updates**: Only downloads when newer versions available
- **Automatic Setup**:
- Git repository initialization
- SSH key generation (if needed)
- SSH key generation and display
- Tea CLI installation and configuration
- Remote repository creation
- Connection testing
## Usage
1. Make the script executable:
```bash
chmod +x setup-git-repo.sh
```
```bash
# Interactive setup
./setup-git-repo.sh
# With configuration file
echo '{"gitea": {"server_url": "https://your-gitea.com"}}' > config.json
./setup-git-repo.sh
```
## Available Installers
### Tea CLI Installer
```bash
# Install latest Tea CLI
./install-tea-cli.sh
# Install specific version
./install-tea-cli.sh -v v0.11.1
# Force reinstall
./install-tea-cli.sh --force
```
### Borg CLI Installer
```bash
# Install latest Borg CLI
./install-borg-cli.sh
# Install specific version
./install-borg-cli.sh -v 1.4.2
# Force reinstall
./install-borg-cli.sh --force
```
### Git Credential Manager Installer
```bash
# Install latest GCM
./install-git-credential-manager.sh
# Install specific version
./install-git-credential-manager.sh -v v2.6.1
# Force reinstall
./install-git-credential-manager.sh --force
# Check configuration without installing
./install-git-credential-manager.sh --checks
```
## Installation Strategies
All installers implement smart installation strategies:
### User-Specific Installations (Preferred)
- **Location**: `~/bin/` directory
- **Requirements**: `~/bin` exists and is in PATH
- **Benefits**: No sudo required, user isolation, multiple versions
- **Structure**:
```
~/bin/
├── tea -> tea-v0.11.1 # Active version
├── tea-v0.11.0 # Previous version
└── tea-v0.11.1 # Current version
```
### System-Wide Installations (Fallback)
- **Location**: `/usr/local/bin/`
- **Requirements**: sudo access
- **Benefits**: Available to all users
- **Structure**:
```
/usr/local/bin/
├── tea -> tea-v0.11.1
├── tea-v0.11.0
└── tea-v0.11.1
```
### Version Management
- **Symlinks**: Automatic version switching
- **Multiple Versions**: Keep old versions for rollback
- **Smart Updates**: Only download when newer version available
## Configuration
The script supports JSON configuration for automation:
```json
{
"gitea": {
"server_url": "https://your-gitea.com",
"default_login_name": "$USER",
"login_method": "token",
"has_access_token": true,
"default_auth_method": "3"
},
"git": {
"default_branch": "main",
"auto_init": false
},
"ssh": {
"key_type": "ed25519",
"key_path": "~/.ssh/id_ed25519"
},
"repository": {
"default_private": false,
"auto_add_files": false,
"auto_commit": false,
"auto_push": false
}
}
```
2. Run the script:
```bash