https://github.com/roimme65/gentoo-updater
π§ Automatischer System-Updater fΓΌr Gentoo Linux mit emerge, eix-Integration, Kernel-Checks und Konfigurations-PrΓΌfung
https://github.com/roimme65/gentoo-updater
automation gentoo-linux update
Last synced: 2 months ago
JSON representation
π§ Automatischer System-Updater fΓΌr Gentoo Linux mit emerge, eix-Integration, Kernel-Checks und Konfigurations-PrΓΌfung
- Host: GitHub
- URL: https://github.com/roimme65/gentoo-updater
- Owner: roimme65
- License: mit
- Created: 2026-01-01T17:22:21.000Z (6 months ago)
- Default Branch: main
- Last Pushed: 2026-01-27T21:50:41.000Z (5 months ago)
- Last Synced: 2026-01-28T09:20:44.391Z (5 months ago)
- Topics: automation, gentoo-linux, update
- Language: Python
- Homepage: https://github.com/roimme65/gentoo-updater
- Size: 140 KB
- Stars: 0
- Watchers: 0
- Forks: 0
- Open Issues: 0
-
Metadata Files:
- Readme: README.md
- Changelog: CHANGELOG.md
- License: LICENSE
- Security: SECURITY.md
Awesome Lists containing this project
README
# Gentoo System Updater
**Languages:** π¬π§ [English](README.md) | π©πͺ [Deutsch](README.de.md)
Automated update solution for Gentoo Linux that simplifies and automates the entire system update process.
## Features
### π Performance & Optimization
- β‘ **Parallel Compilation** with automatic CPU detection (`--jobs` and `--load-average`)
- π **Intelligent Update Detection** - Rebuild kernel modules only when needed
- πΎ **Disk Space Check** before updates
- π **Automatic Retry** on manifest errors
### π¦ Update Functions
- π **Repository Synchronisation** (`emerge --sync`)
- π **eix Database Update** (optional)
- π¦ **System Update** (full `@world` update)
- π§ **Intelligent Kernel Module Recompilation** (NVIDIA, VirtualBox, etc.)
- π§Ή **Automatic Cleanup** (`emerge --depclean`)
- π§ **Dependency Repair** (`revdep-rebuild`)
### π‘οΈ Security & Reliability
- πΎ **Automatic Backups** of important configuration files
- π **Blocked Packages Check** before updates
- β οΈ **Critical Package Warning** (gcc, glibc, Python)
- π **Full Logging System** with JSON export
- π― **Robust Error Handling** with detailed logs
### π Monitoring & Reports
- π **Update Summary** with statistics
- π **Mirror Logging** - Shows all configured Gentoo mirrors & primary mirror
- π§ **Email Notifications** (optional)
- π **Automatic Log Rotation**
- π¨ **Colored Output** with clear structure
### βοΈ Configuration
- π **JSON Configuration File** for customization
- π§ **Flexible emerge Options**
- β‘ **Dry-Run Mode** for testing
### π v1.4.0 Advanced Parameters
- ποΈ **--log-level** (DEBUG/INFO/WARNING/ERROR)
- βοΈ **--skip-*** options (sync, update, eix, cleanup, revdep)
- π― **--only-*** options (execute specific steps only)
- π¦ **--max-packages N** (limit updates)
- β±οΈ **--timeout SECONDS** (set emerge timeout)
- π **--retry-count N** (automatic retries on failure)
- π **--notification-webhook URL** (send notifications)
- βοΈ **--parallel-jobs N** (override job count)
- π **Environment Variables** (GENTOO_UPDATER_*)
## Requirements
- Gentoo Linux
- Python 3.6+
- Root/sudo privileges
- Optional: `eix` for faster package searches
- Optional: `gentoolkit` for `revdep-rebuild`
## Installation
### Method 1: Automatic Installation
```bash
git clone https://github.com/roimme65/gentoo-updater.git
cd gentoo-updater
sudo ./install.sh
```
### Method 2: Manual Installation
```bash
# Download script
git clone https://github.com/roimme65/gentoo-updater.git
cd gentoo-updater
# Make executable
chmod +x gentoo-updater.py
# Copy to /usr/local/bin (optional)
sudo cp gentoo-updater.py /usr/local/bin/gentoo-updater
```
### Method 3: PyPI (Coming in v1.4.0+)
```bash
pip install gentoo-updater
```
## Usage
### Full System Update
```bash
sudo gentoo-updater
```
### Create Configuration
On first run, create default configuration:
```bash
sudo gentoo-updater --create-config
```
This creates `/etc/gentoo-updater.conf` with options:
- **emerge_jobs**: Number of parallel jobs (auto = CPU cores)
- **emerge_load_average**: Maximum system load
- **enable_backups**: Enable automatic backups
- **backup_dir**: Backup directory
- **enable_notifications**: Enable email notifications
- **notification_email**: Email address
- **min_free_space_gb**: Minimum free space required
- **auto_depclean**: Enable automatic depclean
- **auto_revdep_rebuild**: Enable automatic revdep-rebuild
- **critical_packages**: List of critical packages
- **log_retention_days**: Log retention in days
Example config: see [gentoo-updater.conf.example](gentoo-updater.conf.example)
### Dry-Run Mode
```bash
sudo gentoo-updater --dry-run
```
### Verbose Output
```bash
sudo gentoo-updater --verbose
```
### Advanced Parameters (v1.4.0+)
```bash
# Log level control
sudo gentoo-updater --log-level DEBUG
# Skip specific steps
sudo gentoo-updater --skip-cleanup --skip-revdep
# Execute only specific steps
sudo gentoo-updater --only-sync # Only repository sync
sudo gentoo-updater --only-update # Only system update
# Limit packages
sudo gentoo-updater --max-packages 50
# Set timeout
sudo gentoo-updater --timeout 3600
# Retry on failure
sudo gentoo-updater --retry-count 3
# Override parallel jobs
sudo gentoo-updater --parallel-jobs 8
# Send webhook notification
sudo gentoo-updater --notification-webhook "https://example.com/webhook"
```
### Environment Variables (v1.4.0+)
```bash
# Enable dry-run via environment variable
GENTOO_UPDATER_DRY_RUN=true sudo gentoo-updater
# Debug logging
GENTOO_UPDATER_LOG_LEVEL=DEBUG sudo gentoo-updater
# Set timeout
GENTOO_UPDATER_TIMEOUT=3600 sudo gentoo-updater
# Enable retry
GENTOO_UPDATER_RETRY_COUNT=3 sudo gentoo-updater
# Override parallel jobs
GENTOO_UPDATER_PARALLEL_JOBS=4 sudo gentoo-updater
```
### Kernel Module Recompilation
Recompile kernel modules (useful after manual kernel update):
```bash
sudo gentoo-updater --rebuild-modules
```
This rebuilds external kernel modules:
- NVIDIA drivers (`nvidia-drivers`)
- VirtualBox modules (`virtualbox-modules`)
- ZFS modules
- Other external modules
### Custom Configuration File
```bash
sudo gentoo-updater --config /path/to/my-config.conf
```
### Show Help
```bash
gentoo-updater --help
```
## What the Script Does
The script automatically executes these steps:
1. **Repository Synchronisation**
- Reads GENTOO_MIRRORS from `/etc/portage/make.conf`
- Displays all configured mirrors
- Runs `emerge --sync` to update the Portage tree
2. **eix Database Update**
- Runs `eix-update` to update eix database (if installed)
3. **Update Check**
- Checks for available updates
- Shows list of packages to update
4. **System Update**
- Runs `emerge @world --update --deep --newuse`
- Monitors for critical package updates
- Only rebuilds kernel modules if kernel was updated
5. **Cleanup**
- Runs `emerge --depclean` to remove unused packages
6. **Dependency Repair**
- Runs `revdep-rebuild` to fix broken dependencies (if gentoolkit installed)
7. **Kernel Check**
- Shows available kernel versions
- Provides hints for manual kernel updates
8. **Configuration Check**
- Searches for ._cfg files
- Alerts about pending configuration updates
## Logs & Backups
### Logs
The script automatically creates detailed logs:
- Log file: `/var/log/gentoo-updater/update-YYYYMMDD-HHMMSS.log`
- JSON summary: `/var/log/gentoo-updater/update-YYYYMMDD-HHMMSS.json`
- Real-time output to terminal
- Automatic log rotation (default: 30 days)
### Backups
Before each update, these files are backed up:
- `/etc/portage/make.conf`
- `/etc/portage/package.use`
- `/etc/portage/package.accept_keywords`
- `/var/lib/portage/world`
Backup directory: `/var/backups/gentoo-updater/YYYYMMDD-HHMMSS/`
### Update Summary
After each update:
- π All configured Gentoo mirrors
- π Primary mirror (first available)
- Number of updated packages
- Number of removed packages
- Kernel update status
- Module rebuild status
- Errors and warnings
- Total duration
## Troubleshooting
### "Script requires root privileges"
```bash
sudo gentoo-updater
```
### Manifest quarantine errors
The script automatically handles manifest errors by:
1. Deleting the quarantine directory
2. Automatic retry of sync
If problems persist:
```bash
sudo rm -rf /var/db/repos/gentoo/.tmp-unverified-download-quarantine
sudo emerge --sync
```
### Missing kernel modules after kernel update
```bash
sudo gentoo-updater --rebuild-modules
```
### eix not found
```bash
sudo emerge --ask app-portage/eix
```
### revdep-rebuild not found
```bash
sudo emerge --ask app-portage/gentoolkit
```
## FAQ
**Q: Why are kernel modules not rebuilt?**
A: This is normal and correct! Modules are rebuilt only when:
- β
A kernel update occurred during system update, OR
- β
Running kernel β Installed kernel (after manual kernel compilation)
Modules are NOT rebuilt when:
- β Kernel is already compiled for current version
Why? To make updates faster! (5-10 minutes faster)
**Q: How do I force module rebuild?**
A: Use `--rebuild-modules` option:
```bash
sudo gentoo-updater --rebuild-modules
```
**Q: How long does an update take?**
A: Depends on update scope:
- **Without kernel update**: 5-10 minutes (modules NOT recompiled)
- **With kernel update**: 15-25 minutes (NVIDIA/VirtualBox modules recompiled)
**Q: What if I manually update the kernel?**
A: After manual kernel build:
```bash
eselect kernel set
cd /usr/src/linux
make oldconfig && make && make modules_install && make install
grub-mkconfig -o /boot/grub/grub.cfg
# Then:
sudo gentoo-updater --rebuild-modules
```
The script automatically detects kernel mismatch and rebuilds modules.
## Differences from Other Distributions
Gentoo requires more manual steps than other distributions:
- **Kernel Compilation** is manual (not automated)
- β
But: Kernel modules are automatically rebuilt!
- **Configuration Updates** require `dispatch-conf` or `etc-update`
- **Compilation** can take a long time (depends on hardware and USE flags)
- **USE flag changes** may require recompilation
## Common Use Cases
### Complete Weekend Update
```bash
sudo gentoo-updater
# Wait for completion...
# Check kernel updates and configs
# Reboot system
```
### Quick Module Rebuild After Manual Kernel Update
```bash
# After manual kernel build:
sudo gentoo-updater --rebuild-modules
sudo reboot
```
### Testing Without Changes
```bash
sudo gentoo-updater --dry-run
```
## License
MIT License - See LICENSE file
## Contributing
Contributions are welcome! Please create a pull request or open an issue.
## Changelog
### v1.4.0 (2026-02-06) - π Advanced Parameters
- ποΈ **New Parameters:** --log-level, --skip-*, --only-*, --max-packages, --timeout, --retry-count, --notification-webhook, --parallel-jobs
- π **Environment Variables:** Full environment variable support (GENTOO_UPDATER_*)
- π **Documentation:** Updated help with examples and environment variable docs
- β¨ **v1.4.0 Ready for PyPI:** All parameters fully implemented
### v1.3.3 (2026-02-06) - π Mirror Logging
- π **New Feature:** Mirror Logging
- Reads GENTOO_MIRRORS from `/etc/portage/make.conf`
- Displays all configured mirrors during repository sync
- Logs primary mirror to log file and JSON summary
- π Enhanced statistics with mirror information
- π Improved logging during repository sync
## Author
Created for Gentoo Linux users
## See Also
- [Gentoo Wiki - Updating Gentoo](https://wiki.gentoo.org/wiki/Handbook:AMD64/Working/Portage#Updating_Gentoo)
- [Gentoo Wiki - eix](https://wiki.gentoo.org/wiki/Eix)
- [Gentoo Wiki - gentoolkit](https://wiki.gentoo.org/wiki/Gentoolkit)
- [GitHub Repository](https://github.com/roimme65/gentoo-updater)
- [Release Notes](https://github.com/roimme65/gentoo-updater/releases)