[systemd-devel] Recommended way to automount USB drives and trigger actions?

Alejandro Exojo aexojo at modpow.es
Mon Mar 3 01:29:37 PST 2014


Hi.

I'm asked to do the following "upgrade" procedure to a custom embedded
system: plug an USB drive and upgrade our application (that runs as a
systemd service) from the contents of the drive. Is a bit ugly, but is
a temporary workaround.

I've thought of doing it with:

1. Automounting USB drives when they are plugged.
2. A oneshot service that calls pkcon or the underlying package
manager, and that is "WantedBy=media-usbdrive.mount" (the package
already has the machinery to restart the service).

I'm having doubts on the first part. I've already done the
automounting on some cases with udev rules, but I'm completely unsure
if is preferred to be done with .mount and .automount unit files. I
suppose I can do anything with udev rules that trigger commands too.

If you have any advice, I will be very glad to read it.
Thank you.

PS: Sorry if is not the right place for this, but there is no
systemd-users list. :-)
And since I've bothered you anyway, let me add that switching from
sysvinit to systemd has been a huge boon to our usability and
development. We are using the journal quite extensively to debug,
since we have no other UI that printing stuff to stderr. I think you
deserve to know, after all the destructive criticism that you tend to
receive.

-- 
Alejandro Exojo Piqueras

ModpoW, S.L.
Technova LaSalle | Sant Joan de la Salle 42 | 08022 Barcelona | www.modpow.es


More information about the systemd-devel mailing list