Skip to content

Commit

Permalink
scripts/fuse/README.adoc, scripts/fuse/execfuse-nut/readdir: integrat…
Browse files Browse the repository at this point in the history
…e with NIT-prepared environments [networkupstools#2591]

Signed-off-by: Jim Klimov <[email protected]>
  • Loading branch information
jimklimov committed Aug 15, 2024
1 parent d3d1ed9 commit d99646c
Show file tree
Hide file tree
Showing 2 changed files with 28 additions and 2 deletions.
23 changes: 22 additions & 1 deletion scripts/fuse/README.adoc
Original file line number Diff line number Diff line change
Expand Up @@ -38,7 +38,28 @@ Installation:
That's about it, an `execfuse` binary should appear.

To run with the PoC scripts here, assuming a built NUT in `~/nut` location:
NOTE: Examples below assume a built NUT in `~/nut` location, and a temporary
mount point in `/tmp/nut-fuse`.

You can also prepare an enviroment using NUT Integration Tests (NIT) scripts:
----
:; ( cd ~/nut && DEBUG_SLEEP=600 make check-NIT ) &

# ...wait a few seconds for it to say the sandbox is ready
:; . "${HOME}/nut/tests/NIT/tmp/etc/NIT.env"
----

Before mounting the FUSE file system, you can also request to debug the PoC
scripts:
----
:; NUT_DEBUG_FUSE=true
:; export NUT_DEBUG_FUSE

# After running some queries, so the log-files to watch appear:
:; tail -F /tmp/nut-debug-fuse-*.log &
----
To run with the PoC scripts here:
----
:; mkdir -p /tmp/nut-fuse
Expand Down
7 changes: 6 additions & 1 deletion scripts/fuse/execfuse-nut/readdir
Original file line number Diff line number Diff line change
Expand Up @@ -37,7 +37,12 @@ case "$1" in
;;
/by-server)
print_dots
printf 'ino=1 mode=drwxr-xr-x nlink=16 uid=0 gid=0 rdev=0 size=16 blksize=512 blocks=1 atime=0 mtime=0 ctime=0 %s\0' "localhost:3493"
printf 'ino=1 mode=drwxr-xr-x nlink=16 uid=0 gid=0 rdev=0 size=16 blksize=512 blocks=1 atime=0 mtime=0 ctime=0 %s\0' "localhost"
# Primarily this is a value arranged by `make check-NIT`:
set -x
if [ -n "${NUT_PORT-}" ] && [ x"${NUT_PORT}" != x3493 ]; then
printf 'ino=1 mode=drwxr-xr-x nlink=16 uid=0 gid=0 rdev=0 size=16 blksize=512 blocks=1 atime=0 mtime=0 ctime=0 %s\0' "localhost:${NUT_PORT}"
fi
;;
/by-server/*/*/*) # Don't want subdirs here
exit 2 # ENOENT
Expand Down

0 comments on commit d99646c

Please sign in to comment.