diff --git a/pkgs/build-support/build-fhs-userenv/chroot-user.rb b/pkgs/build-support/build-fhs-userenv/chroot-user.rb index 357a743c9937..2fd6a47e132e 100755 --- a/pkgs/build-support/build-fhs-userenv/chroot-user.rb +++ b/pkgs/build-support/build-fhs-userenv/chroot-user.rb @@ -11,7 +11,7 @@ mounts = [ ['/nix/store', nil], ['/var', nil], ['/run', nil], ['/root', nil], - ].map! { |x| [ x[0], x[1].nil? ? x[0].sub(/^\/*/, '') : x[1] ] } + ] # Create directories mkdirs = ['tmp', @@ -68,6 +68,9 @@ abort "Usage: chrootenv swdir program args..." unless ARGV.length >= 2 swdir = Pathname.new ARGV[0] execp = ARGV.drop 1 +# Set destination paths for mounts +mounts.map! { |x| [x[0], x[1].nil? ? x[0].sub(/^\/*/, '') : x[1]] } + # Create temporary directory for root and chdir root = Dir.mktmpdir 'chrootenv'