2022-02-05 14:23:32 +00:00
|
|
|
# dont run in "installer" mode
|
|
|
|
IMPORT{cmdline}="installer"
|
|
|
|
ENV{installer}=="1", GOTO="exit"
|
|
|
|
|
2023-11-27 22:41:15 +00:00
|
|
|
# check for blockdevices, /dev/sd*, /dev/sr*
|
|
|
|
SUBSYSTEM!="block", KERNEL!="sd*|sr*", GOTO="exit"
|
2022-02-05 14:23:32 +00:00
|
|
|
|
|
|
|
# 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"
|
|
|
|
|
2023-11-27 22:41:15 +00:00
|
|
|
# /dev/sd* with partitions/disk and filesystems only and /dev/sr* disks only
|
|
|
|
KERNEL=="sd*", ENV{DEVTYPE}=="partition|disk", ENV{ID_FS_USAGE}=="filesystem", GOTO="harddisk"
|
2022-02-05 14:23:32 +00:00
|
|
|
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"
|
|
|
|
|