[type/__sysctl] Fix on NetBSD

This commit is contained in:
Dennis Camera 2020-07-26 23:37:48 +02:00
parent 8b53f35ffa
commit 3a87a447d0
3 changed files with 16 additions and 2 deletions

View file

@ -1,4 +1,4 @@
#!/bin/sh #!/bin/sh -e
# #
# 2014 Steven Armstrong (steven-cdist at armstrong.cc) # 2014 Steven Armstrong (steven-cdist at armstrong.cc)
# #
@ -18,5 +18,10 @@
# along with cdist. If not, see <http://www.gnu.org/licenses/>. # along with cdist. If not, see <http://www.gnu.org/licenses/>.
# #
if test "$(uname -s)" = NetBSD
then
PATH=$(getconf PATH)
fi
# get the current runtime value # get the current runtime value
sysctl -n "$__object_id" || true sysctl -n "${__object_id}" || true

View file

@ -44,6 +44,8 @@ case "$os" in
flag='-w' flag='-w'
;; ;;
netbsd) netbsd)
# shellcheck disable=SC2016
echo 'PATH=$(getconf PATH)'
flag='-w' flag='-w'
;; ;;
freebsd|openbsd) freebsd|openbsd)

View file

@ -26,6 +26,13 @@ EXAMPLES
__sysctl net.ipv4.ip_forward --value 1 __sysctl net.ipv4.ip_forward --value 1
# On some operating systems, e.g. NetBSD, to prevent an error if the
# MIB style name does not exist (e.g. optional kernel components),
# name and value can be separated by `?=`. The same effect can be achieved
# in cdist by appending a `?` to the key:
__sysctl ddb.onpanic? --value -1
AUTHORS AUTHORS
------- -------