Created Saturday 31 December 2016
We'll need Udisk2 to read/write to our external devices and Udevil to automatic mount the devices when plugged in. We'll also add some extra partition scheme support - fat and ntfs to be specific.
Usage
# Once the installation steps below has been completed, devices should mount automatic.
# Devices will be mounted at /media/<USER_NAME>/<DEVICE_NAME>
# You need to manual unmount the device once you're done (always do this before unplugging)
$ udevil unmount /media/<USER_NAME>/<DEVICE_NAME>
Installation
# For ntfs and fat support
$ pacman -S ntfs-3g dosfstools
# For mount/auto-mount
$ pacman -S udisks2 udevil
# Remove the SUID permission from Udevil (with sudo)
$ chmod u+s,go-s,ugo+x /usr/bin/udevil
# Enable the service file, taking the username as an argument
$ systemctl enable devmon@<USER_NAME>.service
# Create a file in /etc/polkit-1/rules.d/50-udevil.rules
polkit.addRule(function(action, subject) {
var YES = polkit.Result.YES;
// NOTE: there must be a comma at the end of each line except for the last:
var permission = {
// required for udisks1:
"org.freedesktop.udisks.filesystem-mount": YES,
"org.freedesktop.udisks.luks-unlock": YES,
"org.freedesktop.udisks.drive-eject": YES,
"org.freedesktop.udisks.drive-detach": YES,
// required for udisks2:
"org.freedesktop.udisks2.filesystem-mount": YES,
"org.freedesktop.udisks2.encrypted-unlock": YES,
"org.freedesktop.udisks2.eject-media": YES,
"org.freedesktop.udisks2.power-off-drive": YES,
// required for udisks2 if using udiskie from another seat (e.g. systemd):
"org.freedesktop.udisks2.filesystem-mount-other-seat": YES,
"org.freedesktop.udisks2.filesystem-unmount-others": YES,
"org.freedesktop.udisks2.encrypted-unlock-other-seat": YES,
"org.freedesktop.udisks2.eject-media-other-seat": YES,
"org.freedesktop.udisks2.power-off-drive-other-seat": YES
};
if (subject.isInGroup("storage")) {
return permission[action.id];
}
});