From 12b132dd8335a67d4dc88dde8ff3b82daf755d05 Mon Sep 17 00:00:00 2001 From: Joshua Nelson Date: Wed, 23 Mar 2022 23:17:44 +0000 Subject: [PATCH] Allow quotes around `nixos` in /etc/os-release --- src/bootstrap/native.rs | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-) diff --git a/src/bootstrap/native.rs b/src/bootstrap/native.rs index 42b7ef2b7a0..343df281fb6 100644 --- a/src/bootstrap/native.rs +++ b/src/bootstrap/native.rs @@ -217,12 +217,13 @@ fn fix_bin_or_dylib(builder: &Builder<'_>, fname: &Path) { if !builder.config.patch_binaries_for_nix { // Use `/etc/os-release` instead of `/etc/NIXOS`. // The latter one does not exist on NixOS when using tmpfs as root. + const NIX_IDS: &[&str] = &["ID=nixos", "ID='nixos'", "ID=\"nixos\""]; let os_release = match File::open("/etc/os-release") { Err(e) if e.kind() == ErrorKind::NotFound => return, Err(e) => panic!("failed to access /etc/os-release: {}", e), Ok(f) => f, }; - if !BufReader::new(os_release).lines().any(|l| t!(l).trim() == "ID=nixos") { + if !BufReader::new(os_release).lines().any(|l| NIX_IDS.contains(&t!(l).trim())) { return; } if Path::new("/lib").exists() {