Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
18 changes: 18 additions & 0 deletions tools/lkl/systemd/61-lklfuse.rules
Original file line number Diff line number Diff line change
@@ -0,0 +1,18 @@
SUBSYSTEM!="block", SUBSYSTEMS!="usb", GOTO="lklfuse_end"
#TAG+="lklfuse-dbg-block-filter"
# XXX remove should be handled by systemd service ConditionPathExists for %k
# device node, but it doesn't appear to work, so manually stop.
ACTION=="remove", TAG+="lklfuse-dbg-got-remove", \
RUN+="/usr/bin/systemctl stop lklfuse-mount@%k", GOTO="lklfuse_end"
#TAG+="lklfuse-dbg-remove-filter"

# only support a subset of filesystems on USB devices for now. Btrfs omitted
# from the default set, as lklfuse lacks multi-device support.
ENV{ID_FS_TYPE}!="vfat|exfat|xfs|ext4|ext3|ext2", GOTO="lklfuse_end"
#TAG+="lklfuse-dbg-fs-filter"

ACTION=="add", TAG+="systemd", \
OWNER="lklfuse", GROUP="lklfuse", ENV{UDISKS_IGNORE}="1", \
ENV{SYSTEMD_WANTS}+="lklfuse-mount@%k.service"

LABEL="lklfuse_end"
25 changes: 25 additions & 0 deletions tools/lkl/systemd/lklfuse-mount@.service
Original file line number Diff line number Diff line change
@@ -0,0 +1,25 @@
[Unit]
Description=EXPERIMENTAL: Mount a storage device via lklfuse
ConditionPathExists=/dev/%I
After=modprobe@fuse.service
Requires=modprobe@fuse.service

[Service]
RuntimeDirectory=lklfuse-%i
# The "allow_other" mount option permits fuse mount access by users other than
# the lklfuse user, and requires a "user_allow_other" setting in fuse3.conf
Environment=LKLFUSE_ARGS="-s -oallow_other"
# Override LKLFUSE_ARGS in the EnvironmentFile if desired. See lklfuse --help
EnvironmentFile=-/etc/lklfuse.conf
# The following sandboxing works, but the mountpoint is in a new mount namespace
#ProtectSystem=strict
#ProtectHome=true
#PrivateNetwork=true
# run as unprivileged user
User=lklfuse
Group=lklfuse
ExecCondition=/bin/bash -c "udevadm info -q env -x --property=ID_FS_TYPE -n \"%I\" > ${RUNTIME_DIRECTORY}/udev.env"
ExecStart=/bin/bash -c ". ${RUNTIME_DIRECTORY}/udev.env; rm ${RUNTIME_DIRECTORY}/udev.env; /usr/bin/lklfuse -f -ofsname=\"/dev/%I\",subtype=\"lkl.$ID_FS_TYPE\",type=\"$ID_FS_TYPE\" $LKLFUSE_ARGS \"/dev/%I\" $RUNTIME_DIRECTORY"

[Install]
WantedBy=default.target
Loading