pkgsrc-Changes-HG archive
[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index][Old Index]
[pkgsrc/trunk]: pkgsrc/pkgtools/rc.subr rc.subr: update to version 20210830
details: https://anonhg.NetBSD.org/pkgsrc/rev/c91887ace6ad
branches: trunk
changeset: 457702:c91887ace6ad
user: khorben <khorben%pkgsrc.org@localhost>
date: Mon Aug 30 21:45:02 2021 +0000
description:
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).
diffstat:
pkgtools/rc.subr/Makefile | 4 ++--
pkgtools/rc.subr/files/rc.subr | 21 ++++++++++++++++++++-
2 files changed, 22 insertions(+), 3 deletions(-)
diffs (48 lines):
diff -r 6175d05aed0b -r c91887ace6ad pkgtools/rc.subr/Makefile
--- a/pkgtools/rc.subr/Makefile Mon Aug 30 20:22:44 2021 +0000
+++ b/pkgtools/rc.subr/Makefile Mon Aug 30 21:45:02 2021 +0000
@@ -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@localhost
diff -r 6175d05aed0b -r c91887ace6ad pkgtools/rc.subr/files/rc.subr
--- a/pkgtools/rc.subr/files/rc.subr Mon Aug 30 20:22:44 2021 +0000
+++ b/pkgtools/rc.subr/files/rc.subr Mon Aug 30 21:45:02 2021 +0000
@@ -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 @@
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
Home |
Main Index |
Thread Index |
Old Index