Unverified Commit a6cf8594 authored by Weijia Wang's avatar Weijia Wang Committed by GitHub
Browse files

Merge pull request #227510 from wegank/fhs-aarch64

buildFHSEnv: restrict pkgsi686Linux to x86_64-linux
parents 1e02d3e8 3c6e26b2
Loading
Loading
Loading
Loading
+1 −1
Original line number Diff line number Diff line
@@ -64,7 +64,7 @@ let

  ldconfig = writeShellScriptBin "ldconfig" ''
    # due to a glibc bug, 64-bit ldconfig complains about patchelf'd 32-bit libraries, so we're using 32-bit ldconfig
    exec ${pkgsi686Linux.glibc.bin}/bin/ldconfig -f /etc/ld.so.conf -C /etc/ld.so.cache "$@"
    exec ${if stdenv.isx86_64 && stdenv.isLinux then pkgsi686Linux.glibc.bin else pkgs.glibc.bin}/bin/ldconfig -f /etc/ld.so.conf -C /etc/ld.so.cache "$@"
  '';
  etcProfile = writeText "profile" ''
    export PS1='${name}-chrootenv:\u@\h:\w\$ '
+4 −0
Original line number Diff line number Diff line
{ lib
, stdenv
, callPackage
, runCommandLocal
, writeShellScript
@@ -113,6 +114,7 @@ let
    exec ${run} "$@"
  '';

  indentLines = str: lib.concatLines (map (s: "  " + s) (filter (s: s != "") (lib.splitString "\n" str)));
  bwrapCmd = { initArgs ? "" }: ''
    ignored=(/nix /dev /proc /etc)
    ro_mounts=()
@@ -202,11 +204,13 @@ let
      --symlink /etc/ld.so.cache ${glibc}/etc/ld.so.cache \
      --ro-bind ${glibc}/etc/rpc ${glibc}/etc/rpc \
      --remount-ro ${glibc}/etc \
  '' + lib.optionalString (stdenv.isx86_64 && stdenv.isLinux) (indentLines ''
      --tmpfs ${pkgsi686Linux.glibc}/etc \
      --symlink /etc/ld.so.conf ${pkgsi686Linux.glibc}/etc/ld.so.conf \
      --symlink /etc/ld.so.cache ${pkgsi686Linux.glibc}/etc/ld.so.cache \
      --ro-bind ${pkgsi686Linux.glibc}/etc/rpc ${pkgsi686Linux.glibc}/etc/rpc \
      --remount-ro ${pkgsi686Linux.glibc}/etc \
  '') + ''
      "''${ro_mounts[@]}"
      "''${symlinks[@]}"
      "''${auto_mounts[@]}"