33 lines
1.3 KiB
Bash
33 lines
1.3 KiB
Bash
#!/usr/bin/env bash
|
|
set +e
|
|
function output_line() {
|
|
mm_path="$("$APP_CMD" standardize "$1")"
|
|
mm_label="$(blkid -o value -s LABEL "$mm_path")"
|
|
mm_size="$(lsblk -ndpo SIZE "$mm_path")"
|
|
mm_size="${mm_size// /}"
|
|
mm_type="$(lsblk -ndpo TYPE "$mm_path")"
|
|
mm_format="$(blkid -o value -s TYPE "$mm_path")"
|
|
mm_parent="$(lsblk -ndpo PKNAME "$mm_path")" # This is broken on devices of TYPE crypt. `lsblk -l -o NAME,PKNAME` yields PKNAME correctly. But `lsblk -l -o NAME,PKNAME /dev/mapper/cryptdisk` does not.
|
|
mm_mountpath="$(findmnt -no TARGET -S "$mm_path")"
|
|
mm_uuid="$(lsblk -ndpo UUID "$mm_path")"
|
|
mm_partuuid="$(lsblk -ndpo PARTUUID "$mm_path")"
|
|
mm_string="mm_path='${mm_path//\'/}'"
|
|
mm_string="${mm_string}; mm_label='${mm_label//\'/}'"
|
|
mm_string="${mm_string}; mm_size='${mm_size//\'/}'"
|
|
mm_string="${mm_string}; mm_type='${mm_type//\'/}'"
|
|
mm_string="${mm_string}; mm_format='${mm_format//\'/}'"
|
|
mm_string="${mm_string}; mm_parent='${mm_parent//\'/}'"
|
|
mm_string="${mm_string}; mm_mountpath='${mm_mountpath//\'/}'"
|
|
mm_string="${mm_string}; mm_uuid='${mm_uuid//\'/}'"
|
|
mm_string="${mm_string}; mm_partuuid='${mm_partuuid//\'/}'"
|
|
echo "$mm_string"
|
|
}
|
|
|
|
if [ "$2" = "" ]; then
|
|
lsblk -npo PATH | while read mm_tpath; do
|
|
output_line "$mm_tpath"
|
|
done
|
|
else
|
|
output_line "$2"
|
|
fi
|