Added the ability to run two or more of the supported updaters rather than just one or all. Updated README.md to include new feature. Cleaned up most sections in README.md.

This commit is contained in:
Andrew Schott 2024-09-28 23:36:19 -05:00
parent b8cb797703
commit b3b9231554
3 changed files with 85 additions and 74 deletions

View file

@ -10,10 +10,10 @@ Take note that currently, all the used update tools' parameters are hard coded.
## v1.0 REQUIREMENTS
Prior to releasing a v1.0, I will need the following features for the CLI version (GUI version will need not exist, but is on the roadmap)
* [DONE] The smarts to not run an old version of a tool if a newer is purposefully installed. This is specifically aimed at dnf/dnf5
* [DONE] CLI flags to pick and choose what to update and what to skip
* Proper logging -- this means a datestamped file for each tool run plopped into /var/log/
* Stock parameters to be pulled from /etc/osupdater.conf or ~/.config/osupdater/osupdater.conf
* -[x] The smarts to not run an old version of a tool if a newer is purposefully installed. This is specifically aimed at dnf/dnf5
* -[x] CLI flags to pick and choose what to update and what to skip
* -[ ] Proper logging -- this means a datestamped file for each tool run plopped into /var/log/
* -[ ] Stock parameters to be pulled from /etc/osupdater.conf or ~/.config/osupdater/osupdater.conf
## THE ROADMAP : v1.1 AND BEYOND
@ -33,7 +33,7 @@ Prior to releasing a v1.0, I will need the following features for the CLI versio
Currently when I start work on distributions that I do not have a live environment to use or a VM available, I will use distrobox. Then, as time permits, I use VMs to test as a next best thing to a live environment.
Consider distrobox tests as the lowest grade pass, then VMs and native tests.
Consider distrobox tests as the lowest grade pass, then VMs better and native tests best.
Trusted contributors will count as a passed/failed contributor test.
@ -59,7 +59,7 @@ Trusted contributors will count as a passed/failed contributor test.
|Python via pip-review|yes|no|
## **COMPILING**
## **BUILD ENVIRONMENT**
To compile the application you will need to have rust and cargo installed.
@ -120,10 +120,10 @@ sudo zypper install rustup -y && rustup toolchain install stable
### **CURRENT SCOPE AND LIMITATIONS**
The current scope and intended use of the tool is:
* Not to be run as root -- be a regular user with sudo rights to run the package manager tools.
* __**Not**__ to be run as root -- be a __**regular**__ user with sudo rights to run the package manager tools.
* Currently custom parameters, logging, and other useful fancy stuff is not implemented. It will be, but not now.
* The testing has been done in a limited fashion. I have several Workstations, Laptops, VMs, VPS's, and contributors that are able to validate things. The testing matrix above has the details, play in a VM if your platform is untested (notably arch). I test first in distrobox, then if things work a VM or a contributor report.
* If you have any doubts as to what the hell is going on under the hood, look at the source or look at the bash or python versions. If the parameters are too conservative or aggressive -- edit the source or wait until I get custom parameters implemented.
* If you have any doubts as to what the hell is going on under the hood, look at the source. If the parameters are too conservative/aggressive -- edit the source or wait until I get custom parameters implemented.
### **GETTING SOURCE AND COMPILATION**
In order to use the application the source must be downloaded and then compiled.
@ -144,7 +144,7 @@ Depending on tastes, you can copy said binary to ~/.local/bin or any other locat
The application will output whatever it does, and ignore any package managers that are not present on your system.
To run all the tools:
* To run all the tools:
osupdater
@ -152,23 +152,34 @@ or
osupdater all
To select one tool:
* To select one tool:
osupdater dnf
Available updater tools supported:
* To run several tools:
* all
* apt
* dnf
* pacman
* urpmi
* zypper
* flatpak
* snap
* python
* distrobox
* podman
osupdater dnf flatpak distrobox
* Available updater tools supported:
* **Detect and run everything found**
* all
* **Package managers**
* apt
* dnf
* pacman
* urpmi
* zypper
* **Application sandboxes**
* flatpak
* python
* snap
* **Containers**
* distrobox
* podman
## **NOTES**

BIN
osupdater/src/.main.rs.swp Normal file

Binary file not shown.

View file

@ -1,7 +1,7 @@
use std::process::{Command, Stdio};
use std::path::{Path};
use color_print::{cprintln};
use clap::{command, arg, Arg, Parser};
use clap::{command, Arg, ArgAction};
fn trim_newline(s: &mut String) {
if s.ends_with('\n') {
@ -348,57 +348,57 @@ fn main() {
let matches = command!() // requires `cargo` feature
.arg(
arg!(<UPDATE_TOOL>)
.help("What updater to run")
.value_parser(["all", "apt", "dnf", "pacman", "urpmi", "zypper", "flatpak", "snap", "python", "distrobox", "podman"])
.required(false)
.default_value("all"),
)
.get_matches();
// Note, it's safe to call unwrap() because the arg is required
match matches
.get_one::<String>("UPDATE_TOOL")
.expect("'UPDATE_TOOL' is required, else all will be run.")
.as_str()
{
"all" => {
update_all();
}
"apt" => {
update_apt();
}
"dnf" => {
update_dnf();
}
"pacman" => {
update_pacman();
}
"urpmi" => {
update_urpmi();
}
"zypper" => {
update_zypper();
}
"flatpak" => {
update_flatpak();
}
"snap" => {
update_snap();
}
"python" => {
update_python();
}
"distrobox" => {
update_distrobox();
}
"podman" => {
update_podman();
}
_ => unreachable!(),
}
.arg(
Arg::new("UPDATE_TOOL")
.help("What updater to run")
.value_parser(["all", "apt", "distrobox", "dnf", "flatpak", "pacman","podman", "python","snap", "urpmi", "zypper"])
.required(false)
.default_value("all")
.action(ArgAction::Append)
,
)
.version("0.1")
.about("Update your OS packages, sandboxes, and containers via your present tools.")
.get_matches();
let args = matches
.get_many::<String>("UPDATE_TOOL")
.unwrap_or_default()
.map(|v| v.as_str())
.collect::<Vec<_>>();
if args.contains(&"all") {
update_all()
}
if args.contains(&"apt") {
update_apt()
}
if args.contains(&"distrobox") {
update_distrobox()
}
if args.contains(&"dnf") {
update_dnf()
}
if args.contains(&"flatpak") {
update_flatpak()
}
if args.contains(&"pacman") {
update_pacman()
}
if args.contains(&"podman") {
update_podman()
}
if args.contains(&"python") {
update_python()
}
if args.contains(&"snap") {
update_snap()
}
if args.contains(&"urpmi") {
update_urpmi()
}
if args.contains(&"zypper") {
update_zypper()
}
}