mirror of
https://github.com/iiab/iiab.git
synced 2025-03-09 15:40:17 +00:00
use systemd to start usbmount from udev
This commit is contained in:
parent
7605b5e56c
commit
9c3ec4186a
3 changed files with 24 additions and 0 deletions
5
roles/network/templates/network/usbmount.rules.j2
Normal file
5
roles/network/templates/network/usbmount.rules.j2
Normal file
|
@ -0,0 +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"
|
||||||
|
|
11
roles/network/templates/network/usbmount@.service.j2
Normal file
11
roles/network/templates/network/usbmount@.service.j2
Normal file
|
@ -0,0 +1,11 @@
|
||||||
|
[Unit]
|
||||||
|
BindTo=%i.device
|
||||||
|
After=%i.device
|
||||||
|
|
||||||
|
[Service]
|
||||||
|
Type=oneshot
|
||||||
|
TimeoutStartSec=0
|
||||||
|
Environment=DEVNAME=%I
|
||||||
|
ExecStart=/usr/share/usbmount/usbmount add
|
||||||
|
RemainAfterExit=yes
|
||||||
|
|
|
@ -15,6 +15,14 @@
|
||||||
mode: 0751
|
mode: 0751
|
||||||
when: usb_lib_enabled
|
when: usb_lib_enabled
|
||||||
|
|
||||||
|
- name: Install udev to systemd link -> usbmount
|
||||||
|
template:
|
||||||
|
src: "{{ item.src }}"
|
||||||
|
dest: "{{ item.dest }}"
|
||||||
|
with_items:
|
||||||
|
- { src: 'usbmount@.service.j2' , dest: '/etc/systemd/system/usbmount@.service' }
|
||||||
|
- { src: 'usbmount.rules.j2' , dest: '/etc/udev/rules.d/usbmount.rules' }
|
||||||
|
|
||||||
- name: Copy umount file to usbmount when enabled
|
- name: Copy umount file to usbmount when enabled
|
||||||
template:
|
template:
|
||||||
src: umount.d/70-usb-library
|
src: umount.d/70-usb-library
|
||||||
|
|
Loading…
Add table
Add a link
Reference in a new issue