From c54dccf0a00fcb984e444123149a3a1d0343df2d Mon Sep 17 00:00:00 2001 From: Jerry Vonau Date: Sun, 8 Mar 2020 03:07:26 -0500 Subject: [PATCH 1/2] fix udev rules deletes the symlink when the device is yanked but the device is still mounted --- roles/usb_lib/templates/usbmount.rules.j2 | 8 ++++---- 1 file changed, 4 insertions(+), 4 deletions(-) diff --git a/roles/usb_lib/templates/usbmount.rules.j2 b/roles/usb_lib/templates/usbmount.rules.j2 index 0b1afd3e5..564186c5a 100644 --- a/roles/usb_lib/templates/usbmount.rules.j2 +++ b/roles/usb_lib/templates/usbmount.rules.j2 @@ -1,5 +1,5 @@ -KERNEL=="sd*", DRIVERS=="sbp2", ACTION=="add", PROGRAM="/bin/systemd-escape -p --template=usbmount@.service $env{DEVNAME}", ENV{SYSTEMD_WANTS}+="%c" -KERNEL=="sd*", SUBSYSTEMS=="usb", ACTION=="add", PROGRAM="/bin/systemd-escape -p --template=usbmount@.service $env{DEVNAME}", ENV{SYSTEMD_WANTS}+="%c" -KERNEL=="ub*", SUBSYSTEMS=="usb", ACTION=="add", PROGRAM="/bin/systemd-escape -p --template=usbmount@.service $env{DEVNAME}", ENV{SYSTEMD_WANTS}+="%c" -KERNEL=="sd*", ACTION=="remove", RUN+="/usr/share/usbmount/usbmount remove" +KERNEL=="sd*", DRIVERS=="sbp2", ACTION=="add", PROGRAM="/bin/systemd-escape -p --template=usbmount@.service $env{DEVNAME}", ENV{SYSTEMD_WANTS}+="%c" +KERNEL=="sd*", SUBSYSTEMS=="usb", ACTION=="add", PROGRAM="/bin/systemd-escape -p --template=usbmount@.service $env{DEVNAME}", ENV{SYSTEMD_WANTS}+="%c" +KERNEL=="ub*", SUBSYSTEMS=="usb", ACTION=="add", PROGRAM="/bin/systemd-escape -p --template=usbmount@.service $env{DEVNAME}", ENV{SYSTEMD_WANTS}+="%c" +KERNEL=="sd*", SUBSYSTEMS=="usb", ACTION=="remove", PROGRAM="/usr/share/usbmount/usbmount remove" From 4216ba6cb24cf2c92e342e2bef9355575cc73477 Mon Sep 17 00:00:00 2001 From: Jerry Vonau Date: Sun, 8 Mar 2020 05:53:43 -0500 Subject: [PATCH 2/2] cleanup mountpoint corrects usb0 usb1 usb2 from appearing due to not being unmounted with repeated insert/removal of devices --- roles/usb_lib/templates/usbmount@.service.j2 | 1 + 1 file changed, 1 insertion(+) diff --git a/roles/usb_lib/templates/usbmount@.service.j2 b/roles/usb_lib/templates/usbmount@.service.j2 index 513d4fb08..b8aa22387 100644 --- a/roles/usb_lib/templates/usbmount@.service.j2 +++ b/roles/usb_lib/templates/usbmount@.service.j2 @@ -8,5 +8,6 @@ Type=oneshot TimeoutStartSec=0 Environment=DEVNAME=%I ExecStart=/usr/share/usbmount/usbmount add +ExecStop=/bin/umount /%I RemainAfterExit=yes