mirror of
https://mzte.de/git/LordMZTE/dotfiles.git
synced 2024-11-11 20:43:00 +01:00
nushell: add some udisksctl helper subcommands
This commit is contained in:
parent
c70ddf74dc
commit
ff900d0b98
1 changed files with 18 additions and 0 deletions
18
.config/nushell/conf.d/99-udisks.nu
Normal file
18
.config/nushell/conf.d/99-udisks.nu
Normal file
|
@ -0,0 +1,18 @@
|
|||
def "udisksctl lockmount" [--block-device (-b): path] {
|
||||
let cryptdev = udisksctl unlock -b $block_device | parse "{_} as {dev}." | get 0.dev
|
||||
udisksctl mount -b $cryptdev
|
||||
}
|
||||
|
||||
def "udisksctl lockumount" [--block-device (-b): path] {
|
||||
let plain_dev = udisksctl info -b $block_device | parse -r "CleartextDevice: +'(?P<dev>.*)'" | get 0.dev
|
||||
|
||||
# This is borked on the udisksctl side
|
||||
#udisksctl unmount -p $plain_dev
|
||||
(dbus call --system
|
||||
--dest org.freedesktop.UDisks2
|
||||
$plain_dev
|
||||
org.freedesktop.UDisks2.Filesystem
|
||||
Unmount [])
|
||||
|
||||
udisksctl lock -b $block_device
|
||||
}
|
Loading…
Reference in a new issue