diff options
author | Luca Bruno <lethalman88@gmail.com> | 2015-03-10 18:11:25 +0100 |
---|---|---|
committer | Luca Bruno <lethalman88@gmail.com> | 2015-03-10 18:12:38 +0100 |
commit | b1adfeb23d956908a10b0e628790c8cc689defbb (patch) | |
tree | 30b045d2d17f87bcdc618ac2b6647b9450de01f6 /pkgs/build-support | |
parent | 7711446298a6024d05a876edac2f2ee435e24d12 (diff) | |
download | nixlib-b1adfeb23d956908a10b0e628790c8cc689defbb.tar nixlib-b1adfeb23d956908a10b0e628790c8cc689defbb.tar.gz nixlib-b1adfeb23d956908a10b0e628790c8cc689defbb.tar.bz2 nixlib-b1adfeb23d956908a10b0e628790c8cc689defbb.tar.lz nixlib-b1adfeb23d956908a10b0e628790c8cc689defbb.tar.xz nixlib-b1adfeb23d956908a10b0e628790c8cc689defbb.tar.zst nixlib-b1adfeb23d956908a10b0e628790c8cc689defbb.zip |
fhs-userenv: Make it work on kernel < 3.19 cc @abbradar
It may not be very secure, but I think it's better to make it work with older kernel since 3.19 is not the default on nixos.
Diffstat (limited to 'pkgs/build-support')
-rwxr-xr-x | pkgs/build-support/build-fhs-userenv/chroot-user.rb | 6 |
1 files changed, 5 insertions, 1 deletions
diff --git a/pkgs/build-support/build-fhs-userenv/chroot-user.rb b/pkgs/build-support/build-fhs-userenv/chroot-user.rb index 35608bd3eb60..3e140fac97e2 100755 --- a/pkgs/build-support/build-fhs-userenv/chroot-user.rb +++ b/pkgs/build-support/build-fhs-userenv/chroot-user.rb @@ -79,7 +79,11 @@ if $cpid == 0 $unshare.call CLONE_NEWNS | CLONE_NEWUSER # Map users and groups to the parent namespace - write_file '/proc/self/setgroups', 'deny' + begin + # setgroups is only available since Linux 3.19 + write_file '/proc/self/setgroups', 'deny' + rescue + end write_file '/proc/self/uid_map', "#{uid} #{uid} 1" write_file '/proc/self/gid_map', "#{gid} #{gid} 1" |