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

217
GITEA_INSTALLER_README.md Normal file
View File

@@ -0,0 +1,217 @@
# Gitea Server Installer
A comprehensive installer script for Gitea server 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 GitHub releases
- **Cross-Platform Support**: Debian, Ubuntu, RHEL, CentOS, Fedora, Arch, openSUSE
- **Architecture Support**: x86_64 (amd64), ARM64, ARM
- **Automatic Updates**: Fetches latest version from GitHub releases
- **Force Reinstall**: Option to force reinstall even if up-to-date
- **Service Setup**: Optional systemd service creation and configuration
## Usage
### Basic Usage
```bash
# Install latest version (only if newer than current)
./install-gitea-server.sh
# Install specific version
./install-gitea-server.sh -v v1.25.0
# Force reinstall even if up-to-date
./install-gitea-server.sh --force
```
### Installation Methods
```bash
# Force installation from package manager
./install-gitea-server.sh --package
# Force installation from binary
./install-gitea-server.sh --binary
# Install and set up as systemd service
./install-gitea-server.sh --service
```
### Help
```bash
./install-gitea-server.sh --help
```
## Installation Logic
### Version Checking
1. **Check Current Version**: Detects installed Gitea version
2. **Fetch Latest**: Gets latest version from GitHub 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: Uses official Gitea repository
- RHEL/CentOS/Fedora: Uses official Gitea repository
- Arch Linux: Available in AUR
- openSUSE: Uses official Gitea repository
2. **Binary Download** (fallback):
- Downloads platform-specific binary from GitHub releases
- Supports x86_64, ARM64, ARM architectures
- Installs to `/usr/local/bin/gitea`
### Service Setup
When `--service` is used:
- Creates systemd service file
- Sets up proper user/group permissions
- Creates configuration directories
- Generates basic configuration
- Enables and starts the service
## File Locations
### Installation Directory
- Binary: `/usr/local/bin/gitea`
- Service: `/etc/systemd/system/gitea.service`
- Configuration: `/etc/gitea/app.ini`
- Data: `/var/lib/gitea/data`
- Repositories: `/var/lib/gitea/data/repositories`
- Logs: `/var/lib/gitea/log`
- Attachments: `/var/lib/gitea/data/attachments`
### Configuration
The installer creates a basic configuration with:
- SQLite database (suitable for small installations)
- Security settings with generated secret key
- Local file storage
- Console logging
- Service user/group permissions
## Version Comparison
The installer uses semantic version comparison:
- **Format**: `vX.Y.Z` (e.g., `v1.25.1`)
- **Logic**: Compares major, minor, patch versions
- **Build Info**: Ignores build hashes/identifiers
### Examples
### Typical Workflow
```bash
# Check if update needed
./install-gitea-server.sh
# Output if up-to-date:
# [SUCCESS] You already have latest version (v1.25.1)
# [SUCCESS] No installation needed. Exiting.
# Output if update available:
# [INFO] Current version: v1.25.0
# [INFO] Latest version: v1.25.1
# [INFO] Newer version available: v1.25.1 > v1.25.0
# [SUCCESS] Installation completed successfully!
```
### Service Setup
```bash
# Install and set up as service
./install-gitea-server.sh --service
# Output:
# [SUCCESS] Gitea service setup completed!
# Next steps:
# 1. Start service: sudo systemctl start gitea
# 2. Check status: sudo systemctl status gitea
# 3. View logs: sudo journalctl -u gitea -f
# 4. Configure at: /etc/gitea/app.ini
```
## System Requirements
### Required
- `curl` or `wget` (for downloading)
- `sudo` access (for system-wide installation)
- Systemd (for service setup)
### Optional
- Package manager access (for package installations)
- Internet connection (for downloading releases)
## Security Features
- **Official Releases**: Downloads from official GitHub releases
- **Package Verification**: Uses GPG keys for package manager installations
- **Proper Permissions**: Sets appropriate file ownership and permissions
- **Service Isolation**: Runs as dedicated service user/group
## Supported Distributions
### Package Manager Support
- **Debian/Ubuntu**: Official Gitea repository with GPG verification
- **RHEL/CentOS/Fedora**: Official Gitea RPM repository
- **Arch Linux**: Available in AUR (pacman)
- **openSUSE**: Official Gitea repository
### Binary Support
- **Linux x86_64**: `gitea-1.25.1-linux-amd64`
- **Linux ARM64**: `gitea-1.25.1-linux-arm64`
- **Linux ARM**: `gitea-1.25.1-linux-arm-5`
## Troubleshooting
### Version Detection Issues
```bash
# Check current version manually
gitea --version
# Force reinstall if version detection fails
./install-gitea-server.sh --force
```
### Permission Issues
```bash
# Ensure proper permissions
sudo chown root:root /usr/local/bin/gitea
sudo chmod 755 /usr/local/bin/gitea
```
### Service Issues
```bash
# Check service status
sudo systemctl status gitea
# View service logs
sudo journalctl -u gitea -f
# Restart service
sudo systemctl restart gitea
```
## Production Considerations
For production use, consider:
- Using PostgreSQL/MySQL instead of SQLite
- Configuring reverse proxy (nginx/apache)
- Setting up SSL certificates
- Adjusting firewall settings
- Regular backups
- Monitoring and log rotation
## 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_from_*()` functions
4. Test with target distribution
5. Update documentation
## License
This installer script follows the same license as Gitea (MIT).