6 releases (3 breaking)
| 0.4.1 | Jul 1, 2023 |
|---|---|
| 0.4.0 | Jul 1, 2023 |
| 0.3.0 | Jun 22, 2023 |
| 0.2.0 | Jun 21, 2023 |
| 0.1.1 | Jun 21, 2023 |
#1943 in Filesystem
34 downloads per month
Used in i3stat
16KB
273 lines
fakeroot
A simple crate which provides the ability to redirect filesystem calls.
This crate builds a library that can be used via LD_PRELOAD.
Some examples follow.
Intercept a file:
mkdir /tmp/etc
echo "tee hee" > /tmp/etc/hosts
FAKEROOT="/tmp" LD_PRELOAD="path/to/libfakeroot.so" cat /etc/hosts
# tee hee
Intercept a directory list:
mkdir /tmp/etc
echo "whatever" > /tmp/etc/🪃
FAKEROOT="/tmp" FAKEROOT_DIRS=1 LD_PRELOAD="path/to/libfakeroot.so" ls /etc
# 🪃
Options are configured via environment variables:
FAKEROOT: absolute path to the fake rootFAKEROOT_DIRS: whether or not to intercept directory listing calls tooFAKEROOT_ALL: whether or not to fake non-existent files and directoriesFAKEROOT_DEBUG: if set, will debug log to STDERR
License: GPL-3.0-only
Dependencies
~49KB