forked from R2NorthstarTools/FlightCore
-
Notifications
You must be signed in to change notification settings - Fork 0
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Add ldd --version check for Linux (#10)
- Loading branch information
1 parent
c1df0ef
commit c4ce52b
Showing
5 changed files
with
118 additions
and
2 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,63 @@ | ||
// Linux specific code | ||
|
||
use std::process::Command; | ||
use regex::Regex; | ||
|
||
pub fn check_glibc_v() -> f32 { | ||
let out = Command::new("/bin/ldd") | ||
.arg("--version") | ||
.output() | ||
.expect("failed to run 'ldd --version'"); | ||
|
||
// parse the output down to just the first line | ||
let lddva = String::from_utf8_lossy(&out.stdout); | ||
let lddvl: Vec<&str> = lddva.split('\n').collect(); | ||
let lddvlo = &lddvl[0]; | ||
let reg = Regex::new(r"(2.\d{2}$)").unwrap(); | ||
for caps in reg.captures_iter(lddvlo) { | ||
return caps.get(1).unwrap().as_str().parse::<f32>().unwrap(); // theres prolly a better way ijdk how tho | ||
} | ||
return 0.0; // this shouldnt ever be reached but it has to be here | ||
} | ||
|
||
/* | ||
Outputs of ldd --verssion from distros, all we care about is the first line so trimmed, also removed all duplicates | ||
Thanks tony | ||
Distros not included: AmazonLinux, Gentoo, Kali, Debian before 11, Oracle Linux, Scientific Linux, Slackware, Mageia, Neurodebian, RHEL 8 and 9 (Same as AlmaLinux), RockyLinux (Same as AlmaLinux), Ubuntu before 20.04 | ||
AlmaLinux 8 | ||
ldd (GNU libc) 2.35 | ||
Centos Stream 8 | ||
ldd (GNU libc) 2.28 | ||
Centos Stream 9 | ||
ldd (GNU libc) 2.34 | ||
Centos 7 | ||
ldd (GNU libc) 2.17 | ||
Debian 11 | ||
ldd (Debian GLIBC 2.31-13+deb11u4) 2.31 | ||
Debian Testing | ||
ldd (Debian GLIBC 2.35-1) 2.35 | ||
Debian Unstable | ||
ldd (Debian GLIBC 2.35-3) 2.35 | ||
Fedora 37 | ||
ldd (GNU libc) 2.36 | ||
Opensuse Leap | ||
ldd (GNU libc) 2.31 | ||
Ubuntu 20.04 | ||
ldd (Ubuntu GLIBC 2.31-0ubuntu9.9) 2.31 | ||
Ubuntu 22.04 | ||
ldd (Ubuntu GLIBC 2.35-0ubuntu3.1) 2.35 | ||
Ubuntu 22.10 | ||
ldd (Ubuntu GLIBC 2.36-0ubuntu2) 2.36 | ||
*/ |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,2 +1,5 @@ | ||
#[cfg(target_os = "windows")] | ||
pub mod windows; | ||
|
||
pub mod linux; | ||
|
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters