Ways to query udiskie for informationSee original GitHub issue
I’m trying to automate some stuff right now (basically mount a specific LUKS partition as part of a bigger process) which requires me to figure out the current device ID of a partition. While this is almost trivial as root (parsing the output of tools like
lsblk) it’s a lot more tedious to do as a regular user.
I’m not even sure yet what the best way of implementing it will be. All I really need is a list of devices managed via udiskie/udisks2 (typically those not managed by
/etc/fstab) with device file, file system, uuid, label, mount point (if any) and maybe size. So far I’ve been trying to build a bash script but the output of
udisksctl is quite annoying to parse and working with dbus from bash is just plain masochism. You’d think that info is easy to get but alas…
So I could think of two ways to make this work in conjunction with udiskie:
- A cli tool like
udiskie-infocould be used to access information in simple readable format. For example
udiskie-infocould output a simple list of block devices mounted/mountable via udisks
udiskie-info --blkidcould output information in the typical
blkidformatting. (In case anyone is wondering, native
blkiddoesn’t return reliable information when run as non-root.)
- The output formatting options of
lsblkcould also serve as inspiration.
- If udiskie were to provide a (documented) Python API people could use that in a simple Python script and call it where needed. I’d really like that, actually.
Let me know what you think. If you know a better way of doing what I’m trying to do I’ll be happy as well.
- Created 7 years ago
- Comments:7 (4 by maintainers)
Top GitHub Comments
I’ve added a very basic
udiskie-info. However, my main concern was a use-case of my own, so it may not address all your needs. Let me know if you’d like something changed/added or otherwise feel free to close the issue.
(Note that the exact command line interface may still change. This is also the reason that I will not add “official” documentation for this utility yet.)
At this time, you can only have one output column, but several filters.
That’s really cool, thanks for adding!
(btw it didn’t quite work when you mentioned it but now it does.)