This is a tested replacement for udisks2-inhibit which avoids killing/restarting the daemon. It instead uses polkit's inotify by merely placing a symlink into /var/lib/polkit-1/localauthority/90-mandatory.d/ . Since we are only adding a new file (or rm it on cleanup), overlayfs' restricted inotify support actually seems good enough.
You can test quickly with
pkcheck -a org.freedesktop.udisks2.filesystem-mount -p $$; echo $?
This should give 0 ("allowed") normally, and 1 and "Not authorized." while you are running "sudo ./udisks2-inhibit sleep 5" or something such.
This is a tested replacement for udisks2-inhibit which avoids killing/restarting the daemon. It instead uses polkit's inotify by merely placing a symlink into /var/lib/ polkit- 1/localauthorit y/90-mandatory. d/ . Since we are only adding a new file (or rm it on cleanup), overlayfs' restricted inotify support actually seems good enough.
You can test quickly with
pkcheck -a org.freedesktop .udisks2. filesystem- mount -p $$; echo $?
This should give 0 ("allowed") normally, and 1 and "Not authorized." while you are running "sudo ./udisks2-inhibit sleep 5" or something such.