profile: Fallback to custom udisks-automount

master
Pierre Neidhardt 2018-04-01 13:38:29 +05:30
parent 3b429e3a32
commit 83c6396485
2 changed files with 15 additions and 0 deletions

13
.local/bin/udisks-automount Executable file
View File

@ -0,0 +1,13 @@
#!/bin/sh
## From https://wiki.archlinux.org/index.php/Udisks#udevadm_monitor.
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

View File

@ -151,6 +151,8 @@ if [ "$(uname -o)" = "GNU/Linux" ] ; then
udiskie &
elif command -v devmon >/dev/null 2>&1; then
devmon &
else
udisks-automount &
fi
fi