diff options
author | Vikas Kushwaha <dev@vikas.rocks> | 2024-11-21 13:30:52 +0530 |
---|---|---|
committer | Vikas Kushwaha <dev@vikas.rocks> | 2024-11-21 13:30:52 +0530 |
commit | 5c916d69d457101326803eb076a746060e3618cf (patch) | |
tree | d6fce3256eede1c1bf78fb6a1be75b9cc4b84cee /.local/bin/automountd |
Moved from github
Diffstat (limited to '.local/bin/automountd')
-rwxr-xr-x | .local/bin/automountd | 12 |
1 files changed, 12 insertions, 0 deletions
diff --git a/.local/bin/automountd b/.local/bin/automountd new file mode 100755 index 0000000..f09871f --- /dev/null +++ b/.local/bin/automountd @@ -0,0 +1,12 @@ +#!/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 |