rc.subr: update to version 20210830

This introduces the function load_rc_config_var(), as provided by NetBSD's own
rc.subr.

Tested on NetBSD/amd64 (unprivileged).
This commit is contained in:
khorben 2021-08-30 21:45:02 +00:00
parent 5b13b51d41
commit 59c52efd5e
2 changed files with 22 additions and 3 deletions

View file

@ -1,7 +1,7 @@
# $NetBSD: Makefile,v 1.35 2021/05/30 23:46:26 khorben Exp $
# $NetBSD: Makefile,v 1.36 2021/08/30 21:45:02 khorben Exp $
#
PKGNAME= rc.subr-20210517
PKGNAME= rc.subr-20210830
CATEGORIES= pkgtools
MAINTAINER= sbd@NetBSD.org

View file

@ -1,4 +1,4 @@
# $NetBSD: rc.subr,v 1.17 2021/05/30 23:46:26 khorben Exp $
# $NetBSD: rc.subr,v 1.18 2021/08/30 21:45:02 khorben Exp $
#
# Copyright (c) 1997-2002 The NetBSD Foundation, Inc.
# All rights reserved.
@ -869,6 +869,25 @@ load_rc_config()
fi
}
#
# load_rc_config_var cmd var
# Read the rc.conf(5) var for cmd and set in the
# current shell, using load_rc_config in a subshell to prevent
# unwanted side effects from other variable assignments.
#
load_rc_config_var()
{
if [ $# -ne 2 ]; then
err 3 'USAGE: load_rc_config_var cmd var'
fi
eval $(eval '(
load_rc_config '$1' >/dev/null;
if [ -n "${'$2'}" ] || [ "${'$2'-UNSET}" != "UNSET" ]; then
echo '$2'=\'\''${'$2'}\'\'';
fi
)' )
}
#
# rc_usage commands