2019-03-19 22:13:24 +00:00
|
|
|
#!/bin/sh -e
|
|
|
|
|
2019-04-12 18:41:05 +00:00
|
|
|
os="$( "$__explorer/os" )"
|
|
|
|
|
2019-03-19 22:13:24 +00:00
|
|
|
case "$os" in
|
2019-04-12 18:41:05 +00:00
|
|
|
freebsd)
|
|
|
|
sysctl -n kern.disks
|
|
|
|
;;
|
2019-03-19 22:13:24 +00:00
|
|
|
openbsd)
|
2019-04-12 18:41:05 +00:00
|
|
|
sysctl -n hw.disknames | grep -Eo '[sw]d[0-9]+' | xargs
|
|
|
|
;;
|
|
|
|
netbsd)
|
|
|
|
sysctl -n hw.disknames | grep -Eo '[lsw]d[0-9]' | xargs
|
2019-03-19 22:13:24 +00:00
|
|
|
;;
|
|
|
|
*)
|
2019-04-12 18:41:05 +00:00
|
|
|
# hopefully everything else is linux
|
|
|
|
if command -v lsblk > /dev/null
|
|
|
|
then
|
2019-04-17 18:50:39 +00:00
|
|
|
# exclude ram disks, floppies and cdroms
|
2019-04-12 18:41:05 +00:00
|
|
|
# https://www.kernel.org/doc/Documentation/admin-guide/devices.txt
|
|
|
|
lsblk -e 1,2,11 -dno name | xargs
|
|
|
|
else
|
|
|
|
# fallback
|
2019-04-17 18:50:39 +00:00
|
|
|
cd /dev && echo [vsh]d?
|
2019-04-12 18:41:05 +00:00
|
|
|
fi
|
2019-03-19 22:13:24 +00:00
|
|
|
;;
|
|
|
|
esac
|