forked from ungleich-public/cdist
[explorer/disks] Fix for NetBSD
When connecting over SSH and running /bin/sh, the PATH is missing sbin locations. sysctl is located at /sbin/sysctl on NetBSD.
This commit is contained in:
parent
49fc21ec47
commit
c6aba8d189
1 changed files with 9 additions and 5 deletions
|
@ -1,14 +1,20 @@
|
|||
#!/bin/sh
|
||||
#!/bin/sh -e
|
||||
|
||||
uname_s="$(uname -s)"
|
||||
|
||||
case "${uname_s}" in
|
||||
case $uname_s in
|
||||
FreeBSD)
|
||||
sysctl -n kern.disks
|
||||
;;
|
||||
OpenBSD|NetBSD)
|
||||
OpenBSD)
|
||||
sysctl -n hw.disknames | grep -Eo '[lsw]d[0-9]+' | xargs
|
||||
;;
|
||||
NetBSD)
|
||||
PATH="${PATH}:/usr/local/sbin:/usr/sbin:/sbin"
|
||||
sysctl -n hw.disknames \
|
||||
| awk 'BEGIN { RS = " " } /^[lsw]d[0-9]+/' \
|
||||
| xargs
|
||||
;;
|
||||
Linux)
|
||||
if command -v lsblk > /dev/null
|
||||
then
|
||||
|
@ -23,5 +29,3 @@ case "${uname_s}" in
|
|||
printf "Don't know how to list disks for %s operating system, if you can please submit a patch\n" "${uname_s}" >&2
|
||||
;;
|
||||
esac
|
||||
|
||||
exit 0
|
||||
|
|
Loading…
Reference in a new issue