Replaced dependency on BASH with dependency on SH for GPU detection on *nix systems

This commit is contained in:
River 2023-03-08 20:29:43 -05:00
parent 6dafc1acd4
commit 6af5c8c05a
9 changed files with 20 additions and 11 deletions

View File

@ -13,3 +13,10 @@ compound_duration = "1.2.0"
quoted-string = "0.6.1"
sysinfo = "0.28.1"
whoami = "1.3.0"
[profile.release]
strip = true
opt-level = "z"
lto = true
codegen-units = 1
panic = "abort"

View File

@ -1,4 +1,4 @@
# oxidefetch 1.1.1
# oxidefetch 1.1.2
Fully cross platform Neofetch clone written in Rust. Up to 25 times faster than Neofetch!
![alt text](image.png "Example output of OxideFetch on a WSL2 Arch Linux host")
@ -35,8 +35,8 @@ From there, it *should* be in your PATH. If not, add ```source ~/.cargo/env``` t
on your system, you can do so by installing Rustup- either via the [instructions on their website](https://doc.rust-lang.org/cargo/getting-started/installation.html "instructions on their website") or via your system package manager.
#### Runtime
There's only a couple runtime dependencies for this project.
1: ```bash``` shell installed for GPU detection on Linux/Unix/mac.
2: ```lspci``` installed for GPU detection on Linux/Unix/mac.
1: ```sh``` shell installed for GPU detection on *nix systems.
2: ```lspci``` installed for GPU detection on *nix systems.
(If either of these above dependencies are absent, chances are the GPU field will simply not show up. It won't crash or anything.
GPU detection runs on Windows without any dependencies.)
3: Nerd fonts symbols are used in the output. Install a patched font on your system, or patch an already installed font.
@ -52,9 +52,9 @@ regarding your real name, IP, location, etc. You can look at the file it generat
#### Very near future:
- Add support for user configurability for entries (whether or not an entry shows, its color, units for memory and time)
- Add process count detection
- Switch from `bash` to `sh` to run the GPU detection command, if possible, since `sh` is installed on every *nix system by default
- **[Complete as of 1.1.2]** Switch from `bash` to `sh` to run the GPU detection command, if possible, since `sh` is installed on every *nix system by default
#### Future:
- Add host system name detection (Such as "Windows Subsystem for Linux", "IdeaPad 3", "Dell Optiplex", etc.
- Add host system name detection such as "Windows Subsystem for Linux", "IdeaPad 3", "Dell Optiplex", etc.
- Add package count/package manager detection
- Crosstest on more distributions to verify `sys.name()` outputs
#### Distant future:
@ -62,7 +62,8 @@ regarding your real name, IP, location, etc. You can look at the file it generat
- More extensible user configuration for entry formatting
### Changelog
1.0.0: Official full stable release
1.0.1: Fixed distro name for Debian GNU/Linux. Logo & color works now.
1.1.0: Refactored some poorly written typing, and added support for memory.
1.1.1: Made sure that linux system detection won't fail if Linux has a capital L.
**1.0.0:** Official full stable release
**1.0.1:** Fixed distro name for Debian GNU/Linux. Logo & color works now.
**1.1.0:** Refactored some poorly written typing, and added support for memory.
**1.1.1:** Made sure that linux system detection won't fail if Linux has a capital L.
**1.1.2:** Replaced *nix dependency on ```bash``` with dependency on ```sh```.

View File

@ -137,8 +137,9 @@ impl InformationStruct {
}
}
_ => {
// On Linux or Mac, hopefully, "lspci | grep VGA | cut -d ":" -f3" gives us our GPU name.
let command_output = std::process::Command::new("bash")
// On *nix, hopefully, "lspci | grep VGA | cut -d ":" -f3" gives us our GPU name.
// Since pipes can't be processed as arguments, we need to do all this in a subshell under SH.
let command_output = std::process::Command::new("sh")
.args(["-c", "lspci | grep VGA | cut -d \":\" -f3"])
.output();
let gpu = match command_output {

BIN
x86_64-apple-darwin.tar.gz Normal file

Binary file not shown.

BIN
x86_64-apple-darwin/oxidefetch Executable file

Binary file not shown.

Binary file not shown.

Binary file not shown.

Binary file not shown.

Binary file not shown.