summaryrefslogtreecommitdiff
path: root/.local/bin/automountd
diff options
context:
space:
mode:
authorVikas Kushwaha <dev@vikas.rocks>2024-11-21 13:30:52 +0530
committerVikas Kushwaha <dev@vikas.rocks>2024-11-21 13:30:52 +0530
commit5c916d69d457101326803eb076a746060e3618cf (patch)
treed6fce3256eede1c1bf78fb6a1be75b9cc4b84cee /.local/bin/automountd
Moved from github
Diffstat (limited to '.local/bin/automountd')
-rwxr-xr-x.local/bin/automountd12
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