Merge pull request #763 from darko-poljak/bugfix/disks-explorer-fallback
explorer/disks: do fallback right, in a POSIX way
This commit is contained in:
commit
c8bf78d651
1 changed files with 12 additions and 12 deletions
|
@ -1,27 +1,27 @@
|
||||||
#!/bin/sh -e
|
#!/bin/sh -e
|
||||||
|
|
||||||
os="$( "$__explorer/os" )"
|
uname_s="$(uname -s)"
|
||||||
|
|
||||||
case "$os" in
|
case "${uname_s}" in
|
||||||
freebsd)
|
FreeBSD)
|
||||||
sysctl -n kern.disks
|
sysctl -n kern.disks
|
||||||
;;
|
;;
|
||||||
openbsd)
|
OpenBSD|NetBSD)
|
||||||
sysctl -n hw.disknames | grep -Eo '[sw]d[0-9]+' | xargs
|
sysctl -n hw.disknames | grep -Eo '[lsw]d[0-9]+' | xargs
|
||||||
;;
|
;;
|
||||||
netbsd)
|
Linux)
|
||||||
sysctl -n hw.disknames | grep -Eo '[lsw]d[0-9]' | xargs
|
|
||||||
;;
|
|
||||||
*)
|
|
||||||
# hopefully everything else is linux
|
|
||||||
if command -v lsblk > /dev/null
|
if command -v lsblk > /dev/null
|
||||||
then
|
then
|
||||||
# exclude ram disks, floppies and cdroms
|
# exclude ram disks, floppies and cdroms
|
||||||
# https://www.kernel.org/doc/Documentation/admin-guide/devices.txt
|
# https://www.kernel.org/doc/Documentation/admin-guide/devices.txt
|
||||||
lsblk -e 1,2,11 -dno name | xargs
|
lsblk -e 1,2,11 -dno name | xargs
|
||||||
else
|
else
|
||||||
# fallback
|
printf "%s operating system without lsblk is not supported, if you can please submit a patch\n" "${uname_s}" >&2
|
||||||
cd /dev && echo [vsh]d?
|
exit 1
|
||||||
fi
|
fi
|
||||||
;;
|
;;
|
||||||
|
*)
|
||||||
|
printf "%s operating system is not supported, if you can please submit a patch\n" "${uname_s}" >&2
|
||||||
|
exit 1
|
||||||
|
;;
|
||||||
esac
|
esac
|
||||||
|
|
Loading…
Reference in a new issue