udevil: mount by systemd service

... or fuse fails with systemd and cgroups in kernel.
no long runing tasks should ever be started from udev rules
This commit is contained in:
Stefan Saraev 2013-09-15 19:27:45 +03:00
parent 3ec7748d63
commit 61824e5326
3 changed files with 15 additions and 3 deletions

View File

@ -52,3 +52,7 @@ post_makeinstall_target() {
mkdir -p $INSTALL/usr/bin
cp -PR src/udevil $INSTALL/usr/bin
}
post_install() {
enable_service udevil-mount@.service
}

View File

@ -0,0 +1,8 @@
[Unit]
Description=Udevil mount service
[Service]
Type=oneshot
ExecStart=/usr/bin/udevil --mount %I
ExecStop=/usr/bin/udevil --umount %I
RemainAfterExit=yes

View File

@ -12,13 +12,13 @@ GOTO="exit"
# mount or umount for hdds
LABEL="harddisk"
ACTION=="add", RUN+="/usr/bin/udevil --mount /dev/%k"
ACTION=="remove", RUN+="/usr/bin/udevil --umount /dev/%k"
ACTION=="add", RUN+="/bin/systemctl restart udevil-mount@/dev/%k.service"
ACTION=="remove", RUN+="/bin/systemctl stop udevil-mount@/dev/%k.service"
GOTO="exit"
# mount or umount for opticals
LABEL="optical"
ACTION=="add|change", RUN+="/usr/bin/udevil --umount /dev/%k", RUN+="/usr/bin/udevil --mount /dev/%k"
ACTION=="add|change", RUN+="/bin/systemctl restart udevil-mount@/dev/%k.service"
GOTO="exit"
# Exit