dragora-bug
[Top][All Lists]
Advanced

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

[Dragora-bug] pmount and udev


From: kelsoo
Subject: [Dragora-bug] pmount and udev
Date: Fri, 24 Jul 2015 22:57:09 +0100
User-agent: Riseup mail

Hi Dragorians

I have been trying to find a easy and light way to mount external drives via rox I found these links.

refs:

https://blog.debiania.in.ua/posts/2013-03-24-automounting-with-udev-and-pmount.html

http://www.monperrus.net/martin/automounting+usb+flash+drives+on+linux+with+udev+and+pmount

http://hakerdefo.blogspot.co.uk/2014/06/how-to-automount-usb-drives-and-memory_3.html

Then used a bash script with launcher icon in rox to run these scripts to mount and unmount external usbs.

pmount-usb

#!/bin/bash
pmount /dev/sdc1
pmount /dev/sdd1
pmount /dev/sde1
pmount /dev/sdf1
pmount /dev/sdg1
pmount /dev/sdh1
pmount /dev/sdi1
pmount /dev/sdj1
rox /media/

I have two internal  harddrives sda1, sdb1.

pumount-usb

#!/bin/bash
pumount /dev/sdc1
pumount /dev/sdd1
pumount /dev/sde1
pumount /dev/sdf1
pumount /dev/sdg1
pumount /dev/sdh1
pumount /dev/sdi1
pumount /dev/sdj1

It works fine for me and allows a normal user to mount and unmount external drives but has a few things that need sorted. Some of which maybe found here?

http://hakerdefo.blogspot.co.uk/2014/06/how-to-automount-usb-drives-and-memory_3.html

Until then the issues are.

1. It mounts all external drive so if you want to plug in another you need to unmount all and remount again. If you dont it will remount the same drive at another mount point. 2. It does not use UUID so or labels that reflect the real name of the drive. Maybe this is because it only uses udev and pmount?


I contacted Minoru at Selks request and asked him to drop into the irc channel, he did.

Here is a shortend summary:


selk: Minoru, we are trying to avoid udisks and company looking for a sane and lightweight alternative (or unbloated) if we can do this with eudev and mount(1), it would be great but we want to know your experience and what are you using in these days.

Minoru: well, I definitely hope you succeed, cause it's a damn shame I can't have A-grade automounting on my lightweight desktop. kelsoo: selk said: selk: 1. If we can do the same of pmount(1) with mount(1) kelsoo: selk: 2. How the devices are discovered to be handled for our (p)mount rules Minoru: okay, so re 1 (using mount instead of pmount). That's definitely possible, but will require more work on your part. pmount automates away the process of choosing options for mounting, creating the mountpoint and running mount(1) so if you don't want pmount as dependency, you can write a script that will run blkid or something to figure out what FS does the device contain, then run mount(1) with appropriate options as for the device discovery (question 2), I delegated that to udev. My blog post describes rules I wrote for the demon, so that when I plug something in, udev discovers it and runs my command (pmount) and as far as I recall, udev seem to be the cleanest and most logical way to approach that - this demon is responsible for the PnP, after all but the rules syntax is, er, rather unwieldy, so maybe you only want a generic rule that will react to *any* device that is plugged in, and run your program. And your program will be the one responsible to figure out if it's a disk, and what to do about it

selk: I understand, a wrapper using blkid, mount (and probably mountpoint)
selk: interesting
selk: yes, generic rules would be fine
selk: very nice Minoru

Minoru: oh, by the way, there's one thing that my rules probably won't cover, and that's cryptocontainers. I'm not sure, you have to check udev documentation, but I think my rules won't react. The gist is as follows: when you plug in a USB stick with a cryptocontainer on it (I'll use LUKS as example), you'll see just one device. file(1) will tell you it's LUKS, and blkid will as well. You then have to ask the user for password, then run cryptsetup(8). ...After that, a device will appear under /dev/mapper (it will be named however you want it to be) - that one you can mount, finally, with the workflow described above



according to Minoru, we need:

1. Eudev
2. Mount or Pmount (mount(1) ideally)
3. Rules for udev
4. A wrapper script to handle the devices
5. The crypto support.

Kelsoo



reply via email to

[Prev in Thread] Current Thread [Next in Thread]