Compare commits
10 commits
00f8297b1c
...
c6c2a89eb2
Author | SHA1 | Date | |
---|---|---|---|
c6c2a89eb2 | |||
8e45b2b65a | |||
74de77b68c | |||
e516aae5be | |||
35dd621858 | |||
6c8ee72994 | |||
656b20f540 | |||
cdc1df3e3f | |||
78eaf0d719 | |||
f91fd1a19b |
17 changed files with 191 additions and 422 deletions
6
.gitignore
vendored
6
.gitignore
vendored
|
@ -1,5 +1,5 @@
|
|||
.gitignore.swp
|
||||
|
||||
osupdater/debug*/
|
||||
osupdater/target*/
|
||||
osupdater/release*/
|
||||
debug*/
|
||||
target*/
|
||||
release*/
|
||||
|
|
236
1q
236
1q
|
@ -1,236 +0,0 @@
|
|||
# **osupdater**
|
||||
|
||||
## **ABOUT**
|
||||
A terminal rust application for figuring out what package manager(s) are present on your system and use them to update your software packages.
|
||||
|
||||
This is for my educational purposes of learning rust to do tasks that I have done successfully in either bash or C/C++. Feel free to snatch this up or not.
|
||||
|
||||
Take note that currently, all the used update tools' parameters are hard coded. Down the line, I will incorporate a config file that will have these hardcoded settings as the defaults. Until then, to change said parameters, you _will_ need to edit the source.
|
||||
|
||||
## 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)
|
||||
|
||||
* [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
|
||||
|
||||
* Central server for shared configs
|
||||
* GUI tool that is identical to the CLI version in functionality
|
||||
* Theming
|
||||
|
||||
## **FILES**
|
||||
|
||||
| File | Function |
|
||||
| :--| :-- |
|
||||
| ./antiquated/ | bash & python source |
|
||||
| ./osupdater/ | rust source |
|
||||
| ./rust_build_osupdater.sh | bash script to build the source |
|
||||
|
||||
## **TESTED ENVIRONMENTS**
|
||||
|
||||
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 better and native tests best.
|
||||
|
||||
Trusted contributors will count as a passed/failed contributor test.
|
||||
|
||||
|DISTRIBUTION|PERSONALLY TESTED|CONTRIBUTOR TESTED|
|
||||
| :-- | :-- | :-- |
|
||||
|Arch|distrobox|no|
|
||||
|Debian|distrobox|yes - tswamp|
|
||||
|OpenMandriva / Mageia|no|no|
|
||||
|RHEL / Fedora|yes|yes|
|
||||
|SuSE/ OpenSuSE|yes|no|
|
||||
|Ubuntu|distrobox|no|
|
||||
|
||||
|
||||
|CONTAINER TYPE|PERSONALLY TESTED|CONTRIBUTOR TESTED|
|
||||
| :-- | :-- | :-- |
|
||||
|Distrobox|yes|no|
|
||||
|Flatpak|yes|no|
|
||||
|Podman|yes|no|
|
||||
|Snap|yes|no|
|
||||
|
||||
|OTHER TOOLS|PERSONALLY TESTED|CONTRIBUTOR TESTED|
|
||||
| :-- | :-- | :-- |
|
||||
|Python via pip-review|yes|no|
|
||||
|Firmware via fwupdmgr|yes|no|
|
||||
|
||||
## **COMPILATION**
|
||||
In the repo there is a build script that will build things for you. To do so follow the instructions below to setup your build environment. You can also use __**cargo**__ to build and install as well, but again, the build environment will need to be setup.
|
||||
|
||||
### **BUILD ENVIRONMENT**
|
||||
|
||||
To compile the application you will need to have rust and cargo installed.
|
||||
|
||||
#### **ARCH & DERIVATIVES**
|
||||
|
||||
```
|
||||
sudo pacman -Sy rust
|
||||
rustup default stable
|
||||
```
|
||||
|
||||
#### **DEBIAN & DERIVATIVES**
|
||||
|
||||
The [official documentation from Debian](https://wiki.debian.org/Rust) states one can either install the apt packages or use the [official rustup installer](https://www.rust-lang.org/tools/install).
|
||||
|
||||
Using apt packages for Debian 12+ (my used and tested method):
|
||||
|
||||
```
|
||||
sudo apt update -y
|
||||
sudo apt upgrade -y
|
||||
sudo apt install rustc cargo rustfmt -y
|
||||
```
|
||||
|
||||
Using rustup (required for Debian 11.x and older):
|
||||
|
||||
```
|
||||
sudo apt update -y
|
||||
sudo apt upgrade -y
|
||||
sudo apt install curl build-essential gcc make -y
|
||||
curl --proto '=https' --tlsv1.2 -sSf https://sh.rustup.rs | sh
|
||||
```
|
||||
|
||||
The final command above will pull in and run the installer. Follow the prompts on screen.
|
||||
|
||||
#### **OPENMANDRIVA/MAGEIA (UNTESTED)**
|
||||
|
||||
```
|
||||
sudo urpmi update
|
||||
sudo urpmi install gcc curl make
|
||||
curl --proto '=https' --tlsv1.2 -sSf https://sh.rustup.rs | sh
|
||||
```
|
||||
|
||||
#### **RHEL/FEDORA**
|
||||
|
||||
```
|
||||
sudo dnf install rust cargo -y
|
||||
```
|
||||
|
||||
#### **SUSE/OPENSUSE**
|
||||
|
||||
The [official documentation from OpenSuSE.org](https://en.opensuse.org/Rust) states to use rustup, so here it is:
|
||||
|
||||
```
|
||||
sudo zypper install rustup -y && rustup toolchain install stable
|
||||
```
|
||||
|
||||
### **INSTALLATION VIA CARGO**
|
||||
As of right now I have not published anything to crates.io or anything similar. So as of right now you can do a:
|
||||
|
||||
cargo install --git https://git.schotty.com/andrew/osupdater.git
|
||||
|
||||
This will download the repo, compile, and install the binary in __**~/.cargo/bin/**__, so ensure if you use this method you have that path in your __**$PATH**__ environment variable.
|
||||
|
||||
### **GETTING SOURCE AND COMPILATION**
|
||||
To downloaded and then compile the program is done as follows:
|
||||
|
||||
```
|
||||
git clone https://git.schotty.com/andrew/osupdater
|
||||
cd osupdater
|
||||
./rust_build_osupdater.sh
|
||||
```
|
||||
|
||||
This should just build the application for you, providing you setup rust correctly. If you have issues compiling, double check that the toolchain is installed correctly for your platform. If the above instructions are insufficient, file a bug report and I can update them to include any missing instructions and/or caveats.
|
||||
|
||||
## **SCOPE & USAGE**
|
||||
|
||||
### **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.
|
||||
* 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. If the parameters are too conservative/aggressive -- edit the source or wait until I get custom parameters implemented.
|
||||
|
||||
### **RUNNING OSUPDATE**
|
||||
|
||||
Running the application is as simple as executing the ouput binary located at **osupdater/target/release/osupdater**
|
||||
|
||||
Depending on tastes, you can copy said binary to ~/.local/bin or any other location that is in your PATH.
|
||||
|
||||
The application will output whatever it does, and ignore any package managers that are not present on your system.
|
||||
|
||||
* To run all the tools:
|
||||
|
||||
osupdater
|
||||
|
||||
or
|
||||
|
||||
osupdater all
|
||||
|
||||
* To select one tool:
|
||||
|
||||
osupdater dnf
|
||||
|
||||
* To run several tools:
|
||||
|
||||
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
|
||||
|
||||
* **Firmware**
|
||||
* firmware (via fwupdmgr)
|
||||
## **NOTES**
|
||||
|
||||
During testing via distrobox, pip-review will fail if the host python version is not the same as the container. The tool will find the pip-review package, but be unable to execute due to a version mismatch.
|
||||
|
||||
### **DISTROBOX CONTAINERS USED FOR TESTING**
|
||||
|
||||
#### **USING DISTROBOX**
|
||||
|
||||
Starting container:
|
||||
```
|
||||
distrobox-create --name CONTAINER_NAME --image CONTAINER_URI
|
||||
distrobox-enter CONTAINER_NAME
|
||||
```
|
||||
|
||||
Entering container:
|
||||
```
|
||||
distrobox enter CONTAINER_NAME
|
||||
```
|
||||
|
||||
Stopping container:
|
||||
```
|
||||
podman stop CONTAINER_NAME
|
||||
podman rm CONTAINERF_NAME
|
||||
```
|
||||
|
||||
#### **CONTAINER URI'S**
|
||||
Arch:
|
||||
* quay.io/toolbx/arch-toolbox:latest
|
||||
|
||||
Debian:
|
||||
* quay.io/toolbx-images/debian-toolbox:latest
|
||||
* quay.io/toolbx/ubuntu-toolbox:latest
|
||||
|
||||
RHEL/Fedora:
|
||||
* quay.io/toolbx-images/almalinux-toolbox:latest
|
||||
* registry.fedoraproject.org/fedora-toolbox:40
|
||||
* quay.io/toolbx-images/rhel-toolbox:latest
|
||||
|
||||
SuSE/OpenSuSE:
|
||||
* registry.opensuse.org/opensuse/distrobox:latest
|
20
CHANGELOG.md
20
CHANGELOG.md
|
@ -1,13 +1,27 @@
|
|||
# 0.9.1
|
||||
## FIXES
|
||||
* Updated the firmware portion to force the db update
|
||||
|
||||
# 0.9
|
||||
## FEATURES
|
||||
* Added firmware updating via fwupdmgr
|
||||
|
||||
# 0.8.0
|
||||
Cumulative update of all the enhancements that are now in the rust version, but never made it into the bash/python3 version:
|
||||
|
||||
## FEATURES
|
||||
* Added proper cli handling via clap
|
||||
* Specify which updater(s) to use
|
||||
* Smart binary search and execution
|
||||
* Public git repo
|
||||
* Made git repository public
|
||||
* Proper documentation
|
||||
* Testing on alternate platforms, and the documentation on how to do so
|
||||
* All components of the code are now functions, which means a bit more flexibility and reliability.d
|
||||
* All components of the code are now functions, which means a bit more flexibility and reliability
|
||||
* Added various other updating tools. Now includes apt, dnf, pacman, zypper, flatpak (user and system), snap, podman (user and system), distrobox (user and system), python (user only)
|
||||
|
||||
## FIXES
|
||||
* Fixed dnf handling to not state dnf was found but using dnf5 instead. Fixed for f41, as dn5 is the only version, and dnf3 no longer is there but dnf is a symlink to dnf5
|
||||
* Cleaned up cli output. Not a permanent style, per se. However I am looking to simplify the code's requirements, meaning anything fancy will be removed. Cleaner output will be reworked a final time once logging is implemented.
|
||||
|
||||
# 0.1.0
|
||||
Initial conversion from the python version.
|
||||
Initial conversion from the python version. No new functionality, no lost functionality.
|
||||
|
|
102
osupdater/Cargo.lock → Cargo.lock
generated
102
osupdater/Cargo.lock → Cargo.lock
generated
|
@ -118,12 +118,34 @@ version = "1.0.3"
|
|||
source = "registry+https://github.com/rust-lang/crates.io-index"
|
||||
checksum = "5b63caa9aa9397e2d9480a9b13673856c78d8ac123288526c37d7839f2a86990"
|
||||
|
||||
[[package]]
|
||||
name = "equivalent"
|
||||
version = "1.0.1"
|
||||
source = "registry+https://github.com/rust-lang/crates.io-index"
|
||||
checksum = "5443807d6dff69373d433ab9ef5378ad8df50ca6298caf15de6e52e24aaf54d5"
|
||||
|
||||
[[package]]
|
||||
name = "hashbrown"
|
||||
version = "0.15.2"
|
||||
source = "registry+https://github.com/rust-lang/crates.io-index"
|
||||
checksum = "bf151400ff0baff5465007dd2f3e717f3fe502074ca563069ce3a6629d07b289"
|
||||
|
||||
[[package]]
|
||||
name = "heck"
|
||||
version = "0.5.0"
|
||||
source = "registry+https://github.com/rust-lang/crates.io-index"
|
||||
checksum = "2304e00983f87ffb38b55b444b5e3b60a884b5d30c0fca7d82fe33449bbe55ea"
|
||||
|
||||
[[package]]
|
||||
name = "indexmap"
|
||||
version = "2.7.0"
|
||||
source = "registry+https://github.com/rust-lang/crates.io-index"
|
||||
checksum = "62f822373a4fe84d4bb149bf54e584a7f4abec90e072ed49cda0edea5b95471f"
|
||||
dependencies = [
|
||||
"equivalent",
|
||||
"hashbrown",
|
||||
]
|
||||
|
||||
[[package]]
|
||||
name = "is_terminal_polyfill"
|
||||
version = "1.70.1"
|
||||
|
@ -154,10 +176,12 @@ dependencies = [
|
|||
|
||||
[[package]]
|
||||
name = "osupdater"
|
||||
version = "0.9.0"
|
||||
version = "0.9.1"
|
||||
dependencies = [
|
||||
"clap",
|
||||
"color-print",
|
||||
"serde",
|
||||
"toml",
|
||||
]
|
||||
|
||||
[[package]]
|
||||
|
@ -178,6 +202,35 @@ dependencies = [
|
|||
"proc-macro2",
|
||||
]
|
||||
|
||||
[[package]]
|
||||
name = "serde"
|
||||
version = "1.0.217"
|
||||
source = "registry+https://github.com/rust-lang/crates.io-index"
|
||||
checksum = "02fc4265df13d6fa1d00ecff087228cc0a2b5f3c0e87e258d8b94a156e984c70"
|
||||
dependencies = [
|
||||
"serde_derive",
|
||||
]
|
||||
|
||||
[[package]]
|
||||
name = "serde_derive"
|
||||
version = "1.0.217"
|
||||
source = "registry+https://github.com/rust-lang/crates.io-index"
|
||||
checksum = "5a9bf7cf98d04a2b28aead066b7496853d4779c9cc183c440dbac457641e19a0"
|
||||
dependencies = [
|
||||
"proc-macro2",
|
||||
"quote",
|
||||
"syn",
|
||||
]
|
||||
|
||||
[[package]]
|
||||
name = "serde_spanned"
|
||||
version = "0.6.8"
|
||||
source = "registry+https://github.com/rust-lang/crates.io-index"
|
||||
checksum = "87607cb1398ed59d48732e575a4c28a7a8ebf2454b964fe3f224f2afc07909e1"
|
||||
dependencies = [
|
||||
"serde",
|
||||
]
|
||||
|
||||
[[package]]
|
||||
name = "strsim"
|
||||
version = "0.11.1"
|
||||
|
@ -186,15 +239,49 @@ checksum = "7da8b5736845d9f2fcb837ea5d9e2628564b3b043a70948a3f0b778838c5fb4f"
|
|||
|
||||
[[package]]
|
||||
name = "syn"
|
||||
version = "2.0.90"
|
||||
version = "2.0.91"
|
||||
source = "registry+https://github.com/rust-lang/crates.io-index"
|
||||
checksum = "919d3b74a5dd0ccd15aeb8f93e7006bd9e14c295087c9896a110f490752bcf31"
|
||||
checksum = "d53cbcb5a243bd33b7858b1d7f4aca2153490815872d86d955d6ea29f743c035"
|
||||
dependencies = [
|
||||
"proc-macro2",
|
||||
"quote",
|
||||
"unicode-ident",
|
||||
]
|
||||
|
||||
[[package]]
|
||||
name = "toml"
|
||||
version = "0.8.19"
|
||||
source = "registry+https://github.com/rust-lang/crates.io-index"
|
||||
checksum = "a1ed1f98e3fdc28d6d910e6737ae6ab1a93bf1985935a1193e68f93eeb68d24e"
|
||||
dependencies = [
|
||||
"serde",
|
||||
"serde_spanned",
|
||||
"toml_datetime",
|
||||
"toml_edit",
|
||||
]
|
||||
|
||||
[[package]]
|
||||
name = "toml_datetime"
|
||||
version = "0.6.8"
|
||||
source = "registry+https://github.com/rust-lang/crates.io-index"
|
||||
checksum = "0dd7358ecb8fc2f8d014bf86f6f638ce72ba252a2c3a2572f2a795f1d23efb41"
|
||||
dependencies = [
|
||||
"serde",
|
||||
]
|
||||
|
||||
[[package]]
|
||||
name = "toml_edit"
|
||||
version = "0.22.22"
|
||||
source = "registry+https://github.com/rust-lang/crates.io-index"
|
||||
checksum = "4ae48d6208a266e853d946088ed816055e556cc6028c5e8e2b84d9fa5dd7c7f5"
|
||||
dependencies = [
|
||||
"indexmap",
|
||||
"serde",
|
||||
"serde_spanned",
|
||||
"toml_datetime",
|
||||
"winnow",
|
||||
]
|
||||
|
||||
[[package]]
|
||||
name = "unicode-ident"
|
||||
version = "1.0.14"
|
||||
|
@ -279,3 +366,12 @@ name = "windows_x86_64_msvc"
|
|||
version = "0.52.6"
|
||||
source = "registry+https://github.com/rust-lang/crates.io-index"
|
||||
checksum = "589f6da84c646204747d1270a2a5661ea66ed1cced2631d546fdfb155959f9ec"
|
||||
|
||||
[[package]]
|
||||
name = "winnow"
|
||||
version = "0.6.21"
|
||||
source = "registry+https://github.com/rust-lang/crates.io-index"
|
||||
checksum = "e6f5bb5257f2407a5425c6e749bfd9692192a73e70a6060516ac04f889087d68"
|
||||
dependencies = [
|
||||
"memchr",
|
||||
]
|
|
@ -1,6 +1,6 @@
|
|||
[package]
|
||||
name = "osupdater"
|
||||
version = "0.9.0"
|
||||
version = "0.9.1"
|
||||
edition = "2021"
|
||||
|
||||
# See more keys and their definitions at https://doc.rust-lang.org/cargo/reference/manifest.html
|
||||
|
@ -8,3 +8,5 @@ edition = "2021"
|
|||
[dependencies]
|
||||
clap = { version = "4.5.18", features = ["cargo", "derive"] }
|
||||
color-print = "0.3.5"
|
||||
serde = "1.0.217"
|
||||
toml = "0.8.19"
|
|
@ -25,8 +25,7 @@ Prior to releasing a v1.0, I will need the following features for the CLI versio
|
|||
|
||||
| File | Function |
|
||||
| :--| :-- |
|
||||
| ./antiquated/ | bash & python source |
|
||||
| ./osupdater/ | rust source |
|
||||
| ./src | rust source |
|
||||
| ./rust_build_osupdater.sh | bash script to build the source |
|
||||
|
||||
## **TESTED ENVIRONMENTS**
|
||||
|
|
Binary file not shown.
Before Width: | Height: | Size: 14 KiB |
Binary file not shown.
Before Width: | Height: | Size: 24 KiB |
Binary file not shown.
Before Width: | Height: | Size: 24 KiB |
Binary file not shown.
Before Width: | Height: | Size: 12 KiB |
Binary file not shown.
Before Width: | Height: | Size: 7.6 KiB |
|
@ -1,116 +0,0 @@
|
|||
#!/bin/bash
|
||||
|
||||
# Universal updater by Andrew Schott andrew@schotty.com
|
||||
# Will detect and update via various packaging formats for distros I currently use.
|
||||
|
||||
# Globals
|
||||
# edit as needed to set colors and soforth
|
||||
# presuming echo thus tput is chosen here as default\
|
||||
|
||||
# tput text formatting
|
||||
# bold=bold dim=dimmed
|
||||
# rev=reverse bel=bell sound
|
||||
# smul=underline on rmul=underline off
|
||||
# setaf=foreground setab=background
|
||||
# sgr0=clear
|
||||
#
|
||||
# Colors
|
||||
# 0 Black 1 Red 2 Green 3 Yellow
|
||||
# 4 Blue 5 Magenta 6 Cyan 7 White
|
||||
#
|
||||
# Default is
|
||||
# * green for a true finding
|
||||
# * yellow for a false finding
|
||||
# * clear at the end to resume normal output for said command's output
|
||||
|
||||
CMD_NOTIFY="tput rev bold setaf 7 setab 0"
|
||||
CMD_TRUE="tput rev bold setaf 2 setab 0"
|
||||
CMD_FALSE="tput rev bold setaf 1 setab 7"
|
||||
CMD_CLEAR="tput sgr0"
|
||||
|
||||
echo $($CMD_NOTIFY)"Looking for native package managers"$($CMD_CLEAR)
|
||||
|
||||
# apt -- Debian and derivatives
|
||||
if `which apt &> /dev/null 2>&1`
|
||||
then
|
||||
echo $($CMD_TRUE)"Found apt. Updating: ($(which apt))"$($CMD_CLEAR)
|
||||
sudo apt udate -y
|
||||
sudo apt upgrade -y
|
||||
else
|
||||
echo $($CMD_FALSE)"apt not found/needed"$($CMD_CLEAR)
|
||||
fi
|
||||
|
||||
# dnf -- RHEL 8+, Fedora, Openmandriva, and derivatives
|
||||
if `which dnf &> /dev/null 2>&1`
|
||||
then
|
||||
echo $($CMD_TRUE)"Found dnf. Updating: ($(which dnf))"$($CMD_CLEAR)
|
||||
sudo dnf --refresh --skip-broken --nobest -y update
|
||||
else
|
||||
echo $($CMD_FALSE)"dnf not found/needed"$($CMD_CLEAR)
|
||||
fi
|
||||
|
||||
# pacman -- arch & arch derivatives
|
||||
if `which pacman &> /dev/null 2>&1`
|
||||
then
|
||||
echo $($CMD_TRUE)"Found pacman. Updating: ($(which pacman))"$($CMD_CLEAR)
|
||||
sudo pacman -Syu
|
||||
else
|
||||
echo $($CMD_FALSE)"pacman not found/needed"$($CMD_CLEAR)
|
||||
fi
|
||||
|
||||
# yum -- RHEL 7 > (Ignored if dnf is present)
|
||||
if `which yum &> /dev/null 2>&1` && ! `which dnf &> /dev/null 2>&1`
|
||||
then
|
||||
echo $($CMD_TRUE)"Found yum. Updating: ($(which yum))"$($CMD_CLEAR)
|
||||
sudo yum --refresh --skip-broken --nobest -y update
|
||||
else
|
||||
echo $($CMD_FALSE)"yum not found/needed"$($CMD_CLEAR)
|
||||
fi
|
||||
|
||||
# urpmi -- Mageia
|
||||
if `which urpmi &> /dev/null 2>&1` && ! `which dnf &> /dev/null 2>&1`
|
||||
then
|
||||
echo $($CMD_TRUE)"Found urpmi. Updating: ($(which urpmi))"$($CMD_CLEAR)
|
||||
sudo urpmi --auto-update -y
|
||||
else
|
||||
echo $($CMD_FALSE)"urpmi not found/needed"$($CMD_CLEAR)
|
||||
fi
|
||||
|
||||
# zypper -- SuSE products
|
||||
if `which zypper &> /dev/null 2>&1`
|
||||
then
|
||||
echo $($CMD_TRUE)"Found zypper. Updating: ($(which zypper))"$($CMD_CLEAR)
|
||||
sudo zypper in -y
|
||||
else
|
||||
echo $($CMD_FALSE)"zypper not found/needed"$($CMD_CLEAR)
|
||||
fi
|
||||
|
||||
echo $($CMD_NOTIFY)"Looking for sandboxed package managers"$($CMD_CLEAR)
|
||||
|
||||
# flatpak
|
||||
if `which flatpak &> /dev/null 2>&1`
|
||||
then
|
||||
echo $($CMD_TRUE)"Found flatpak. Updating: ($(which flatpak))"$($CMD_CLEAR)
|
||||
flatpak update --user -y
|
||||
sudo flatpak update -y
|
||||
else
|
||||
echo $($CMD_FALSE)"flatpak not found/needed"$($CMD_CLEAR)
|
||||
fi
|
||||
|
||||
# snap
|
||||
if `which snap &> /dev/null 2>&1`
|
||||
then
|
||||
echo $($CMD_TRUE)"Found snap. Updating: ($(which snap))"$($CMD_CLEAR)
|
||||
sudo snap refresh -y
|
||||
else
|
||||
echo $($CMD_FALSE)"snap not found/needed"$($CMD_CLEAR)
|
||||
fi
|
||||
|
||||
# pip
|
||||
if `which pip-review &> /dev/null 2>&1`
|
||||
then
|
||||
echo $($CMD_TRUE)"Found pip-review. Updating: ($(pip-review))"$($CMD_CLEAR)
|
||||
pip-review --auto --local --user
|
||||
else
|
||||
echo $($CMD_FALSE)"pip-review not found/needed"$($CMD_CLEAR)
|
||||
fi
|
|
@ -1,52 +0,0 @@
|
|||
#!/usr/bin/env python
|
||||
|
||||
import wx
|
||||
import subprocess
|
||||
|
||||
|
||||
class Example(wx.Frame):
|
||||
def __init__(self, *args, **kwargs):
|
||||
super(Example, self).__init__(*args, **kwargs)
|
||||
|
||||
self.initui()
|
||||
|
||||
def initui(self):
|
||||
|
||||
menubar = wx.MenuBar()
|
||||
filemenu = wx.Menu()
|
||||
fileitem = filemenu.Append(wx.ID_EXIT, 'Quit', 'Quit application')
|
||||
menubar.Append(filemenu, '&File')
|
||||
self.SetMenuBar(menubar)
|
||||
|
||||
self.Bind(wx.EVT_MENU, self.onquit, fileitem)
|
||||
|
||||
self.SetSize((300, 200))
|
||||
self.SetTitle('OS Updater')
|
||||
self.Centre()
|
||||
|
||||
pnl = wx.Panel(self)
|
||||
updateflatpakbutton = wx.Button(pnl, label='Update Flatpaks', pos=(20, 20))
|
||||
updateflatpakbutton.Bind(wx.EVT_BUTTON, self.onflatpakupdate)
|
||||
updaterpmbutton = wx.Button(pnl, label='Update RPMs', pos=(20, 60))
|
||||
updaterpmbutton.Bind(wx.EVT_BUTTON, self.onrpmupdate)
|
||||
|
||||
def onflatpakupdate(self, e):
|
||||
subprocess.run(["flatpak", "update", "-y"])
|
||||
|
||||
def onrpmupdate(self, e):
|
||||
subprocess.run(["sudo", "dnf", "update", "-y"])
|
||||
|
||||
def onquit(self, e):
|
||||
self.Close()
|
||||
|
||||
|
||||
def main():
|
||||
|
||||
app = wx.App(0)
|
||||
ex = Example(None)
|
||||
ex.Show()
|
||||
app.MainLoop()
|
||||
|
||||
|
||||
if __name__ == '__main__':
|
||||
main()
|
17
config.template
Normal file
17
config.template
Normal file
|
@ -0,0 +1,17 @@
|
|||
[PackageManagers]
|
||||
apt = n
|
||||
dnf = y
|
||||
pacman = n
|
||||
python = n
|
||||
urpmi = n
|
||||
zypper = n
|
||||
|
||||
[Firmware]
|
||||
firmware = y
|
||||
|
||||
[Containers]
|
||||
distrobox = y
|
||||
flatpak = y
|
||||
podman = y
|
||||
snap = n
|
||||
|
|
@ -1 +0,0 @@
|
|||
/home/andrew/workspace/git_repos/osupdater/in_development/rust/osupdater/target/release/osupdater: /home/andrew/workspace/git_repos/osupdater/in_development/rust/osupdater/src/main.rs
|
|
@ -1,8 +1,6 @@
|
|||
#!/bin/sh
|
||||
echo -e "Cleaning up build environment"
|
||||
rm -rf osupdater/target
|
||||
echo -e "Entering build directory\n"
|
||||
cd osupdater/
|
||||
rm -rf target/
|
||||
echo -e "Building osupdater\n"
|
||||
cargo build -r --jobs $(nproc)
|
||||
#echo -e "Copying binary to git root\n"
|
||||
|
|
|
@ -3,7 +3,13 @@ use std::path::{Path};
|
|||
use color_print::{cprintln};
|
||||
use clap::{command, Arg, ArgAction};
|
||||
|
||||
const VERSION: &'static str = "0.999999999";
|
||||
//use std::fs::File;
|
||||
//use std::io::Write;
|
||||
//use serde::Serialize;
|
||||
//use toml::to_string;
|
||||
|
||||
|
||||
const VERSION: &'static str = "0.9.1";
|
||||
|
||||
fn trim_newline(s: &mut String) {
|
||||
if s.ends_with('\n') {
|
||||
|
@ -14,6 +20,35 @@ fn trim_newline(s: &mut String) {
|
|||
}
|
||||
}
|
||||
|
||||
/*fn toml_create_default () {
|
||||
#[derive(Serialize)]
|
||||
struct toml_data {
|
||||
config: PackageManagers,
|
||||
config: Firmware,
|
||||
config: Containers,
|
||||
}
|
||||
|
||||
struct PackageMangers {
|
||||
apt: bool,
|
||||
dnf: bool,
|
||||
pacman: bool,
|
||||
python: bool,
|
||||
urppmi: bool,
|
||||
zypper: bool,
|
||||
}
|
||||
|
||||
struct Firmware {
|
||||
firmware: bool
|
||||
}
|
||||
|
||||
struct Containers {
|
||||
distrobox: bool,
|
||||
flatpak: bool,
|
||||
podman: bool,
|
||||
snap: bool,
|
||||
}
|
||||
}*/
|
||||
|
||||
fn update_apt() {
|
||||
let find_sudo = Command::new("which")
|
||||
.arg("sudo").stdout(Stdio::piped()).output().unwrap();
|
||||
|
@ -149,7 +184,7 @@ fn update_firmware() {
|
|||
cprintln!("<bold><rev>osupdater: Updating firware db</rev></bold>");
|
||||
let mut cmd =
|
||||
Command::new(&sudo_bin)
|
||||
.arg(&fwupdmgr_bin).arg("refresh").arg("-y")
|
||||
.arg(&fwupdmgr_bin).arg("refresh").arg("-y").arg("--force")
|
||||
.stdout(Stdio::inherit()).stderr(Stdio::inherit())
|
||||
.spawn().unwrap();
|
||||
let _output = cmd.wait();
|
||||
|
@ -368,6 +403,19 @@ fn main() {
|
|||
// Clear terminal, and move cursor to 1,1 inside the terminal
|
||||
// print!("{esc}[2J{esc}[1;1H", esc = 27 as char);
|
||||
|
||||
// Check for default ini file's existence and
|
||||
// create new one if file does not exist
|
||||
let toml_exists = Path::new("~/.config/osupdater.toml").exists();
|
||||
if toml_exists == false {
|
||||
println!("No config file found");
|
||||
println!("Creating new config at : ~/.config/osupdater.toml");
|
||||
//toml_create_default ();
|
||||
} else if toml_exists == true {
|
||||
println!("Config file found at ~/.config/osupater.toml");
|
||||
}
|
||||
|
||||
// Parse ini
|
||||
|
||||
// Find sudo
|
||||
let find_sudo = Command::new("which")
|
||||
.arg("sudo").stdout(Stdio::piped()).output().unwrap();
|
Loading…
Add table
Add a link
Reference in a new issue