forked from torvalds/linux
-
Notifications
You must be signed in to change notification settings - Fork 139
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Merge pull request #568 from ddiss/lklfuse_udev_systemd
lkl: systemd: add example udev and systemd service files
- Loading branch information
Showing
2 changed files
with
43 additions
and
0 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
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" |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
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[email protected] | ||
Requires[email protected] | ||
|
||
[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 |