Compare commits

..

No commits in common. "main" and "v0.80" have entirely different histories.
main ... v0.80

16 changed files with 221 additions and 263 deletions

6
.gitignore vendored
View file

@ -1,5 +1,5 @@
.gitignore.swp
debug*/
target*/
release*/
osupdater/debug*/
osupdater/target*/
osupdater/release*/

View file

@ -1,27 +1,13 @@
# 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
* Made git repository public
* Public git repo
* 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
* 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)
* All components of the code are now functions, which means a bit more flexibility and reliability.d
## 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. No new functionality, no lost functionality.
Initial conversion from the python version.

View file

@ -25,7 +25,8 @@ Prior to releasing a v1.0, I will need the following features for the CLI versio
| File | Function |
| :--| :-- |
| ./src | rust source |
| ./antiquated/ | bash & python source |
| ./osupdater/ | rust source |
| ./rust_build_osupdater.sh | bash script to build the source |
## **TESTED ENVIRONMENTS**
@ -56,7 +57,7 @@ Trusted contributors will count as a passed/failed contributor test.
|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.
@ -191,8 +192,6 @@ or
* 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.

BIN
antiquated/assets/arch.png Normal file

Binary file not shown.

After

Width:  |  Height:  |  Size: 14 KiB

BIN
antiquated/assets/deb.png Normal file

Binary file not shown.

After

Width:  |  Height:  |  Size: 24 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 24 KiB

BIN
antiquated/assets/rpm.png Normal file

Binary file not shown.

After

Width:  |  Height:  |  Size: 12 KiB

BIN
antiquated/assets/snap.png Normal file

Binary file not shown.

After

Width:  |  Height:  |  Size: 7.6 KiB

116
antiquated/bash/osupdater.sh Executable file
View file

@ -0,0 +1,116 @@
#!/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

52
antiquated/python/osupdater.py Executable file
View file

@ -0,0 +1,52 @@
#!/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()

View file

@ -1,17 +0,0 @@
[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
osupdater.d Normal file
View file

@ -0,0 +1 @@
/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

View file

@ -1,12 +1,12 @@
# This file is automatically @generated by Cargo.
# It is not intended for manual editing.
version = 4
version = 3
[[package]]
name = "anstream"
version = "0.6.18"
version = "0.6.15"
source = "registry+https://github.com/rust-lang/crates.io-index"
checksum = "8acc5369981196006228e28809f761875c0327210a891e941f4c683b3a99529b"
checksum = "64e15c1ab1f89faffbf04a634d5e1962e9074f2741eef6d97f3c4e322426d526"
dependencies = [
"anstyle",
"anstyle-parse",
@ -19,33 +19,33 @@ dependencies = [
[[package]]
name = "anstyle"
version = "1.0.10"
version = "1.0.8"
source = "registry+https://github.com/rust-lang/crates.io-index"
checksum = "55cc3b69f167a1ef2e161439aa98aed94e6028e5f9a59be9a6ffb47aef1651f9"
checksum = "1bec1de6f59aedf83baf9ff929c98f2ad654b97c9510f4e70cf6f661d49fd5b1"
[[package]]
name = "anstyle-parse"
version = "0.2.6"
version = "0.2.5"
source = "registry+https://github.com/rust-lang/crates.io-index"
checksum = "3b2d16507662817a6a20a9ea92df6652ee4f94f914589377d69f3b21bc5798a9"
checksum = "eb47de1e80c2b463c735db5b217a0ddc39d612e7ac9e2e96a5aed1f57616c1cb"
dependencies = [
"utf8parse",
]
[[package]]
name = "anstyle-query"
version = "1.1.2"
version = "1.1.1"
source = "registry+https://github.com/rust-lang/crates.io-index"
checksum = "79947af37f4177cfead1110013d678905c37501914fba0efea834c3fe9a8d60c"
checksum = "6d36fc52c7f6c869915e99412912f22093507da8d9e942ceaf66fe4b7c14422a"
dependencies = [
"windows-sys",
]
[[package]]
name = "anstyle-wincon"
version = "3.0.6"
version = "3.0.4"
source = "registry+https://github.com/rust-lang/crates.io-index"
checksum = "2109dbce0e72be3ec00bed26e6a7479ca384ad226efdd66db8fa2e3a38c83125"
checksum = "5bf74e1b6e971609db8ca7a9ce79fd5768ab6ae46441c572e46cf596f59e57f8"
dependencies = [
"anstyle",
"windows-sys",
@ -53,9 +53,9 @@ dependencies = [
[[package]]
name = "clap"
version = "4.5.23"
version = "4.5.19"
source = "registry+https://github.com/rust-lang/crates.io-index"
checksum = "3135e7ec2ef7b10c6ed8950f0f792ed96ee093fa088608f1c76e569722700c84"
checksum = "7be5744db7978a28d9df86a214130d106a89ce49644cbc4e3f0c22c3fba30615"
dependencies = [
"clap_builder",
"clap_derive",
@ -63,9 +63,9 @@ dependencies = [
[[package]]
name = "clap_builder"
version = "4.5.23"
version = "4.5.19"
source = "registry+https://github.com/rust-lang/crates.io-index"
checksum = "30582fc632330df2bd26877bde0c1f4470d57c582bbc070376afcd04d8cb4838"
checksum = "a5fbc17d3ef8278f55b282b2a2e75ae6f6c7d4bb70ed3d0382375104bfafdb4b"
dependencies = [
"anstream",
"anstyle",
@ -87,24 +87,24 @@ dependencies = [
[[package]]
name = "clap_lex"
version = "0.7.4"
version = "0.7.2"
source = "registry+https://github.com/rust-lang/crates.io-index"
checksum = "f46ad14479a25103f283c0f10005961cf086d8dc42205bb44c46ac563475dca6"
checksum = "1462739cb27611015575c0c11df5df7601141071f07518d56fcc1be504cbec97"
[[package]]
name = "color-print"
version = "0.3.7"
version = "0.3.6"
source = "registry+https://github.com/rust-lang/crates.io-index"
checksum = "3aa954171903797d5623e047d9ab69d91b493657917bdfb8c2c80ecaf9cdb6f4"
checksum = "1ee543c60ff3888934877a5671f45494dd27ed4ba25c6670b9a7576b7ed7a8c0"
dependencies = [
"color-print-proc-macro",
]
[[package]]
name = "color-print-proc-macro"
version = "0.3.7"
version = "0.3.6"
source = "registry+https://github.com/rust-lang/crates.io-index"
checksum = "692186b5ebe54007e45a59aea47ece9eb4108e141326c304cdc91699a7118a22"
checksum = "77ff1a80c5f3cb1ca7c06ffdd71b6a6dd6d8f896c42141fbd43f50ed28dcdb93"
dependencies = [
"nom",
"proc-macro2",
@ -114,21 +114,9 @@ dependencies = [
[[package]]
name = "colorchoice"
version = "1.0.3"
version = "1.0.2"
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"
checksum = "d3fd119d74b830634cea2a0f58bbd0d54540518a14397557951e79340abc28c0"
[[package]]
name = "heck"
@ -136,16 +124,6 @@ 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"
@ -176,19 +154,17 @@ dependencies = [
[[package]]
name = "osupdater"
version = "0.9.1"
version = "0.8.0"
dependencies = [
"clap",
"color-print",
"serde",
"toml",
]
[[package]]
name = "proc-macro2"
version = "1.0.92"
version = "1.0.87"
source = "registry+https://github.com/rust-lang/crates.io-index"
checksum = "37d3544b3f2748c54e147655edb5025752e2303145b5aefb3c3ea2c78b973bb0"
checksum = "b3e4daa0dcf6feba26f985457cdf104d4b4256fc5a09547140f3631bb076b19a"
dependencies = [
"unicode-ident",
]
@ -202,35 +178,6 @@ 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"
@ -239,54 +186,20 @@ checksum = "7da8b5736845d9f2fcb837ea5d9e2628564b3b043a70948a3f0b778838c5fb4f"
[[package]]
name = "syn"
version = "2.0.91"
version = "2.0.79"
source = "registry+https://github.com/rust-lang/crates.io-index"
checksum = "d53cbcb5a243bd33b7858b1d7f4aca2153490815872d86d955d6ea29f743c035"
checksum = "89132cd0bf050864e1d38dc3bbc07a0eb8e7530af26344d3d2bbbef83499f590"
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"
version = "1.0.13"
source = "registry+https://github.com/rust-lang/crates.io-index"
checksum = "adb9e6ca4f869e1180728b7950e35922a7fc6397f7b641499e8f3ef06e50dc83"
checksum = "e91b56cd4cadaeb79bbf1a5645f6b4f8dc5bde8834ad5894a8db35fda9efa1fe"
[[package]]
name = "utf8parse"
@ -296,9 +209,9 @@ checksum = "06abde3611657adf66d383f00b093d7faecc7fa57071cce2578660c9f1010821"
[[package]]
name = "windows-sys"
version = "0.59.0"
version = "0.52.0"
source = "registry+https://github.com/rust-lang/crates.io-index"
checksum = "1e38bc4d79ed67fd075bcc251a1c39b32a1776bbe92e5bef1f0bf1f8c531853b"
checksum = "282be5f36a8ce781fad8c8ae18fa3f9beff57ec1b52cb3de0789201425d9a33d"
dependencies = [
"windows-targets",
]
@ -366,12 +279,3 @@ 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",
]

View file

@ -1,6 +1,6 @@
[package]
name = "osupdater"
version = "0.9.1"
version = "0.8.0"
edition = "2021"
# See more keys and their definitions at https://doc.rust-lang.org/cargo/reference/manifest.html
@ -8,5 +8,3 @@ edition = "2021"
[dependencies]
clap = { version = "4.5.18", features = ["cargo", "derive"] }
color-print = "0.3.5"
serde = "1.0.217"
toml = "0.8.19"

View file

@ -3,13 +3,7 @@ use std::path::{Path};
use color_print::{cprintln};
use clap::{command, Arg, ArgAction};
//use std::fs::File;
//use std::io::Write;
//use serde::Serialize;
//use toml::to_string;
const VERSION: &'static str = "0.9.1";
const VERSION: &'static str = "0.8";
fn trim_newline(s: &mut String) {
if s.ends_with('\n') {
@ -20,35 +14,6 @@ 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();
@ -141,6 +106,11 @@ fn update_flatpak() {
let mut sudo_bin = String::from_utf8(find_sudo.stdout).unwrap();
trim_newline(&mut sudo_bin);
let find_sudo = Command::new("which")
.arg("sudo").stdout(Stdio::piped()).output().unwrap();
let mut sudo_bin = String::from_utf8(find_sudo.stdout).unwrap();
trim_newline(&mut sudo_bin);
let find_flatpak = Command::new("which")
.arg("flatpak").stdout(Stdio::piped()).output().unwrap();
let mut flatpak_bin = String::from_utf8(find_flatpak.stdout).unwrap();
@ -168,37 +138,6 @@ fn update_flatpak() {
}
}
fn update_firmware() {
let find_sudo = Command::new("which")
.arg("sudo").stdout(Stdio::piped()).output().unwrap();
let mut sudo_bin = String::from_utf8(find_sudo.stdout).unwrap();
trim_newline(&mut sudo_bin);
let find_fwupdmgr = Command::new("which")
.arg("fwupdmgr").stdout(Stdio::piped()).output().unwrap();
let mut fwupdmgr_bin = String::from_utf8(find_fwupdmgr.stdout).unwrap();
trim_newline(&mut fwupdmgr_bin);
let path = Path::new(&fwupdmgr_bin);
if path.exists(){
cprintln!("<bold><rev>osupdater: Updating firware db</rev></bold>");
let mut cmd =
Command::new(&sudo_bin)
.arg(&fwupdmgr_bin).arg("refresh").arg("-y").arg("--force")
.stdout(Stdio::inherit()).stderr(Stdio::inherit())
.spawn().unwrap();
let _output = cmd.wait();
cprintln!("<bold><rev>osupdater: Updating firware</rev></bold>");
let mut cmd =
Command::new(&sudo_bin)
.arg(&fwupdmgr_bin).arg("get-updates").arg("-y")
.stdout(Stdio::inherit()).stderr(Stdio::inherit())
.spawn().unwrap();
let _output = cmd.wait();
}
}
fn update_pacman() {
let find_sudo = Command::new("which")
.arg("sudo").stdout(Stdio::piped()).output().unwrap();
@ -392,10 +331,6 @@ fn update_all() {
cprintln!("<bold><rev>osupdater: Checking containers</rev></bold>");
update_distrobox();
update_podman();
// Update firmware
cprintln!("<bold><rev>osupdater: Checking firmware</rev></bold>");
update_firmware();
}
fn main() {
@ -403,20 +338,6 @@ 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();
@ -428,7 +349,7 @@ fn main() {
.arg(
Arg::new("UPDATE_TOOL")
.help("What updater to run")
.value_parser(["all", "apt", "distrobox", "dnf", "flatpak", "firmware", "pacman","podman", "python","snap", "urpmi", "zypper"])
.value_parser(["all", "apt", "distrobox", "dnf", "flatpak", "pacman","podman", "python","snap", "urpmi", "zypper"])
.required(false)
.default_value("all")
.action(ArgAction::Append)
@ -466,10 +387,6 @@ fn main() {
update_flatpak()
}
if args.contains(&"firmware") {
update_firmware()
}
if args.contains(&"pacman") {
update_pacman()
}

View file

@ -1,6 +1,8 @@
#!/bin/sh
echo -e "Cleaning up build environment"
rm -rf target/
rm -rf osupdater/target
echo -e "Entering build directory\n"
cd osupdater/
echo -e "Building osupdater\n"
cargo build -r --jobs $(nproc)
#echo -e "Copying binary to git root\n"