2026-03-05 09:24:59 +00:00
|
|
|
# Using udev to mount newly attached usb drives doesn't work.
|
|
|
|
|
# https://unix.stackexchange.com/a/507150/223286
|
|
|
|
|
# So, we depend on udisks to mount the disk. *Then* we want to
|
2026-03-06 09:04:11 +00:00
|
|
|
# to setup the symlink.
|
2026-03-05 09:24:59 +00:00
|
|
|
# We can run the script immediately because it waits for the disk
|
|
|
|
|
# to be mounted.
|
|
|
|
|
|
|
|
|
|
# Mount newly inserted drives, creating the directory if it doesn't exist
|
|
|
|
|
ACTION=="add", KERNEL=="sd[a-z][1-9]", ENV{ID_BUS}=="usb", TAG+="systemd", ENV{SYSTEMD_WANTS}+="udisks2-mount@%k.service", ENV{SYSTEMD_WANTS}+="serve-usb@%k.service"
|
|
|
|
|
|
|
|
|
|
# When the disk is `unmounted, the symlink will just point to a now-empty directory.
|