reload-udev-rules: Add delay before copying files
Since *systemd* starts the *reload-udev-rules.service* unit as soon as any file in the `/run/containers/udev-rules` directory changes, the `cp` command may start before all of the files have been copied out of the container. If this happens, some of the rules will not get copied to the final path, and thus will not be processed by *udev*. Togive the container a chance to finish copying all of the files before we process them, we need a bit of a delay. Obviously, this is not a perfect solution, as it could potentially take longer than 250ms to copy the files in some cases, but hopefully those cases are rare enough to not worry about.master
parent
1738e4a1f1
commit
2a84d810e0
|
@ -4,6 +4,7 @@ ConditionDirectoryNotEmpty=/run/containers/udev-rules
|
|||
[Service]
|
||||
Type=oneshot
|
||||
ExecStartPre=/bin/mkdir -p /run/udev/rules.d
|
||||
ExecStart=/bin/sleep 0.25
|
||||
ExecStart=/bin/sh -c 'cp /run/containers/udev-rules/*.rules /run/udev/rules.d/'
|
||||
ExecStart=/usr/bin/udevadm control --reload
|
||||
ExecStart=/usr/bin/udevadm trigger
|
||||
|
|
Loading…
Reference in New Issue