mirror of
https://github.com/basecamp/omarchy.git
synced 2026-02-17 15:25:37 +00:00
30 lines
719 B
Bash
Executable File
30 lines
719 B
Bash
Executable File
#!/bin/bash
|
|
|
|
# Returns drive information about a given volumne, like /dev/nvme0, which is used by omarchy-drive-select.
|
|
|
|
if (($# == 0)); then
|
|
echo "Usage: omarchy-drive-info [/dev/drive]"
|
|
exit 1
|
|
else
|
|
drive="$1"
|
|
fi
|
|
|
|
# Find the root drive in case we are looking at partitions
|
|
root_drive=$(lsblk -no PKNAME "$drive" 2>/dev/null | tail -n1)
|
|
if [[ -n "$root_drive" ]]; then
|
|
root_drive="/dev/$root_drive"
|
|
else
|
|
root_drive="$drive"
|
|
fi
|
|
|
|
# Get basic disk information
|
|
size=$(lsblk -dno SIZE "$drive" 2>/dev/null)
|
|
model=$(lsblk -dno MODEL "$root_drive" 2>/dev/null)
|
|
|
|
# Format display string
|
|
display="$drive"
|
|
[[ -n "$size" ]] && display="$display ($size)"
|
|
[[ -n "$model" ]] && display="$display - $model"
|
|
|
|
echo "$display"
|