# dont run in "installer" mode IMPORT{cmdline}="installer" ENV{installer}=="1", GOTO="exit" # check for blockdevices, /dev/sd*, /dev/sr* and /dev/mmc* SUBSYSTEM!="block", KERNEL!="sd*|sr*|mmc*", GOTO="exit" # check for special partitions we dont want mount IMPORT{builtin}="blkid" ENV{ID_FS_LABEL}=="EFI|BOOT|Recovery|RECOVERY|SETTINGS|boot|root0|share0", GOTO="exit" # /dev/sd* and /dev/mmc* ith partitions/disk and filesystems only and /dev/sr* disks only KERNEL=="sd*|mmc*", ENV{DEVTYPE}=="partition|disk", ENV{ID_FS_USAGE}=="filesystem", GOTO="harddisk" KERNEL=="sr*", ENV{DEVTYPE}=="disk", GOTO="optical" GOTO="exit" # mount or umount for hdds LABEL="harddisk" ACTION=="add", PROGRAM="/usr/bin/sh -c '/usr/bin/grep -E ^/dev/%k\ /proc/mounts || true'", RESULT=="", RUN+="/usr/bin/systemctl restart udevil-mount@/dev/%k.service" ACTION=="remove", RUN+="/usr/bin/systemctl stop udevil-mount@/dev/%k.service" GOTO="exit" # mount or umount for opticals LABEL="optical" ACTION=="add|change", RUN+="/usr/bin/systemctl restart udevil-mount@/dev/%k.service" GOTO="exit" # Exit LABEL="exit"