Beginnings of user input for autoupdating.
This commit is contained in:
parent
5b5894be85
commit
99c88b7b32
3 changed files with 58 additions and 1 deletions
48
osupdater/Cargo.lock
generated
48
osupdater/Cargo.lock
generated
|
@ -2,6 +2,15 @@
|
|||
# It is not intended for manual editing.
|
||||
version = 3
|
||||
|
||||
[[package]]
|
||||
name = "aho-corasick"
|
||||
version = "1.1.3"
|
||||
source = "registry+https://github.com/rust-lang/crates.io-index"
|
||||
checksum = "8e60d3430d3a69478ad0993f19238d2df97c507009a52b3c10addcd7f6bcb916"
|
||||
dependencies = [
|
||||
"memchr",
|
||||
]
|
||||
|
||||
[[package]]
|
||||
name = "color-print"
|
||||
version = "0.3.6"
|
||||
|
@ -23,6 +32,15 @@ dependencies = [
|
|||
"syn",
|
||||
]
|
||||
|
||||
[[package]]
|
||||
name = "input_validation"
|
||||
version = "0.1.2"
|
||||
source = "registry+https://github.com/rust-lang/crates.io-index"
|
||||
checksum = "be9a9b3bc3525ea1e1737b1f8b835c41041e73641fecc592636e1bd2d1d1c4c0"
|
||||
dependencies = [
|
||||
"regex",
|
||||
]
|
||||
|
||||
[[package]]
|
||||
name = "memchr"
|
||||
version = "2.7.2"
|
||||
|
@ -50,6 +68,7 @@ name = "osupdater"
|
|||
version = "0.1.0"
|
||||
dependencies = [
|
||||
"color-print",
|
||||
"input_validation",
|
||||
]
|
||||
|
||||
[[package]]
|
||||
|
@ -70,6 +89,35 @@ dependencies = [
|
|||
"proc-macro2",
|
||||
]
|
||||
|
||||
[[package]]
|
||||
name = "regex"
|
||||
version = "1.10.5"
|
||||
source = "registry+https://github.com/rust-lang/crates.io-index"
|
||||
checksum = "b91213439dad192326a0d7c6ee3955910425f441d7038e0d6933b0aec5c4517f"
|
||||
dependencies = [
|
||||
"aho-corasick",
|
||||
"memchr",
|
||||
"regex-automata",
|
||||
"regex-syntax",
|
||||
]
|
||||
|
||||
[[package]]
|
||||
name = "regex-automata"
|
||||
version = "0.4.7"
|
||||
source = "registry+https://github.com/rust-lang/crates.io-index"
|
||||
checksum = "38caf58cc5ef2fed281f89292ef23f6365465ed9a41b7a7754eb4e26496c92df"
|
||||
dependencies = [
|
||||
"aho-corasick",
|
||||
"memchr",
|
||||
"regex-syntax",
|
||||
]
|
||||
|
||||
[[package]]
|
||||
name = "regex-syntax"
|
||||
version = "0.8.4"
|
||||
source = "registry+https://github.com/rust-lang/crates.io-index"
|
||||
checksum = "7a66a03ae7c801facd77a29370b4faec201768915ac14a721ba36f20bc9c209b"
|
||||
|
||||
[[package]]
|
||||
name = "syn"
|
||||
version = "2.0.66"
|
||||
|
|
|
@ -7,3 +7,4 @@ edition = "2021"
|
|||
|
||||
[dependencies]
|
||||
color-print = "0.3.5"
|
||||
input_validation = "0.1.2"
|
||||
|
|
|
@ -1,6 +1,8 @@
|
|||
use std::process::{Command, Stdio};
|
||||
use std::path::Path;
|
||||
use color_print::cprintln;
|
||||
//use std::io::{stdin,stdout,Write};
|
||||
use input_validation::{get_choice};
|
||||
|
||||
fn trim_newline(s: &mut String) {
|
||||
if s.ends_with('\n') {
|
||||
|
@ -19,6 +21,13 @@ fn main() {
|
|||
// Tell user that we are going to start the update procedure
|
||||
cprintln!("<bold><rev>osupdater : This tool will locate and run any package/container managers on your system.</rev></bold>\n");
|
||||
cprintln!("<bold><rev>Looking for native package managers.</rev></bold>\n");
|
||||
|
||||
//Figure out if the program should ask if an update tool should be run
|
||||
//let autoupdate_choices = vec!["Y","N"];
|
||||
//let autoupdate_index = get_choice("Shall the application autorun each update tool?", &autoupdate_choices);
|
||||
//println!("Selection was {}", autoupdate_choices[autoupdate_index]);
|
||||
|
||||
//Find if binaries exist and their location
|
||||
let find_sudo = Command::new("which")
|
||||
.arg("sudo").stdout(Stdio::piped()).output().unwrap();
|
||||
let mut sudo_bin = String::from_utf8(find_sudo.stdout).unwrap();
|
||||
|
@ -160,7 +169,6 @@ fn main() {
|
|||
// Check container formats
|
||||
cprintln!("<bold><rev>Checking application containers</rev></bold>");
|
||||
|
||||
|
||||
// flatpak
|
||||
let path = Path::new(&flatpak_bin);
|
||||
if path.exists(){
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue