I need to have udev mount a USB device that has raw data, which appears like /dev/sdc, but in the same time if another stick has partitions I only need to have folders mounted only for those partitions.
I have attempted with a udev rules like:
ACTION=="add", ENV{myBusID}!="", ENV{myDevID}!="", ENV{myPartition}!="", ENV{dir_name}="usb-%k-%E{myBusID}-%E{myDevID}-%E{myPartition}", GOTO="skip_device"
#Set mount directory for partitionaless sticks
SUBSYSTEM=="block", ACTION=="add", ENV{myBusID}!="", ENV{myDevID}!="", ENV{myPartition}=="", ENV{dir_name}="usb-%k-%E{myBusID}-%E{myDevID}--%E{myPartition}"
#Label
LABEL="skip_device
However, with the above example I will have a folder created for the device too if the USB stick has partitions.
A use-case would be buying a brand new USB stick, stick it in a Windows device, format it VFAT and then insert it in the Linux system.
Mentions: I cannot use udisks or other similar software, I'm quite bound to have this running by using udev rules.