From 4d66431aad2c4aa7a6947344b688db0c6a96f263 Mon Sep 17 00:00:00 2001 From: SteveLauC Date: Sat, 11 May 2024 11:20:43 +0800 Subject: [PATCH] fix: Fedora Sway Atomic should be recognized as FedoraImmutable (#795) * fix: Fedora Sway Atomic should be recognized as FedoraImmutable * style: fmt --- src/steps/os/linux.rs | 20 ++++++++++---------- src/steps/os/os_release/fedoraswayatomic | 23 +++++++++++++++++++++++ 2 files changed, 33 insertions(+), 10 deletions(-) create mode 100644 src/steps/os/os_release/fedoraswayatomic diff --git a/src/steps/os/linux.rs b/src/steps/os/linux.rs index 4a814d59..9ca694bb 100644 --- a/src/steps/os/linux.rs +++ b/src/steps/os/linux.rs @@ -48,7 +48,7 @@ impl Distribution { let section = os_release.general_section(); let id = section.get("ID"); let name = section.get("NAME"); - let variant: Option> = section.get("VARIANT").map(|s| s.split_whitespace().collect()); + let variant = section.get("VARIANT"); let id_like: Option> = section.get("ID_LIKE").map(|s| s.split_whitespace().collect()); Ok(match id { @@ -58,15 +58,11 @@ impl Distribution { Some("clear-linux-os") => Distribution::ClearLinux, Some("fedora") => { return if let Some(variant) = variant { - if variant.contains(&"Silverblue") - || variant.contains(&"Kinoite") - || variant.contains(&"Sericea") - || variant.contains(&"Onyx") - || variant.contains(&"IoT") - { - Ok(Distribution::FedoraImmutable) - } else { - Ok(Distribution::Fedora) + match variant { + "Silverblue" | "Kinoite" | "Sericea" | "Onyx" | "IoT Edition" | "Sway Atomic" => { + Ok(Distribution::FedoraImmutable) + } + _ => Ok(Distribution::Fedora), } } else { Ok(Distribution::Fedora) @@ -1144,6 +1140,10 @@ mod tests { test_template(include_str!("os_release/fedoraonyx"), Distribution::FedoraImmutable); test_template(include_str!("os_release/fedorasericea"), Distribution::FedoraImmutable); test_template(include_str!("os_release/fedoraiot"), Distribution::FedoraImmutable); + test_template( + include_str!("os_release/fedoraswayatomic"), + Distribution::FedoraImmutable, + ); } #[test] diff --git a/src/steps/os/os_release/fedoraswayatomic b/src/steps/os/os_release/fedoraswayatomic new file mode 100644 index 00000000..ab259590 --- /dev/null +++ b/src/steps/os/os_release/fedoraswayatomic @@ -0,0 +1,23 @@ +NAME="Fedora Linux" +VERSION="40.20240426.0 (Sway Atomic)" +ID=fedora +VERSION_ID=40 +VERSION_CODENAME="" +PLATFORM_ID="platform:f40" +PRETTY_NAME="Fedora Linux 40.20240426.0 (Sway Atomic)" +ANSI_COLOR="0;38;2;60;110;180" +LOGO=fedora-logo-icon +CPE_NAME="cpe:/o:fedoraproject:fedora:40" +DEFAULT_HOSTNAME="fedora" +HOME_URL="https://fedoraproject.org/atomic-desktops/sway/" +DOCUMENTATION_URL="https://docs.fedoraproject.org/en-US/fedora-sericea/" +SUPPORT_URL="https://ask.fedoraproject.org/" +BUG_REPORT_URL="https://gitlab.com/fedora/sigs/sway/SIG/-/issues" +REDHAT_BUGZILLA_PRODUCT="Fedora" +REDHAT_BUGZILLA_PRODUCT_VERSION=40 +REDHAT_SUPPORT_PRODUCT="Fedora" +REDHAT_SUPPORT_PRODUCT_VERSION=40 +SUPPORT_END=2025-05-13 +VARIANT="Sway Atomic" +VARIANT_ID=sway-atomic +OSTREE_VERSION='40.20240426.0' \ No newline at end of file