summaryrefslogtreecommitdiffstats
path: root/vendor/os_info
diff options
context:
space:
mode:
Diffstat (limited to 'vendor/os_info')
-rw-r--r--vendor/os_info/.cargo-checksum.json2
-rw-r--r--vendor/os_info/Cargo.lock2
-rw-r--r--vendor/os_info/Cargo.toml3
-rw-r--r--vendor/os_info/README.md7
-rw-r--r--vendor/os_info/examples/print_version.rs3
-rw-r--r--vendor/os_info/src/architecture.rs32
-rw-r--r--vendor/os_info/src/info.rs40
-rw-r--r--vendor/os_info/src/lib.rs10
-rw-r--r--vendor/os_info/src/linux/file_release.rs85
-rw-r--r--vendor/os_info/src/linux/lsb_release.rs36
-rw-r--r--vendor/os_info/src/linux/mod.rs10
-rw-r--r--vendor/os_info/src/linux/tests/Alpaquita/etc/os-release8
-rw-r--r--vendor/os_info/src/linux/tests/Arch/etc/os-release11
-rw-r--r--vendor/os_info/src/linux/tests/ArchARM/etc/os-release11
-rw-r--r--vendor/os_info/src/linux/tests/Artix/etc/os-release9
-rw-r--r--vendor/os_info/src/linux/tests/Debian_11/etc/os-release9
-rw-r--r--vendor/os_info/src/linux/tests/OpenCloudOS/etc/os-release9
-rw-r--r--vendor/os_info/src/linux/tests/openEuler/etc/os-release6
-rw-r--r--vendor/os_info/src/macos/mod.rs3
-rw-r--r--vendor/os_info/src/netbsd/mod.rs3
-rw-r--r--vendor/os_info/src/openbsd/mod.rs3
-rw-r--r--vendor/os_info/src/os_type.rs16
-rw-r--r--vendor/os_info/src/version.rs8
-rw-r--r--vendor/os_info/src/windows/winapi.rs38
24 files changed, 330 insertions, 34 deletions
diff --git a/vendor/os_info/.cargo-checksum.json b/vendor/os_info/.cargo-checksum.json
index 130439591..173034f9a 100644
--- a/vendor/os_info/.cargo-checksum.json
+++ b/vendor/os_info/.cargo-checksum.json
@@ -1 +1 @@
-{"files":{"Cargo.lock":"84afb5c2075c260253a50d4b6d222748621e7d38b8c5c72b035439c119279d9c","Cargo.toml":"b5dc0f2ece0a05a6d5b1227ef632d3876de63f0b083fc724a3d566f18fa89a8f","LICENSE":"44b62aa8f8a212f36d120a4f719438765020731207fd78bf28768032291df836","README.md":"7332387b3924f3ad2c41f500b4ca79824413795ae611b0a85e0cd3d30c0b6813","examples/print_version.rs":"991cd6787afe3ba773b7171358231f12586a25bf690962c9240780f600d2ca21","src/android/mod.rs":"a8c4eecdd5959c2915d380c4428709bf5b6524a2659a5bf3759f215ff1d6bade","src/bitness.rs":"8a5e69094a3c65cd960aa9c87f8b21f45c3125ab241b5b3b30f6be17562e2329","src/dragonfly/mod.rs":"f0c294f0ce3c3a08e594260672b342a27ebd5261631a6d768f25ada9198fa249","src/emscripten/mod.rs":"9ee114afd744ecf40c9c662ac7bee30674363481c1e4092816f3997d2950d7b7","src/freebsd/mod.rs":"e5c441dfb49d28a9bcd351c392cb9944becaa9fca6a26423538e279124a2ad94","src/illumos/mod.rs":"514573b6f21b2704ec99ff81db739ec237286ad3e25f0ab71c8b15cd5319eb19","src/info.rs":"3729c911bc5a9d7112b34bc838ca8f1ca943160a014e306327e03b403e641433","src/lib.rs":"8c668cb6cfb18d9460a11c58a0b05dd04b1873dcd8121163315cada4619a0a22","src/linux/file_release.rs":"31d2ec3982407902563eb56c2f0428ebd924b7645a80af2c1f6bf8f2cffed0cb","src/linux/lsb_release.rs":"652abfe2182fd79bcf5f225f31b1cfbfc1c83e5493bb3b6c88c141f9b5013d54","src/linux/mod.rs":"dcc249137ef89e1a0035e0f2d4b53eb03ed656aba8570d5b579edc9045909379","src/linux/tests/Alpine/etc/alpine-release":"c59a81beb0aa1cd41c671a0192754aaed194ccaf49b12fae73181d932cf4791f","src/linux/tests/Alpine_3_12/etc/os-release":"21769a53fe9a9c5ae57b65b34c202b819821e0e84533d22afeee882a02acf9cc","src/linux/tests/Amazon_1/etc/os-release":"e2e275dbb23f9a549f91fcd8917c4dcb82e8de879801cf7fdd42204a23dc9bec","src/linux/tests/Amazon_2/etc/os-release":"352cf40ffb5f83630dd51f8e7f3d383be89c2992b8662e52f9a0c9663aec480a","src/linux/tests/CentOS/etc/centos-release":"379c3fe52daca2e3d4c5afe4c1031a95be741cda709ef6d2211c0a64dcb6423a","src/linux/tests/CentOS_7/etc/os-release":"039762ef09d9751b9721c6c8e0bc3ac625c6651dce5de9f3961549142d67c881","src/linux/tests/CentOS_Stream/etc/os-release":"4489b97563754d45285c346c0cb8bb1050ad90300beb815e8aec9ed209806a50","src/linux/tests/CentOS_Unknown/etc/centos-release":"4be44d05ee59b034424cc5efde84e9b995ddae18d06ed46cc7cbbf8fe2818752","src/linux/tests/Fedora/etc/fedora-release":"b76598da0e2414694bc92f0b4acc4590b0ff0fcc900650792345fbb945cc5d10","src/linux/tests/Fedora_32/etc/os-release":"98ae3fcb726af9541d576a4e4dae524ed6bc1fa1c2c69da122aed41679dec757","src/linux/tests/Fedora_35/etc/os-release":"954a58b7466ac5cfd0fbfc0d872b973adb6a934e41c4fd0818bb6d8addf5f80d","src/linux/tests/Fedora_Unknown/etc/fedora-release":"b17f8835ad8d3056695fff17ec71419d13c9e8c350c6f6297a6bd9ddc5b80fe7","src/linux/tests/Mariner/etc/mariner-release":"99ccf7dfbd0e1092702fc95944c022464d4853870b13b4b7b3310eb253187bde","src/linux/tests/Mariner_Unknown/etc/mariner-release":"5b8938775cf749b36f209a8216d0eceea0e743bc4c1ce6eb135eb2574d8a2973","src/linux/tests/Mint/etc/os-release":"195ca646469f2131e667aa5e6229cbfd8eca24075cb97ed74d8501c85b95f82f","src/linux/tests/NixOS/etc/os-release":"c222e91aa4e8664c3daa44a5a6ed1181c798d3caf541ca418476a29d8efaba79","src/linux/tests/OracleLinux/etc/os-release":"0f87264d759e63f2e61d3c583778692b3a69bc20e866023cd27e39c4288b8dea","src/linux/tests/OracleLinux/etc/redhat-release":"43c5b191af60147c005531285322461e0e59537a346b97cd42b8a8d4da02cd8b","src/linux/tests/RedHatEnterprise/etc/redhat-release":"49d64399e4211279032dd13618e53feae0e6997fba92718d94190b9f855b5577","src/linux/tests/RedHatEnterprise_7/etc/os-release":"fd172ab6a720896755aafa4aa066604330dacde1216945f4a98c38e00bd69b34","src/linux/tests/RedHatEnterprise_8/etc/os-release":"5ffd870e40ba3c041cb53bfa03b32d88d5866769e44f14ac2cbc2cb94826db1a","src/linux/tests/RedHatEnterprise_Unknown/etc/redhat-release":"e3b0c44298fc1c149afbf4c8996fb92427ae41e4649b934ca495991b7852b855","src/linux/tests/SUSE_12/etc/os-release":"bec556c6f1616a74992b8f09dea456017ff51b6890ca44330bfc2db04d8fed23","src/linux/tests/SUSE_15/etc/os-release":"49ff47e45fa842d654f34cd0cd57ddc890b4b0868f3ce94ecf94145a4fbc2f5b","src/linux/tests/Ubuntu/etc/os-release":"a31894bf95b2b49a2a9daaa8af41cd5af8316d98db8875dbb790322a05accdc5","src/linux/tests/none_invalid_os_release/etc/os-release":"efbdea227f722b03a23f1041e363f2120f4bdd023297e2b56ef6b4557202ccc0","src/macos/mod.rs":"6bbf3bbb2ddd1ccb988a8901d6727204a8e7837e2bf8c6744d47c1a0f575517d","src/matcher.rs":"e80119342500aaddcc9b4c83fb6c0a1fb331a56a2266865f5fd6f272b5adee34","src/netbsd/mod.rs":"e2a4bfc579a806b4fdc381fd8ca27754f5168413b7dbefb944fe9e00b9020a47","src/openbsd/mod.rs":"ea20f7d648f6268476bf6f279640a9082c46aae058760421362bc0863002eebd","src/os_type.rs":"dd4c2254bf4e35af729066b8861363210a1dfcc8c6a5aefc0524ffcfad1f07f4","src/redox/mod.rs":"f81289af605712e1c13d07f983a0fcc2aee6b79702b27d9fc4dd3a1d18671a35","src/uname.rs":"fd3a5015e0ed1aafda5213cf137731aebed12d09f54a3b58c0c2df5dfde85f5e","src/unknown/mod.rs":"462b606dcc0010338d801580a451a49ed8540a4acdb42bb84446957cbe723f49","src/version.rs":"53b2b3f2bca8328078e688e5d4e8e73d85ee37fb08c13dfd608534981caf36c8","src/windows/mod.rs":"9cba1be1c526aa3f36eca547f08da5bee6cf45edc744aba033427a0ef23bb044","src/windows/winapi.rs":"14a2e14a8a2af5bbab94922ad9f704260a02614fcf23279d9c1cd04fa1d95027","tests/basic.rs":"60ba6e1ccc694dbf5b90f126a0e4ac890899fa13175f61555aa55b08dbd53a2e","tests/md_doc.rs":"93509fdef063ae32d509bace925d3477504650ad0d1926c56ffbd3713a365d7f"},"package":"5209b2162b2c140df493a93689e04f8deab3a67634f5bc7a553c0a98e5b8d399"} \ No newline at end of file
+{"files":{"Cargo.lock":"5da2e9a78685ee7b05efca21280acd9e7f550445f0b74bde3c27ad8da9766dc6","Cargo.toml":"8fac29dd4f821c94329528938014c7fc232cf5cbf2a8fc0d63293426367bac2c","LICENSE":"44b62aa8f8a212f36d120a4f719438765020731207fd78bf28768032291df836","README.md":"58db8dca224871beb872b4d332696c78899fd227c56651ef80e8686cf4b05d79","examples/print_version.rs":"49dd5edcdcf094165b4c208e8d632669faa21d46c98f04565897e605d0298a35","src/android/mod.rs":"a8c4eecdd5959c2915d380c4428709bf5b6524a2659a5bf3759f215ff1d6bade","src/architecture.rs":"55f168c9a0e1ab5afe0af629f95476d5d8abfa1a374105bffbf446d46bdf4baf","src/bitness.rs":"8a5e69094a3c65cd960aa9c87f8b21f45c3125ab241b5b3b30f6be17562e2329","src/dragonfly/mod.rs":"f0c294f0ce3c3a08e594260672b342a27ebd5261631a6d768f25ada9198fa249","src/emscripten/mod.rs":"9ee114afd744ecf40c9c662ac7bee30674363481c1e4092816f3997d2950d7b7","src/freebsd/mod.rs":"e5c441dfb49d28a9bcd351c392cb9944becaa9fca6a26423538e279124a2ad94","src/illumos/mod.rs":"514573b6f21b2704ec99ff81db739ec237286ad3e25f0ab71c8b15cd5319eb19","src/info.rs":"cfa90c7dec4fcb00caf10ad8069ceaad87f7224752b8831d1a02b2d278b23106","src/lib.rs":"2b970b53d46c7d87d4d894cf708cc9494b97fd151cdb01a53fe3d7193a7a544b","src/linux/file_release.rs":"52aac5b9987fa25a90f75ca2e943350b42ce2f4e49929447961a0f5de9fabd45","src/linux/lsb_release.rs":"852d07b2053af1b19b522c75d564bc9dbc8f582bd95df2efc32b07cfee45d02d","src/linux/mod.rs":"9cde853cfc99f10c5daf24a398d71a4ff9ccd8468f3ba6e426939a6b8327fbf1","src/linux/tests/Alpaquita/etc/os-release":"0986ca6e2905aad17451ecb2d4e6e1f3fe1a1fccfee25f1c78ad355ac6726fbe","src/linux/tests/Alpine/etc/alpine-release":"c59a81beb0aa1cd41c671a0192754aaed194ccaf49b12fae73181d932cf4791f","src/linux/tests/Alpine_3_12/etc/os-release":"21769a53fe9a9c5ae57b65b34c202b819821e0e84533d22afeee882a02acf9cc","src/linux/tests/Amazon_1/etc/os-release":"e2e275dbb23f9a549f91fcd8917c4dcb82e8de879801cf7fdd42204a23dc9bec","src/linux/tests/Amazon_2/etc/os-release":"352cf40ffb5f83630dd51f8e7f3d383be89c2992b8662e52f9a0c9663aec480a","src/linux/tests/Arch/etc/os-release":"46108f7e84f5d5994678133d412d5ec6222c53f28e6bf7ac66cc07788a7ee66d","src/linux/tests/ArchARM/etc/os-release":"72eaedcb694aa5833e804660dfb4f61907d52aef009767173689d0bb9e845a23","src/linux/tests/Artix/etc/os-release":"047a51efeae6576b9e61fe1aaf3d1846c494deba20f5be3cb3c7d90134f123ce","src/linux/tests/CentOS/etc/centos-release":"379c3fe52daca2e3d4c5afe4c1031a95be741cda709ef6d2211c0a64dcb6423a","src/linux/tests/CentOS_7/etc/os-release":"039762ef09d9751b9721c6c8e0bc3ac625c6651dce5de9f3961549142d67c881","src/linux/tests/CentOS_Stream/etc/os-release":"4489b97563754d45285c346c0cb8bb1050ad90300beb815e8aec9ed209806a50","src/linux/tests/CentOS_Unknown/etc/centos-release":"4be44d05ee59b034424cc5efde84e9b995ddae18d06ed46cc7cbbf8fe2818752","src/linux/tests/Debian_11/etc/os-release":"11f039f212d535c1d7e14fa8e6960c3d7724de5e0d4e71938d787496a5d08470","src/linux/tests/Fedora/etc/fedora-release":"b76598da0e2414694bc92f0b4acc4590b0ff0fcc900650792345fbb945cc5d10","src/linux/tests/Fedora_32/etc/os-release":"98ae3fcb726af9541d576a4e4dae524ed6bc1fa1c2c69da122aed41679dec757","src/linux/tests/Fedora_35/etc/os-release":"954a58b7466ac5cfd0fbfc0d872b973adb6a934e41c4fd0818bb6d8addf5f80d","src/linux/tests/Fedora_Unknown/etc/fedora-release":"b17f8835ad8d3056695fff17ec71419d13c9e8c350c6f6297a6bd9ddc5b80fe7","src/linux/tests/Mariner/etc/mariner-release":"99ccf7dfbd0e1092702fc95944c022464d4853870b13b4b7b3310eb253187bde","src/linux/tests/Mariner_Unknown/etc/mariner-release":"5b8938775cf749b36f209a8216d0eceea0e743bc4c1ce6eb135eb2574d8a2973","src/linux/tests/Mint/etc/os-release":"195ca646469f2131e667aa5e6229cbfd8eca24075cb97ed74d8501c85b95f82f","src/linux/tests/NixOS/etc/os-release":"c222e91aa4e8664c3daa44a5a6ed1181c798d3caf541ca418476a29d8efaba79","src/linux/tests/OpenCloudOS/etc/os-release":"d5a3fb9bce9932227a07f1679fd00a037f10369e2477db49637df8fd7d62ea9e","src/linux/tests/OracleLinux/etc/os-release":"0f87264d759e63f2e61d3c583778692b3a69bc20e866023cd27e39c4288b8dea","src/linux/tests/OracleLinux/etc/redhat-release":"43c5b191af60147c005531285322461e0e59537a346b97cd42b8a8d4da02cd8b","src/linux/tests/RedHatEnterprise/etc/redhat-release":"49d64399e4211279032dd13618e53feae0e6997fba92718d94190b9f855b5577","src/linux/tests/RedHatEnterprise_7/etc/os-release":"fd172ab6a720896755aafa4aa066604330dacde1216945f4a98c38e00bd69b34","src/linux/tests/RedHatEnterprise_8/etc/os-release":"5ffd870e40ba3c041cb53bfa03b32d88d5866769e44f14ac2cbc2cb94826db1a","src/linux/tests/RedHatEnterprise_Unknown/etc/redhat-release":"e3b0c44298fc1c149afbf4c8996fb92427ae41e4649b934ca495991b7852b855","src/linux/tests/SUSE_12/etc/os-release":"bec556c6f1616a74992b8f09dea456017ff51b6890ca44330bfc2db04d8fed23","src/linux/tests/SUSE_15/etc/os-release":"49ff47e45fa842d654f34cd0cd57ddc890b4b0868f3ce94ecf94145a4fbc2f5b","src/linux/tests/Ubuntu/etc/os-release":"a31894bf95b2b49a2a9daaa8af41cd5af8316d98db8875dbb790322a05accdc5","src/linux/tests/none_invalid_os_release/etc/os-release":"efbdea227f722b03a23f1041e363f2120f4bdd023297e2b56ef6b4557202ccc0","src/linux/tests/openEuler/etc/os-release":"57c8a17d65c50bb46ab3269c65ece77be5d790c67c44edc08a4ad7c79c5288a5","src/macos/mod.rs":"12259f8ca7a571103841c3a6f340335e5ab884f12aa374d720a28ed34ec48753","src/matcher.rs":"e80119342500aaddcc9b4c83fb6c0a1fb331a56a2266865f5fd6f272b5adee34","src/netbsd/mod.rs":"d8395069237a41a756712d344e57571cedf0b439757074eb21794f544f76b959","src/openbsd/mod.rs":"be83222bb1e5aad86cb53b53a7ccbfe0a64d8d43043922fbdb80f1f79cc5fd26","src/os_type.rs":"0143e9292e689b1fcea973ee8bf8ce6c4a6784f15cc12565ef5634a3ecca68a4","src/redox/mod.rs":"f81289af605712e1c13d07f983a0fcc2aee6b79702b27d9fc4dd3a1d18671a35","src/uname.rs":"fd3a5015e0ed1aafda5213cf137731aebed12d09f54a3b58c0c2df5dfde85f5e","src/unknown/mod.rs":"462b606dcc0010338d801580a451a49ed8540a4acdb42bb84446957cbe723f49","src/version.rs":"fb118aa322dc5ec1930fadf749d53dae4065dfa96a4ac2fee4c3b4a0adcf1d34","src/windows/mod.rs":"9cba1be1c526aa3f36eca547f08da5bee6cf45edc744aba033427a0ef23bb044","src/windows/winapi.rs":"efd5b895c58607e6caed592d9646dcd87f648bc550ae99df4f0af363aea2b85b","tests/basic.rs":"60ba6e1ccc694dbf5b90f126a0e4ac890899fa13175f61555aa55b08dbd53a2e","tests/md_doc.rs":"93509fdef063ae32d509bace925d3477504650ad0d1926c56ffbd3713a365d7f"},"package":"006e42d5b888366f1880eda20371fedde764ed2213dc8496f49622fa0c99cd5e"} \ No newline at end of file
diff --git a/vendor/os_info/Cargo.lock b/vendor/os_info/Cargo.lock
index f29613dfa..2a9b4090b 100644
--- a/vendor/os_info/Cargo.lock
+++ b/vendor/os_info/Cargo.lock
@@ -50,7 +50,7 @@ dependencies = [
[[package]]
name = "os_info"
-version = "3.5.0"
+version = "3.7.0"
dependencies = [
"doc-comment",
"log",
diff --git a/vendor/os_info/Cargo.toml b/vendor/os_info/Cargo.toml
index a74fea76d..52a062f39 100644
--- a/vendor/os_info/Cargo.toml
+++ b/vendor/os_info/Cargo.toml
@@ -11,8 +11,9 @@
[package]
edition = "2018"
+rust-version = "1.60"
name = "os_info"
-version = "3.5.0"
+version = "3.7.0"
authors = [
"Jan Schulte <hello@unexpected-co.de>",
"Stanislav Tkach <stanislav.tkach@gmail.com>",
diff --git a/vendor/os_info/README.md b/vendor/os_info/README.md
index a47049435..6e34f2df6 100644
--- a/vendor/os_info/README.md
+++ b/vendor/os_info/README.md
@@ -12,7 +12,7 @@
**Project details:**
[![LoC](https://tokei.rs/b1/github/stanislav-tkach/os_info)](https://github.com/stanislav-tkach/os_info)
-![Rust 1.41+ required](https://img.shields.io/badge/rust-1.41+-blue.svg?label=Required%20Rust)
+![Rust 1.60+ required](https://img.shields.io/badge/rust-1.41+-blue.svg?label=Required%20Rust)
## Overview
@@ -45,12 +45,13 @@ os_info = { version = "3", default-features = false }
let info = os_info::get();
// Print full information:
-println!("OS information: {}", info);
+println!("OS information: {info}");
// Print information separately:
println!("Type: {}", info.os_type());
println!("Version: {}", info.version());
println!("Bitness: {}", info.bitness());
+println!("Architecture: {}", info.architecture());
```
### Command line tool (`os_info_cli`)
@@ -78,10 +79,12 @@ os_info --help
Right now, the following operating system types can be returned:
+- Alpaquita Linux
- Alpine Linux
- Amazon Linux AMI
- Android
- Arch Linux
+- Artix Linux
- CentOS
- Debian
- DragonFly BSD
diff --git a/vendor/os_info/examples/print_version.rs b/vendor/os_info/examples/print_version.rs
index 0047fbcc2..dc5bbad53 100644
--- a/vendor/os_info/examples/print_version.rs
+++ b/vendor/os_info/examples/print_version.rs
@@ -2,7 +2,7 @@ fn main() {
let info = os_info::get();
// Print full information:
- println!("OS information: {}", info);
+ println!("OS information: {info}");
// Print information separately:
println!("Type: {}", info.os_type());
@@ -10,4 +10,5 @@ fn main() {
println!("Edition: {:?}", info.edition());
println!("Codename: {:?}", info.codename());
println!("Bitness: {}", info.bitness());
+ println!("Architecture: {:?}", info.architecture());
}
diff --git a/vendor/os_info/src/architecture.rs b/vendor/os_info/src/architecture.rs
new file mode 100644
index 000000000..d6de08b2c
--- /dev/null
+++ b/vendor/os_info/src/architecture.rs
@@ -0,0 +1,32 @@
+use std::process::Command;
+
+use log::error;
+
+pub fn get() -> Option<String> {
+ Command::new("uname")
+ .arg("-m")
+ .output()
+ .map_err(|e| {
+ error!("Cannot invoke 'uname` to get architecture type: {:?}", e);
+ })
+ .ok()
+ .and_then(|out| {
+ if out.status.success() {
+ Some(String::from_utf8_lossy(&out.stdout).trim_end().to_owned())
+ } else {
+ log::error!("'uname' invocation error: {:?}", out);
+ None
+ }
+ })
+}
+
+#[cfg(test)]
+mod tests {
+ use super::*;
+
+ #[test]
+ fn uname_nonempty() {
+ let val = get().expect("uname failed");
+ assert!(!val.is_empty());
+ }
+}
diff --git a/vendor/os_info/src/info.rs b/vendor/os_info/src/info.rs
index 85b699330..91e6cc3cb 100644
--- a/vendor/os_info/src/info.rs
+++ b/vendor/os_info/src/info.rs
@@ -15,7 +15,7 @@ use super::{Bitness, Type, Version};
/// use os_info;
///
/// let info = os_info::get();
-/// println!("OS information: {}", info);
+/// println!("OS information: {info}");
/// ```
#[derive(Debug, Clone, PartialEq, Eq, PartialOrd, Ord, Hash)]
#[cfg_attr(feature = "serde", derive(serde::Serialize, serde::Deserialize))]
@@ -26,11 +26,13 @@ pub struct Info {
pub(crate) version: Version,
/// Operating system edition.
pub(crate) edition: Option<String>,
- /// Operating system edition.
+ /// Operating system codename.
pub(crate) codename: Option<String>,
/// Operating system architecture in terms of how many bits compose the basic values it can deal
/// with. See `Bitness` for details.
pub(crate) bitness: Bitness,
+ /// Processor architecture.
+ pub(crate) architecture: Option<String>,
}
impl Info {
@@ -47,6 +49,7 @@ impl Info {
/// assert_eq!(None, info.edition());
/// assert_eq!(None, info.codename());
/// assert_eq!(Bitness::Unknown, info.bitness());
+ /// assert_eq!(None, info.architecture());
/// ```
pub fn unknown() -> Self {
Self {
@@ -55,6 +58,7 @@ impl Info {
edition: None,
codename: None,
bitness: Bitness::Unknown,
+ architecture: None,
}
}
@@ -72,6 +76,7 @@ impl Info {
/// assert_eq!(None, info.edition());
/// assert_eq!(None, info.codename());
/// assert_eq!(Bitness::Unknown, info.bitness());
+ /// assert_eq!(None, info.architecture());
/// ```
pub fn with_type(os_type: Type) -> Self {
Self {
@@ -147,6 +152,19 @@ impl Info {
pub fn bitness(&self) -> Bitness {
self.bitness
}
+
+ /// Returns operating system architecture.
+ ///
+ /// # Examples
+ ///
+ /// ```
+ /// use os_info::Info;
+ ///
+ /// let info = Info::unknown();
+ /// assert_eq!(None, info.architecture());
+ pub fn architecture(&self) -> Option<&str> {
+ self.architecture.as_ref().map(String::as_ref)
+ }
}
impl Default for Info {
@@ -162,10 +180,10 @@ impl Display for Info {
write!(f, " {}", self.version)?;
}
if let Some(ref edition) = self.edition {
- write!(f, " ({})", edition)?;
+ write!(f, " ({edition})")?;
}
if let Some(ref codename) = self.codename {
- write!(f, " ({})", codename)?;
+ write!(f, " ({codename})")?;
}
write!(f, " [{}]", self.bitness)
}
@@ -184,16 +202,19 @@ mod tests {
assert_eq!(None, info.edition());
assert_eq!(None, info.codename());
assert_eq!(Bitness::Unknown, info.bitness());
+ assert_eq!(None, info.architecture());
}
#[test]
fn with_type() {
let types = [
Type::Redox,
+ Type::Alpaquita,
Type::Alpine,
Type::Amazon,
Type::Android,
Type::Arch,
+ Type::Artix,
Type::CentOS,
Type::Debian,
Type::Emscripten,
@@ -205,6 +226,8 @@ mod tests {
Type::Manjaro,
Type::Mariner,
Type::NixOS,
+ Type::OpenCloudOS,
+ Type::openEuler,
Type::openSUSE,
Type::OracleLinux,
Type::Pop,
@@ -262,6 +285,14 @@ mod tests {
),
(
Info {
+ os_type: Type::Artix,
+ version: Version::Rolling(None),
+ ..Default::default()
+ },
+ "Artix Linux Rolling Release [unknown bitness]",
+ ),
+ (
+ Info {
os_type: Type::Manjaro,
version: Version::Rolling(Some("2020.05.24".to_owned())),
..Default::default()
@@ -299,6 +330,7 @@ mod tests {
edition: Some("edition".to_owned()),
codename: Some("codename".to_owned()),
bitness: Bitness::X64,
+ architecture: Some("architecture".to_owned()),
},
"Mac OS 10.2.0 (edition) (codename) [64-bit]",
),
diff --git a/vendor/os_info/src/lib.rs b/vendor/os_info/src/lib.rs
index a1a6746ec..83c7f3875 100644
--- a/vendor/os_info/src/lib.rs
+++ b/vendor/os_info/src/lib.rs
@@ -70,6 +70,13 @@ mod imp;
#[path = "unknown/mod.rs"]
mod imp;
+#[cfg(any(
+ target_os = "linux",
+ target_os = "macos",
+ target_os = "netbsd",
+ target_os = "openbsd"
+))]
+mod architecture;
mod bitness;
mod info;
#[cfg(not(windows))]
@@ -97,7 +104,7 @@ pub use crate::{bitness::Bitness, info::Info, os_type::Type, version::Version};
/// let info = os_info::get();
///
/// // Print full information:
-/// println!("OS information: {}", info);
+/// println!("OS information: {info}");
///
/// // Print information separately:
/// println!("Type: {}", info.os_type());
@@ -105,6 +112,7 @@ pub use crate::{bitness::Bitness, info::Info, os_type::Type, version::Version};
/// println!("Edition: {:?}", info.edition());
/// println!("Codename: {:?}", info.codename());
/// println!("Bitness: {}", info.bitness());
+/// println!("Architecture: {:?}", info.architecture());
/// ```
pub fn get() -> Info {
imp::current_platform()
diff --git a/vendor/os_info/src/linux/file_release.rs b/vendor/os_info/src/linux/file_release.rs
index 119c85560..e9cb6c3f7 100644
--- a/vendor/os_info/src/linux/file_release.rs
+++ b/vendor/os_info/src/linux/file_release.rs
@@ -91,18 +91,20 @@ static DISTRIBUTIONS: [ReleaseInfo; 6] = [
// https://github.com/chef/os_release
//"almalinux" => Alma
+ "alpaquita" => Some(Type::Alpaquita),
"alpine" => Some(Type::Alpine),
"amzn" => Some(Type::Amazon),
//"antergos" => Antergos
//"aosc" => AOSC
"arch" => Some(Type::Arch),
- //"artix" => Artix
+ "archarm" => Some(Type::Arch),
+ "artix" => Some(Type::Artix),
"centos" => Some(Type::CentOS),
//"clear-linux-os" => ClearLinuxOS
//"clearos" => ClearOS
//"coreos"
//"cumulus-linux" => Cumulus
- //"debian" => Debian
+ "debian" => Some(Type::Debian),
//"devuan" => Devuan
//"elementary" => Elementary
"fedora" => Some(Type::Fedora),
@@ -115,6 +117,8 @@ static DISTRIBUTIONS: [ReleaseInfo; 6] = [
"mariner" => Some(Type::Mariner),
//"nexus" => Nexus
"nixos" => Some(Type::NixOS),
+ "opencloudos" => Some(Type::OpenCloudOS),
+ "openEuler" => Some(Type::openEuler),
"ol" => Some(Type::OracleLinux),
"opensuse" => Some(Type::openSUSE),
"opensuse-leap" => Some(Type::openSUSE),
@@ -196,6 +200,17 @@ mod tests {
use pretty_assertions::assert_eq;
#[test]
+ fn alpaquita_os_release() {
+ let root = "src/linux/tests/Alpaquita";
+
+ let info = retrieve(&DISTRIBUTIONS, root).unwrap();
+ assert_eq!(info.os_type(), Type::Alpaquita);
+ assert_eq!(info.version, Version::Semantic(23, 0, 0));
+ assert_eq!(info.edition, None);
+ assert_eq!(info.codename, None);
+ }
+
+ #[test]
fn alpine_3_12_os_release() {
let root = "src/linux/tests/Alpine_3_12";
@@ -240,6 +255,39 @@ mod tests {
}
#[test]
+ fn arch_os_release() {
+ let root = "src/linux/tests/Arch";
+
+ let info = retrieve(&DISTRIBUTIONS, root).unwrap();
+ assert_eq!(info.os_type(), Type::Arch);
+ assert_eq!(info.version, Version::Unknown);
+ assert_eq!(info.edition, None);
+ assert_eq!(info.codename, None);
+ }
+
+ #[test]
+ fn archarm_os_release() {
+ let root = "src/linux/tests/ArchARM";
+
+ let info = retrieve(&DISTRIBUTIONS, root).unwrap();
+ assert_eq!(info.os_type(), Type::Arch);
+ assert_eq!(info.version, Version::Unknown);
+ assert_eq!(info.edition, None);
+ assert_eq!(info.codename, None);
+ }
+
+ #[test]
+ fn artix_os_release() {
+ let root = "src/linux/tests/Artix";
+
+ let info = retrieve(&DISTRIBUTIONS, root).unwrap();
+ assert_eq!(info.os_type(), Type::Artix);
+ assert_eq!(info.version, Version::Unknown);
+ assert_eq!(info.edition, None);
+ assert_eq!(info.codename, None);
+ }
+
+ #[test]
fn centos_7_os_release() {
let root = "src/linux/tests/CentOS_7";
@@ -284,6 +332,17 @@ mod tests {
}
#[test]
+ fn debian_11_os_release() {
+ let root = "src/linux/tests/Debian_11";
+
+ let info = retrieve(&DISTRIBUTIONS, root).unwrap();
+ assert_eq!(info.os_type(), Type::Debian);
+ assert_eq!(info.version, Version::Semantic(11, 0, 0));
+ assert_eq!(info.edition, None);
+ assert_eq!(info.codename, None);
+ }
+
+ #[test]
fn fedora_32_os_release() {
let root = "src/linux/tests/Fedora_32";
@@ -399,6 +458,28 @@ mod tests {
}
#[test]
+ fn opencloudos_os_release() {
+ let root = "src/linux/tests/OpenCloudOS";
+
+ let info = retrieve(&DISTRIBUTIONS, root).unwrap();
+ assert_eq!(info.os_type(), Type::OpenCloudOS);
+ assert_eq!(info.version, Version::Semantic(8, 6, 0));
+ assert_eq!(info.edition, None);
+ assert_eq!(info.codename, None);
+ }
+
+ #[test]
+ fn openeuler_os_release() {
+ let root = "src/linux/tests/openEuler";
+
+ let info = retrieve(&DISTRIBUTIONS, root).unwrap();
+ assert_eq!(info.os_type(), Type::openEuler);
+ assert_eq!(info.version, Version::Semantic(22, 3, 0));
+ assert_eq!(info.edition, None);
+ assert_eq!(info.codename, None);
+ }
+
+ #[test]
fn oracle_linux_os_release() {
let root = "src/linux/tests/OracleLinux";
diff --git a/vendor/os_info/src/linux/lsb_release.rs b/vendor/os_info/src/linux/lsb_release.rs
index 58a96ae2a..a494fce68 100644
--- a/vendor/os_info/src/linux/lsb_release.rs
+++ b/vendor/os_info/src/linux/lsb_release.rs
@@ -16,8 +16,10 @@ pub fn get() -> Option<Info> {
};
let os_type = match release.distribution.as_ref().map(String::as_ref) {
+ Some("Alpaquita") => Type::Alpaquita,
Some("Amazon") | Some("AmazonAMI") => Type::Amazon,
Some("Arch") => Type::Arch,
+ Some("Artix") => Type::Artix,
Some("CentOS") => Type::CentOS,
Some("Debian") => Type::Debian,
Some("EndeavourOS") => Type::EndeavourOS,
@@ -25,9 +27,12 @@ pub fn get() -> Option<Info> {
Some("Garuda") => Type::Garuda,
Some("Gentoo") => Type::Gentoo,
Some("Linuxmint") => Type::Mint,
+ Some("MaboxLinux") => Type::Mabox,
Some("ManjaroLinux") => Type::Manjaro,
Some("Mariner") => Type::Mariner,
Some("NixOS") => Type::NixOS,
+ Some("OpenCloudOS") => Type::OpenCloudOS,
+ Some("openEuler") => Type::openEuler,
Some("openSUSE") => Type::openSUSE,
Some("OracleServer") => Type::OracleLinux,
Some("Pop") => Type::Pop,
@@ -109,6 +114,14 @@ mod tests {
}
#[test]
+ fn alpaquita() {
+ let parse_results = parse(alpaquita_file());
+ assert_eq!(parse_results.distribution, Some("Alpaquita".to_string()));
+ assert_eq!(parse_results.version, Some("23".to_string()));
+ assert_eq!(parse_results.codename, None);
+ }
+
+ #[test]
fn arch() {
let parse_results = parse(arch_file());
assert_eq!(parse_results.distribution, Some("Arch".to_string()));
@@ -117,6 +130,14 @@ mod tests {
}
#[test]
+ fn artix() {
+ let parse_results = parse(artix_file());
+ assert_eq!(parse_results.distribution, Some("Artix".to_string()));
+ assert_eq!(parse_results.version, Some("rolling".to_string()));
+ assert_eq!(parse_results.codename, None);
+ }
+
+ #[test]
fn fedora() {
let parse_results = parse(fedora_file());
assert_eq!(parse_results.distribution, Some("Fedora".to_string()));
@@ -296,6 +317,13 @@ mod tests {
"
}
+ fn alpaquita_file() -> &'static str {
+ "\nDistributor ID: Alpaquita\n\
+ Description: BellSoft Alpaquita Linux Stream 23 (musl)\n\
+ Release: 23\n\
+ Codename: n/a"
+ }
+
fn arch_file() -> &'static str {
"\nLSB Version: 1.4\n\
Distributor ID: Arch\n\
@@ -304,6 +332,14 @@ mod tests {
Codename: n/a"
}
+ fn artix_file() -> &'static str {
+ "\nLSB Version: n/a\n\
+ Distributor ID: Artix\n\
+ Description: Artix Linux\n\
+ Release: rolling\n\
+ Codename: n/a"
+ }
+
fn fedora_file() -> &'static str {
"\nLSB Version: :core-4.1-amd64:core-4.1-noarch:cxx-4.1-amd64:cxx-4.1-noarch\n\
Distributor ID: Fedora\n\
diff --git a/vendor/os_info/src/linux/mod.rs b/vendor/os_info/src/linux/mod.rs
index 64d488342..ac5c8cc00 100644
--- a/vendor/os_info/src/linux/mod.rs
+++ b/vendor/os_info/src/linux/mod.rs
@@ -3,7 +3,7 @@ mod lsb_release;
use log::trace;
-use crate::{bitness, Info, Type};
+use crate::{architecture, bitness, Info, Type};
pub fn current_platform() -> Info {
trace!("linux::current_platform is called");
@@ -12,6 +12,7 @@ pub fn current_platform() -> Info {
.or_else(file_release::get)
.unwrap_or_else(|| Info::with_type(Type::Linux));
info.bitness = bitness::get();
+ info.architecture = architecture::get();
trace!("Returning {:?}", info);
info
@@ -25,9 +26,11 @@ mod tests {
fn os_type() {
let version = current_platform();
match version.os_type() {
- Type::Alpine
+ Type::Alpaquita
+ | Type::Alpine
| Type::Amazon
| Type::Arch
+ | Type::Artix
| Type::CentOS
| Type::Debian
| Type::EndeavourOS
@@ -35,9 +38,12 @@ mod tests {
| Type::Garuda
| Type::Gentoo
| Type::Linux
+ | Type::Mabox
| Type::Manjaro
| Type::Mariner
| Type::NixOS
+ | Type::OpenCloudOS
+ | Type::openEuler
| Type::openSUSE
| Type::OracleLinux
| Type::Pop
diff --git a/vendor/os_info/src/linux/tests/Alpaquita/etc/os-release b/vendor/os_info/src/linux/tests/Alpaquita/etc/os-release
new file mode 100644
index 000000000..4c47ccda3
--- /dev/null
+++ b/vendor/os_info/src/linux/tests/Alpaquita/etc/os-release
@@ -0,0 +1,8 @@
+NAME="BellSoft Alpaquita Linux Stream"
+ID=alpaquita
+ID_LIKE=alpine
+VERSION_ID=23
+PRETTY_NAME="BellSoft Alpaquita Linux Stream 23 (musl)"
+HOME_URL="https://bell-sw.com/"
+BUG_REPORT_URL="https://bell-sw.com/support/"
+LIBC_TYPE=musl
diff --git a/vendor/os_info/src/linux/tests/Arch/etc/os-release b/vendor/os_info/src/linux/tests/Arch/etc/os-release
new file mode 100644
index 000000000..8662a54df
--- /dev/null
+++ b/vendor/os_info/src/linux/tests/Arch/etc/os-release
@@ -0,0 +1,11 @@
+NAME="Arch Linux"
+PRETTY_NAME="Arch Linux"
+ID=arch
+BUILD_ID=rolling
+ANSI_COLOR="38;2;23;147;209"
+HOME_URL="https://archlinux.org/"
+DOCUMENTATION_URL="https://wiki.archlinux.org/"
+SUPPORT_URL="https://bbs.archlinux.org/"
+BUG_REPORT_URL="https://bugs.archlinux.org/"
+PRIVACY_POLICY_URL="https://terms.archlinux.org/docs/privacy-policy/"
+LOGO=archlinux-logo
diff --git a/vendor/os_info/src/linux/tests/ArchARM/etc/os-release b/vendor/os_info/src/linux/tests/ArchARM/etc/os-release
new file mode 100644
index 000000000..6218b0e2c
--- /dev/null
+++ b/vendor/os_info/src/linux/tests/ArchARM/etc/os-release
@@ -0,0 +1,11 @@
+NAME="Arch Linux ARM"
+PRETTY_NAME="Arch Linux ARM"
+ID=archarm
+ID_LIKE=arch
+BUILD_ID=rolling
+ANSI_COLOR="38;2;23;147;209"
+HOME_URL="https://archlinuxarm.org/"
+DOCUMENTATION_URL="https://archlinuxarm.org/wiki"
+SUPPORT_URL="https://archlinuxarm.org/forum"
+BUG_REPORT_URL="https://github.com/archlinuxarm/PKGBUILDs/issues"
+LOGO=archlinux-logo
diff --git a/vendor/os_info/src/linux/tests/Artix/etc/os-release b/vendor/os_info/src/linux/tests/Artix/etc/os-release
new file mode 100644
index 000000000..26279cec5
--- /dev/null
+++ b/vendor/os_info/src/linux/tests/Artix/etc/os-release
@@ -0,0 +1,9 @@
+NAME="Artix Linux"
+PRETTY_NAME="Artix Linux"
+ID=artix
+BUILD_ID=rolling
+ANSI_COLOR="38;2;23;147;209"
+HOME_URL="https://artixlinux.org/"
+DOCUMENTATION_URL="https://wiki.artixlinux.org/"
+SUPPORT_URL="https://forum.artixlinux.org/"
+BUG_REPORT_URL="https://gitea.artixlinux.org/artix"
diff --git a/vendor/os_info/src/linux/tests/Debian_11/etc/os-release b/vendor/os_info/src/linux/tests/Debian_11/etc/os-release
new file mode 100644
index 000000000..611cf746b
--- /dev/null
+++ b/vendor/os_info/src/linux/tests/Debian_11/etc/os-release
@@ -0,0 +1,9 @@
+PRETTY_NAME="Debian GNU/Linux 11 (bullseye)"
+NAME="Debian GNU/Linux"
+VERSION_ID="11"
+VERSION="11 (bullseye)"
+VERSION_CODENAME=bullseye
+ID=debian
+HOME_URL="https://www.debian.org/"
+SUPPORT_URL="https://www.debian.org/support"
+BUG_REPORT_URL="https://bugs.debian.org/"
diff --git a/vendor/os_info/src/linux/tests/OpenCloudOS/etc/os-release b/vendor/os_info/src/linux/tests/OpenCloudOS/etc/os-release
new file mode 100644
index 000000000..4bc4580f6
--- /dev/null
+++ b/vendor/os_info/src/linux/tests/OpenCloudOS/etc/os-release
@@ -0,0 +1,9 @@
+NAME="OpenCloudOS"
+VERSION="8.6"
+ID="opencloudos"
+ID_LIKE="rhel fedora centos"
+VERSION_ID="8.6"
+PLATFORM_ID="platform:oc8"
+PRETTY_NAME="OpenCloudOS 8.6"
+ANSI_COLOR="0;31"
+CPE_NAME="cpe:/o:opencloudos:opencloudos:8" \ No newline at end of file
diff --git a/vendor/os_info/src/linux/tests/openEuler/etc/os-release b/vendor/os_info/src/linux/tests/openEuler/etc/os-release
new file mode 100644
index 000000000..bd72dd829
--- /dev/null
+++ b/vendor/os_info/src/linux/tests/openEuler/etc/os-release
@@ -0,0 +1,6 @@
+NAME="openEuler"
+VERSION="22.03 LTS"
+ID="openEuler"
+VERSION_ID="22.03"
+PRETTY_NAME="openEuler 22.03 LTS"
+ANSI_COLOR="0;31" \ No newline at end of file
diff --git a/vendor/os_info/src/macos/mod.rs b/vendor/os_info/src/macos/mod.rs
index 0c93a9713..aef79d274 100644
--- a/vendor/os_info/src/macos/mod.rs
+++ b/vendor/os_info/src/macos/mod.rs
@@ -2,7 +2,7 @@ use std::process::Command;
use log::{trace, warn};
-use crate::{bitness, matcher::Matcher, Info, Type, Version};
+use crate::{architecture, bitness, matcher::Matcher, Info, Type, Version};
pub fn current_platform() -> Info {
trace!("macos::current_platform is called");
@@ -11,6 +11,7 @@ pub fn current_platform() -> Info {
os_type: Type::Macos,
version: version(),
bitness: bitness::get(),
+ architecture: architecture::get(),
..Default::default()
};
trace!("Returning {:?}", info);
diff --git a/vendor/os_info/src/netbsd/mod.rs b/vendor/os_info/src/netbsd/mod.rs
index d5ab97bfb..7031820b9 100644
--- a/vendor/os_info/src/netbsd/mod.rs
+++ b/vendor/os_info/src/netbsd/mod.rs
@@ -2,7 +2,7 @@ use std::process::Command;
use log::{error, trace};
-use crate::{bitness, uname::uname, Info, Type, Version};
+use crate::{architecture, bitness, uname::uname, Info, Type, Version};
pub fn current_platform() -> Info {
trace!("netbsd::current_platform is called");
@@ -15,6 +15,7 @@ pub fn current_platform() -> Info {
os_type: Type::NetBSD,
version,
bitness: bitness::get(),
+ architecture: architecture::get(),
..Default::default()
};
diff --git a/vendor/os_info/src/openbsd/mod.rs b/vendor/os_info/src/openbsd/mod.rs
index 897fc4aeb..c9eeee4d9 100644
--- a/vendor/os_info/src/openbsd/mod.rs
+++ b/vendor/os_info/src/openbsd/mod.rs
@@ -2,7 +2,7 @@ use std::process::Command;
use log::{error, trace};
-use crate::{bitness, uname::uname, Info, Type, Version};
+use crate::{architecture, bitness, uname::uname, Info, Type, Version};
pub fn current_platform() -> Info {
trace!("openbsd::current_platform is called");
@@ -15,6 +15,7 @@ pub fn current_platform() -> Info {
os_type: Type::OpenBSD,
version,
bitness: bitness::get(),
+ architecture: architecture::get(),
..Default::default()
};
diff --git a/vendor/os_info/src/os_type.rs b/vendor/os_info/src/os_type.rs
index 8cab07b8e..6d78f587c 100644
--- a/vendor/os_info/src/os_type.rs
+++ b/vendor/os_info/src/os_type.rs
@@ -6,6 +6,8 @@ use std::fmt::{self, Display, Formatter};
#[allow(non_camel_case_types, clippy::upper_case_acronyms)]
#[non_exhaustive]
pub enum Type {
+ /// Alpaquita Linux (<https://bell-sw.com/alpaquita-linux/>).
+ Alpaquita,
/// Alpine Linux (<https://en.wikipedia.org/wiki/Alpine_Linux>).
Alpine,
/// Amazon Linux AMI (<https://en.wikipedia.org/wiki/Amazon_Machine_Image#Amazon_Linux_AMI>).
@@ -14,6 +16,8 @@ pub enum Type {
Android,
/// Arch Linux (<https://en.wikipedia.org/wiki/Arch_Linux>).
Arch,
+ /// Artix Linux (<https://en.wikipedia.org/wiki/Artix_Linux>).
+ Artix,
/// CentOS (<https://en.wikipedia.org/wiki/CentOS>).
CentOS,
/// Debian (<https://en.wikipedia.org/wiki/Debian>).
@@ -38,6 +42,8 @@ pub enum Type {
Illumos,
/// Linux based operating system (<https://en.wikipedia.org/wiki/Linux>).
Linux,
+ /// Mabox (<https://maboxlinux.org/>).
+ Mabox,
/// Mac OS X/OS X/macOS (<https://en.wikipedia.org/wiki/MacOS>).
Macos,
/// Manjaro (<https://en.wikipedia.org/wiki/Manjaro>).
@@ -54,6 +60,10 @@ pub enum Type {
NixOS,
/// OpenBSD (<https://en.wikipedia.org/wiki/OpenBSD>).
OpenBSD,
+ /// OpenCloudOS (<https://www.opencloudos.org>).
+ OpenCloudOS,
+ /// openEuler (<https://en.wikipedia.org/wiki/EulerOS>).
+ openEuler,
/// openSUSE (<https://en.wikipedia.org/wiki/OpenSUSE>).
openSUSE,
/// Oracle Linux (<https://en.wikipedia.org/wiki/Oracle_Linux>).
@@ -89,9 +99,11 @@ impl Default for Type {
impl Display for Type {
fn fmt(&self, f: &mut Formatter) -> fmt::Result {
match *self {
+ Type::Alpaquita => write!(f, "Alpaquita Linux"),
Type::Alpine => write!(f, "Alpine Linux"),
Type::Amazon => write!(f, "Amazon Linux AMI"),
Type::Arch => write!(f, "Arch Linux"),
+ Type::Artix => write!(f, "Artix Linux"),
Type::DragonFly => write!(f, "DragonFly BSD"),
Type::Garuda => write!(f, "Garuda Linux"),
Type::Gentoo => write!(f, "Gentoo Linux"),
@@ -104,7 +116,7 @@ impl Display for Type {
Type::Redhat => write!(f, "Red Hat Linux"),
Type::RedHatEnterprise => write!(f, "Red Hat Enterprise Linux"),
Type::SUSE => write!(f, "SUSE Linux Enterprise Server"),
- _ => write!(f, "{:?}", self),
+ _ => write!(f, "{self:?}"),
}
}
}
@@ -121,10 +133,12 @@ mod tests {
#[test]
fn display() {
let data = [
+ (Type::Alpaquita, "Alpaquita Linux"),
(Type::Alpine, "Alpine Linux"),
(Type::Amazon, "Amazon Linux AMI"),
(Type::Android, "Android"),
(Type::Arch, "Arch Linux"),
+ (Type::Artix, "Artix Linux"),
(Type::CentOS, "CentOS"),
(Type::Debian, "Debian"),
(Type::DragonFly, "DragonFly BSD"),
diff --git a/vendor/os_info/src/version.rs b/vendor/os_info/src/version.rs
index 20a2c4a61..578464c67 100644
--- a/vendor/os_info/src/version.rs
+++ b/vendor/os_info/src/version.rs
@@ -55,15 +55,15 @@ impl Display for Version {
fn fmt(&self, f: &mut Formatter) -> fmt::Result {
match *self {
Self::Unknown => f.write_str("Unknown"),
- Self::Semantic(major, minor, patch) => write!(f, "{}.{}.{}", major, minor, patch),
+ Self::Semantic(major, minor, patch) => write!(f, "{major}.{minor}.{patch}"),
Self::Rolling(ref date) => {
let date = match date {
- Some(date) => format!(" ({})", date),
+ Some(date) => format!(" ({date})"),
None => "".to_owned(),
};
- write!(f, "Rolling Release{}", date)
+ write!(f, "Rolling Release{date}")
}
- Self::Custom(ref version) => write!(f, "{}", version),
+ Self::Custom(ref version) => write!(f, "{version}"),
}
}
}
diff --git a/vendor/os_info/src/windows/winapi.rs b/vendor/os_info/src/windows/winapi.rs
index 59e3f30d9..dea5ba258 100644
--- a/vendor/os_info/src/windows/winapi.rs
+++ b/vendor/os_info/src/windows/winapi.rs
@@ -59,7 +59,7 @@ fn version() -> (Version, Option<String>) {
v.dwMinorVersion as u64,
v.dwBuildNumber as u64,
),
- product_name().or_else(|| edition(&v)),
+ product_name(&v).or_else(|| edition(&v)),
),
}
}
@@ -125,7 +125,7 @@ fn version_info() -> Option<OSVERSIONINFOEX> {
}
}
-fn product_name() -> Option<String> {
+fn product_name(info: &OSVERSIONINFOEX) -> Option<String> {
const REG_SUCCESS: LSTATUS = ERROR_SUCCESS as LSTATUS;
let sub_key = to_wide("SOFTWARE\\Microsoft\\Windows NT\\CurrentVersion");
@@ -138,8 +138,14 @@ fn product_name() -> Option<String> {
return None;
}
+ let is_win_11 = info.dwMajorVersion == 10 && info.dwBuildNumber >= 22000;
+
// Get size of the data.
- let name = to_wide("ProductName");
+ let name = to_wide(if is_win_11 {
+ "EditionID"
+ } else {
+ "ProductName"
+ });
let mut data_type: DWORD = 0;
let mut data_size: DWORD = 0;
if unsafe {
@@ -186,11 +192,15 @@ fn product_name() -> Option<String> {
_ => {}
}
- Some(
- OsString::from_wide(data.as_slice())
- .to_string_lossy()
- .into_owned(),
- )
+ let value = OsString::from_wide(data.as_slice())
+ .to_string_lossy()
+ .into_owned();
+
+ if is_win_11 {
+ Some(format!("Windows 11 {}", value))
+ } else {
+ Some(value)
+ }
}
fn to_wide(value: &str) -> Vec<WCHAR> {
@@ -206,7 +216,13 @@ fn edition(version_info: &OSVERSIONINFOEX) -> Option<String> {
version_info.wProductType,
) {
// Windows 10.
- (10, 0, VER_NT_WORKSTATION) => Some("Windows 10"),
+ (10, 0, VER_NT_WORKSTATION) => {
+ if version_info.dwBuildNumber >= 22000 {
+ Some("Windows 11")
+ } else {
+ Some("Windows 10")
+ }
+ }
(10, 0, _) => Some("Windows Server 2016"),
// Windows Vista, 7, 8 and 8.1.
(6, 3, VER_NT_WORKSTATION) => Some("Windows 8.1"),
@@ -283,7 +299,6 @@ mod tests {
#[test]
fn get_edition() {
let test_data = [
- (10, 0, VER_NT_WORKSTATION, "Windows 10"),
(10, 0, 0, "Windows Server 2016"),
(6, 3, VER_NT_WORKSTATION, "Windows 8.1"),
(6, 3, 0, "Windows Server 2012 R2"),
@@ -351,7 +366,8 @@ mod tests {
#[test]
fn get_product_name() {
- let edition = product_name().expect("edition() failed");
+ let version = version_info().expect("version_info() failed");
+ let edition = product_name(&version).expect("edition() failed");
assert!(!edition.is_empty());
}