diff --git a/apertis-ospack-minimal.yaml b/apertis-ospack-minimal.yaml index 6954500320813dad03d9a8290900faeed2f2a946..fac28a3a2ab8b09a6c5fff6da7d7659ee2735fc3 100644 --- a/apertis-ospack-minimal.yaml +++ b/apertis-ospack-minimal.yaml @@ -37,6 +37,7 @@ actions: - apt-transport-https - apertis-customizations - initramfs-tools + - udisks2 - action: apt description: "Base packages" @@ -100,6 +101,9 @@ actions: - action: overlay source: overlays/minimal-ribchester-polkit-rules + - action: overlay + source: overlays/minimal-automount-rules + - action: run chroot: true script: scripts/add-xdg-user-metadata.sh diff --git a/overlays/minimal-automount-rules/etc/udev/rules.d/99-udisks2.rules b/overlays/minimal-automount-rules/etc/udev/rules.d/99-udisks2.rules new file mode 100644 index 0000000000000000000000000000000000000000..2a1035b776e205b45f669e3cb7c5483b451fd3fa --- /dev/null +++ b/overlays/minimal-automount-rules/etc/udev/rules.d/99-udisks2.rules @@ -0,0 +1,4 @@ +ENV{ID_FS_USAGE}=="filesystem", ENV{UDISKS_FILESYSTEM_SHARED}="1" + +KERNEL=="sd*", SUBSYSTEMS=="usb", ACTION=="add", ATTR{partition}=="1", PROGRAM="/bin/systemd-escape -p --template=usbmount@.service $env{DEVNAME}", ENV{SYSTEMD_WANTS}+="%c" +KERNEL=="sd*", SUBSYSTEMS=="usb", ACTION=="remove", RUN+="/usr/bin/udisksctl unmount -f -b $env{DEVNAME}" diff --git a/overlays/minimal-automount-rules/lib/systemd/system/default.target.wants/usbmount@.service b/overlays/minimal-automount-rules/lib/systemd/system/default.target.wants/usbmount@.service new file mode 120000 index 0000000000000000000000000000000000000000..e60fd0d3a2861a902a4df59a0c089a8b6bd4e09c --- /dev/null +++ b/overlays/minimal-automount-rules/lib/systemd/system/default.target.wants/usbmount@.service @@ -0,0 +1 @@ +../usbmount@.service \ No newline at end of file diff --git a/overlays/minimal-automount-rules/lib/systemd/system/usbmount@.service b/overlays/minimal-automount-rules/lib/systemd/system/usbmount@.service new file mode 100644 index 0000000000000000000000000000000000000000..b9c9a3f0abd0061e6e926f83afcf3e7daa432b29 --- /dev/null +++ b/overlays/minimal-automount-rules/lib/systemd/system/usbmount@.service @@ -0,0 +1,10 @@ +[Unit] +BindTo=%i.device +After=%i.device + +[Service] +Type=oneshot +TimeoutStartSec=0 +ExecStart=/usr/bin/udisksctl mount -o ro -b /%I +RemainAfterExit=yes +StandardOutput=syslog