heavily simplify list-usb-drives
This commit is contained in:
11
overlays.nix
11
overlays.nix
@@ -48,20 +48,11 @@ final: prev: {
|
|||||||
name = "list-usb-drives";
|
name = "list-usb-drives";
|
||||||
runtimeInputs = with prev; [
|
runtimeInputs = with prev; [
|
||||||
findutils
|
findutils
|
||||||
gawk
|
|
||||||
coreutils
|
coreutils
|
||||||
gnugrep
|
|
||||||
util-linux
|
|
||||||
];
|
|
||||||
|
|
||||||
excludeShellChecks = [
|
|
||||||
"SC2086"
|
|
||||||
"SC2157"
|
|
||||||
"SC2155"
|
|
||||||
];
|
];
|
||||||
|
|
||||||
text = ''
|
text = ''
|
||||||
find "$DISK_BY_ID_DIR" -name "usb*" | grep -v "part[0-9]\$" | while read -r drive; do lsblk -no model,serial "$drive" | head -n1 | tr -d '\n' | tr " " "_" && echo -e " $(echo \"$drive\" | cut -d':' -f2-)"; done | column -t --table-columns=DRIVE,BAY | sort -n -k 2
|
find "/dev/disk/by-id" -name "usb*" -not -name "*-part[0-9]" -printf "%f\n" | sed 's/^usb\-//g' | sed 's/\-[0-9]*\:/ /g' | column -t --table-columns=DRIVE,BAY | sort -n -k 2
|
||||||
'';
|
'';
|
||||||
};
|
};
|
||||||
}
|
}
|
||||||
|
|||||||
Reference in New Issue
Block a user