1
0
mirror of https://github.com/libretro/Lakka-LibreELEC.git synced 2024-11-25 11:56:18 +00:00
Lakka-LibreELEC/packages/sysutils/udevil/udev.d/95-udevil-mount.rules
adufray 9a7a7f5467
Update packages/sysutils/udevil/udev.d/95-udevil-mount.rules
Co-Authored-By: MilhouseVH <MilhouseVH@users.noreply.github.com>
2019-07-04 11:48:08 -05:00

31 lines
1.1 KiB
Plaintext

# dont run in "installer" mode
IMPORT{cmdline}="installer"
ENV{installer}=="1", GOTO="exit"
# check for blockdevices, /dev/sd*, /dev/sr*, /dev/mmc*, and /dev/nvme*
SUBSYSTEM!="block", KERNEL!="sd*|sr*|mmc*|nvme*", 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*, /dev/mmc*, and /dev/nvme* with partitions/disk and filesystems only, and /dev/sr* disks only
KERNEL=="sd*|mmc*|nvme*", 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"