diff options
author | Stefano Brivio <sbrivio@redhat.com> | 2022-08-08 20:22:03 +0200 |
---|---|---|
committer | Stefano Brivio <sbrivio@redhat.com> | 2022-08-08 20:22:03 +0200 |
commit | 8c0bccc91f8c44de2c6b01ef056142d567df6ad5 (patch) | |
tree | 3bddc51a3db827e528f878bf794a6e45b6ca5099 | |
parent | 7bca683c7db6b314d7ef81542dd6ff844262e38f (diff) | |
download | mbuto-8c0bccc91f8c44de2c6b01ef056142d567df6ad5.tar mbuto-8c0bccc91f8c44de2c6b01ef056142d567df6ad5.tar.gz mbuto-8c0bccc91f8c44de2c6b01ef056142d567df6ad5.tar.bz2 mbuto-8c0bccc91f8c44de2c6b01ef056142d567df6ad5.tar.lz mbuto-8c0bccc91f8c44de2c6b01ef056142d567df6ad5.tar.xz mbuto-8c0bccc91f8c44de2c6b01ef056142d567df6ad5.tar.zst mbuto-8c0bccc91f8c44de2c6b01ef056142d567df6ad5.zip |
mbuto: UID 0 doesn't mean we're root, check uid_map too
Make mbuto run as expected in a detached user namespace: we'll still
need to use fakeroot(1), change $PATH, and we can't use fusermount(1)
to keep the CPIO archive mounted.
Signed-off-by: Stefano Brivio <sbrivio@redhat.com>
-rwxr-xr-x | mbuto | 9 |
1 files changed, 8 insertions, 1 deletions
@@ -1210,7 +1210,14 @@ usage() { # If we're not running as root, re-run with fakeroot -if [ "${LD_PRELOAD}" != "libfakeroot-sysv.so" ] && [ "$(id -u)" -ne 0 ]; then +if [ "$(id -u)" -eq 0 ] && \ + [ "$(cat /proc/self/uid_map)" = " 0 0 4294967295" ]; then + __as_root=1 +else + __as_root=0 +fi + +if [ "${LD_PRELOAD}" != "libfakeroot-sysv.so" ] && [ ${__as_root} -eq 0 ]; then if ! FAKEROOT="$(command -v fakeroot)"; then __fakeroot_missing="y" else |