feat: release v2.0.0 with tab completion, package filtering, db health checks, flatpak and logrotate
Build and Publish Release / Build Packages and Publish (push) Successful in 27s

This commit is contained in:
soda64 committed 2026-10-03 08:31:00 +02:00
1 parent 8d4157b42d
commit 8bec4ed932
27 files changed
+1053 -69

No files matched your search

+39 -5
View File
@@ -71,7 +71,11 @@ The default configuration file `/etc/linux-updater.json` governs health check th
"auto_remediate": true,
"non_interactive": false,
"check_ac_power": true,
"clean_after_update": false
"clean_after_update": false,
"auto_reboot": false,
"exclude_packages": [],
"security_only": false,
"update_flatpak": false
},
"logging": {
"log_dir": "/var/log/linux-updater",
@@ -88,10 +92,14 @@ The default configuration file `/etc/linux-updater.json` governs health check th
- `min_ram_mb`: Available RAM threshold in `/proc/meminfo`. Protects against OOM killer crashing package scripts. Defaults to 300 MB.
### Behavior Parameters
- `auto_remediate`: When `true`, automatically clears package cache if `/var` is low and unlinks stale locks if the holder PID is dead.
- `auto_remediate`: When `true`, automatically clears package cache if `/var` is low, unlinks stale locks if the holder PID is dead, and repairs interrupted package transactions (`dpkg --configure -a`, `apt-get install -f`, `dnf clean all`).
- `non_interactive`: Default non-interactive state. (Overridden by CLI `-y`).
- `check_ac_power`: Inspects `/sys/class/power_supply` and warns/halts if running on battery power.
- `clean_after_update`: If `true`, runs `autoremove` automatically after successful updates.
- `auto_reboot`: When `true`, automatically triggers reboot if a kernel or core system component was upgraded.
- `exclude_packages`: List of package names or glob patterns to skip during update transactions.
- `security_only`: When `true`, restricts all update operations strictly to security patches.
- `update_flatpak`: When `true`, executes `flatpak update -y` after OS packages update if flatpak is installed.
---
@@ -136,6 +144,13 @@ linux-updater health --json
"message": "No pending system reboot detected.",
"can_remediate": false,
"remediation_id": null
},
{
"name": "package_db",
"status": "PASS",
"message": "Package database is consistent.",
"can_remediate": false,
"remediation_id": null
}
],
"remediations_performed": []
@@ -174,19 +189,38 @@ esac
## 4. Log Management & Logrotate
By default, logs are written to `/var/log/linux-updater/` with:
By default, logs are written to `/var/log/linux-updater/` conforming to Linux FHS:
- Timestamped files: `linux-updater-YYYYMMDD-HHMMSS.log`
- Symlink to latest run: `/var/log/linux-updater/latest.log`
To manage historical logs and compress older runs, configure `/etc/logrotate.d/linux-updater`:
The package installation automatically provides `/etc/logrotate.d/linux-updater`:
```text
/var/log/linux-updater/*.log {
weekly
rotate 12
rotate 4
compress
missingok
notifempty
create 0640 root root
}
```
---
## 5. Shell Tab Autocompletion Deployment
For administrative workstations and fleet servers, shell completions can be automatically deployed:
- **System-wide Bash:** `/usr/share/bash-completion/completions/linux-updater`
- **System-wide Zsh:** `/usr/share/zsh/site-functions/_linux-updater` (or `/usr/share/zsh/vendor-completions/_linux-updater`)
Both files are automatically placed when installing via `.deb`, `.rpm`, or `install.sh`. Administrators can also dynamically output and evaluate them:
```bash
# Bash:
linux-updater completion bash > /etc/bash_completion.d/linux-updater
# Zsh:
linux-updater completion zsh > /usr/local/share/zsh/site-functions/_linux-updater
```
+7 -5
View File
@@ -16,9 +16,11 @@ linux_updater/
├── config.py # JSON configuration loader & default thresholds
├── models.py # Core data transfer objects (DistroInfo, CheckResult, etc.)
├── core/
│ ├── completion.py # Shell autocompletion script generator (Bash & Zsh)
│ ├── detector.py # Distro detection via /etc/os-release parsing
│ ├── health.py # Pre-flight health diagnostics & lock checking
│ ├── remediation.py # Automated remediation actions (cache, stale locks)
│ ├── health.py # Pre-flight health diagnostics & package DB checking
│ ├── lock.py # Concurrency advisory singleton lock
│ ├── remediation.py # Automated remediation actions (cache, stale locks, db repair)
│ └── runner.py # Subprocess runner with timestamped file logging
└── managers/
├── __init__.py # get_manager() factory
@@ -149,6 +151,6 @@ python3 packaging/build_packages.py
```
Generated artifacts:
- `dist/linux-updater-1.3.0.tar.gz`: Standalone distribution archive containing `install.sh`.
- `dist/linux-updater_1.3.0_all.deb`: Native Debian/Ubuntu binary package.
- `dist/rpm/RPMS/noarch/linux-updater-1.3.0-1.*.noarch.rpm`: Native RPM package.
- `dist/linux-updater-2.0.0.tar.gz`: Standalone distribution archive containing `install.sh`.
- `dist/linux-updater_2.0.0_all.deb`: Native Debian/Ubuntu binary package.
- `dist/rpm/RPMS/noarch/linux-updater-2.0.0-1.*.noarch.rpm`: Native RPM package.
@@ -15,6 +15,13 @@
- [x] Slice 7 — safety guardrails: root privilege check on mutating commands & singleton concurrency flock
- [x] Slice 8 — upgrade dependency auto-installation (ELevate/Leapp/dnf-plugins-core) & container test suites (AlmaLinux 9, Arch Linux)
## v2.0.0 Slices (Enterprise Modernization)
- [x] Slice 9 — Shell tab completion: static Bash & Zsh completions, generator command `linux-updater completion [bash|zsh]`, and package deployment
- [x] Slice 10 — Package filtering & Security-only updates: `--exclude` (patterns/pins) and `--security` flag across apt, dnf, pacman
- [x] Slice 11 — Pre-flight package DB consistency: `check_package_db` health check with automated transaction repair (dpkg --configure -a)
- [x] Slice 12 — Flatpak support & Logrotate: optional `--flatpak` post-update trigger and `/etc/logrotate.d/linux-updater` configuration
- [x] Slice 13 — Version bump to 2.0.0, documentation update (guides, man page Section 8), and package rebuild (.deb, .rpm, .tar.gz)
## Notes for a fresh session
- Project: Multi-distribution Linux system updater in Python.
- Process: Software Factory 4-gate workflow.
+39 -2
View File
@@ -27,7 +27,7 @@ linux-updater health
**Example Output:**
```text
Linux System Updater v1.3.0
Linux System Updater v2.0.0
Detected System: Ubuntu 24.04.1 LTS (Family: debian)
Pre-flight Health Diagnostics:
@@ -40,6 +40,7 @@ Pre-flight Health Diagnostics:
[ PASS ] lock_lock No lock active at /var/lib/apt/lists/lock
[ PASS ] memory_available Available RAM is sufficient: 7850MB
[ PASS ] pending_reboot No pending system reboot detected.
[ PASS ] package_db Package database is consistent.
-----------------------------------------------------------------
Overall Pre-flight Status: PASSED
```
@@ -53,7 +54,7 @@ linux-updater check
**Example Output:**
```text
Linux System Updater v1.3.0
Linux System Updater v2.0.0
Detected System: Fedora Linux 40 (Family: rhel)
Checking available updates...
@@ -91,6 +92,42 @@ If you only want to upgrade specific software (e.g. security patches for OpenSSL
sudo linux-updater update --packages openssl nginx
```
### Security-Only Updates (`--security`)
To restrict updates solely to security patches and CVE advisories (supported on RHEL, Fedora, CentOS, Rocky, AlmaLinux, Debian, and Ubuntu):
```bash
sudo linux-updater update --security
```
### Excluding Packages (`--exclude`)
To exclude specific packages or glob patterns from being upgraded (e.g., pinning kernels, proprietary drivers, or database servers):
```bash
sudo linux-updater update --exclude "kernel*" "nvidia*"
```
### Flatpak Application Updates (`--flatpak`)
If you use Flatpak for desktop applications or isolated utilities, pass `--flatpak` to automatically update all Flatpaks after operating system packages have updated:
```bash
sudo linux-updater update --flatpak
```
### Shell Tab Autocompletion (`completion`)
`linux-updater` provides zero-latency static tab completion for both Bash and Zsh. Subcommands, flags, and JSON configuration files auto-complete upon pressing `<Tab>`:
```bash
# Enable completion in current Bash shell:
eval "$(linux-updater completion bash)"
# Enable completion in current Zsh shell:
eval "$(linux-updater completion zsh)"
# Permanently install into user profile:
linux-updater completion bash >> ~/.bashrc
linux-updater completion zsh >> ~/.zshrc
```
### Simulation / Dry Run (`--dry-run`)
To simulate the complete update transaction without changing package states: