Skip to content

Commit

Permalink
refactor: Update OS target detection logic in install module
Browse files Browse the repository at this point in the history
  • Loading branch information
LeChatP committed Sep 5, 2024
1 parent 50ad2ce commit 999cb54
Show file tree
Hide file tree
Showing 3 changed files with 3 additions and 11 deletions.
2 changes: 1 addition & 1 deletion xtask/src/install/configure.rs
Original file line number Diff line number Diff line change
Expand Up @@ -233,7 +233,7 @@ fn retrieve_real_user() -> Result<Option<nix::unistd::User>, anyhow::Error> {
pub fn default_pam_path(os: &OsTarget) -> &'static str {
match os {
OsTarget::Debian | OsTarget::Ubuntu => "resources/debian/deb_sr_pam.conf",
OsTarget::RedHat | OsTarget::AlmaLinux | OsTarget::RockyLinux | OsTarget::Fedora => "resources/rh/rh_sr_pam.conf",
OsTarget::RedHat | OsTarget::Fedora => "resources/rh/rh_sr_pam.conf",
OsTarget::ArchLinux => "resources/arch/arch_sr_pam.conf",
}
}
Expand Down
4 changes: 2 additions & 2 deletions xtask/src/install/dependencies.rs
Original file line number Diff line number Diff line change
Expand Up @@ -28,15 +28,15 @@ fn update_package_manager() -> Result<(), anyhow::Error> {
fn required_dependencies(os: &OsTarget) -> &'static [&'static str] {
match os {
OsTarget::Debian | OsTarget::Ubuntu => &["libpam0g", "libpcre2-8-0"],
OsTarget::RedHat | OsTarget::AlmaLinux | OsTarget::RockyLinux => &["pcre2"],
OsTarget::RedHat => &["pcre2"],
OsTarget::ArchLinux | OsTarget::Fedora => &["pam", "pcre2"],
}
}

fn development_dependencies(os: &OsTarget) -> &'static [&'static str] {
match os {
OsTarget::Debian | OsTarget::Ubuntu => &["libpam0g-dev", "libpcre2-dev"],
OsTarget::RedHat | OsTarget::AlmaLinux | OsTarget::RockyLinux => &["pcre2-devel", "clang-devel", "openssl-devel", "pam-devel"],
OsTarget::RedHat => &["pcre2-devel", "clang-devel", "openssl-devel", "pam-devel"],
OsTarget::Fedora => &["pam-devel", "pcre2-devel", "clang", "openssl-devel"],
OsTarget::ArchLinux => &["pam-devel", "pcre2-devel", "clang", "libssl", "pkg-config"],
}
Expand Down
8 changes: 0 additions & 8 deletions xtask/src/install/mod.rs
Original file line number Diff line number Diff line change
Expand Up @@ -120,10 +120,6 @@ pub enum OsTarget {
RedHat,
#[clap(alias = "fed")]
Fedora,
#[clap(alias = "alma")]
AlmaLinux,
#[clap(alias = "rocky")]
RockyLinux,
#[clap(alias = "arch")]
ArchLinux,
}
Expand All @@ -139,10 +135,6 @@ impl OsTarget {
return Ok(OsTarget::Ubuntu);
} else if os.contains("fedora") {
return Ok(OsTarget::Fedora);
} else if os.contains("almalinux") {
return Ok(OsTarget::AlmaLinux);
} else if os.contains("rocky") {
return Ok(OsTarget::RockyLinux);
} else if os.contains("arch") {
return Ok(OsTarget::ArchLinux);
} else if os.contains("redhat") || os.contains("rhel") {
Expand Down

0 comments on commit 999cb54

Please sign in to comment.