mirror of
https://github.com/jorgevasquezp/my_linux_prefs.git
synced 2026-09-16 18:02:27 +00:00
13 lines
358 B
Bash
13 lines
358 B
Bash
#!/bin/sh
|
|||
|
|
|
||
|
|
pathtoname() {
|
||
|
|
udevadm info -p /sys/"$1" | awk -v FS== '/DEVNAME/ {print $2}'
|
||
|
|
}
|
||
|
|
|
||
|
|
stdbuf -oL -- udevadm monitor --udev -s block | while read -r -- _ _ event devpath _; do
|
||
|
|
if [ "$event" = add ]; then
|
||
|
|
devname=$(pathtoname "$devpath")
|
||
|
|
udisksctl mount --block-device "$devname" --no-user-interaction
|
||
|
|
fi
|
||
|
|
done
|