pkgsrc-Changes archive

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index][Old Index]

CVS commit: pkgsrc/pkgtools/rc.subr



Module Name:    pkgsrc
Committed By:   khorben
Date:           Mon Aug 30 21:45:02 UTC 2021

Modified Files:
        pkgsrc/pkgtools/rc.subr: Makefile
        pkgsrc/pkgtools/rc.subr/files: rc.subr

Log Message:
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).


To generate a diff of this commit:
cvs rdiff -u -r1.35 -r1.36 pkgsrc/pkgtools/rc.subr/Makefile
cvs rdiff -u -r1.17 -r1.18 pkgsrc/pkgtools/rc.subr/files/rc.subr

Please note that diffs are not public domain; they are subject to the
copyright notices on the relevant files.

Modified files:

Index: pkgsrc/pkgtools/rc.subr/Makefile
diff -u pkgsrc/pkgtools/rc.subr/Makefile:1.35 pkgsrc/pkgtools/rc.subr/Makefile:1.36
--- pkgsrc/pkgtools/rc.subr/Makefile:1.35       Sun May 30 23:46:26 2021
+++ pkgsrc/pkgtools/rc.subr/Makefile    Mon Aug 30 21:45:02 2021
@@ -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

Index: pkgsrc/pkgtools/rc.subr/files/rc.subr
diff -u pkgsrc/pkgtools/rc.subr/files/rc.subr:1.17 pkgsrc/pkgtools/rc.subr/files/rc.subr:1.18
--- pkgsrc/pkgtools/rc.subr/files/rc.subr:1.17  Sun May 30 23:46:26 2021
+++ pkgsrc/pkgtools/rc.subr/files/rc.subr       Mon Aug 30 21:45:02 2021
@@ -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



Home | Main Index | Thread Index | Old Index