diff options
| author | Joshua Nelson <jyn514@gmail.com> | 2022-03-23 23:17:44 +0000 |
|---|---|---|
| committer | Joshua Nelson <jnelson@cloudflare.com> | 2022-04-24 19:40:20 -0500 |
| commit | 12b132dd8335a67d4dc88dde8ff3b82daf755d05 (patch) | |
| tree | 51812a8b0bf48199e30a7f1cd1aeed0928e12f1e /src | |
| parent | 93c1a941bb49369ddf7237253a034d98f2c4382a (diff) | |
| download | rust-12b132dd8335a67d4dc88dde8ff3b82daf755d05.tar.gz rust-12b132dd8335a67d4dc88dde8ff3b82daf755d05.zip | |
Allow quotes around `nixos` in /etc/os-release
Diffstat (limited to 'src')
| -rw-r--r-- | src/bootstrap/native.rs | 3 |
1 files changed, 2 insertions, 1 deletions
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() { |
