Disk : Add unlock function.
This commit is contained in:
parent
4b293ac1e9
commit
7e8d23496b
|
@ -11,5 +11,20 @@
|
||||||
function tdu() {
|
function tdu() {
|
||||||
du -sh --si "''${@}"
|
du -sh --si "''${@}"
|
||||||
}
|
}
|
||||||
|
|
||||||
|
# Unlock encrypted disk file.
|
||||||
|
# Usage: unlock <FILE>
|
||||||
|
function unlock() {
|
||||||
|
_filter() {
|
||||||
|
sed -e "s/.*\ a[st]\ //" -e "s/\.$//"
|
||||||
|
}
|
||||||
|
local file="''${1}"
|
||||||
|
local name=$(parse_alnum ''${file} | _filter)
|
||||||
|
local loop=$(udisksctl loop-setup -f "''${file}" | _filter)
|
||||||
|
local unlock=$(udisksctl unlock -b "''${loop}" | _filter)
|
||||||
|
local mount=$(udisksctl mount -b "''${unlock}" | _filter)
|
||||||
|
|
||||||
|
cd "''${mount}"
|
||||||
|
}
|
||||||
'';
|
'';
|
||||||
}
|
}
|
||||||
|
|
Loading…
Reference in a new issue