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 20210517



details:   https://anonhg.NetBSD.org/pkgsrc/rev/6de805ec2198
branches:  trunk
changeset: 453527:6de805ec2198
user:      khorben <khorben%pkgsrc.org@localhost>
date:      Sun May 30 23:46:26 2021 +0000

description:
rc.subr: update to version 20210517

This is part 2 to support additional platforms with the RC scripts provided in
pkgsrc, in privileged as well as in unprivileged mode, including on NetBSD.

These changes:
- install rc.subr to PKG_SYSCONFDIR if SYSCONFBASE is not /etc
- let RC scripts source rc.subr in PKG_SYSCONFDIR
- effectively allow unprivileged setups to run RC scripts easily
- in addition, give a chance for more platforms to run RC scripts

Tested in privileged and unprivileged modes on NetBSD/amd64, and unprivileged
mode on Darwin/amd64; submitted for review on tech-pkg@.

diffstat:

 pkgtools/rc.subr/Makefile              |  23 +++++++++++++++--------
 pkgtools/rc.subr/PLIST                 |   6 +++---
 pkgtools/rc.subr/files/rc.conf.example |   4 +---
 pkgtools/rc.subr/files/rc.subr         |  13 +++++++------
 4 files changed, 26 insertions(+), 20 deletions(-)

diffs (115 lines):

diff -r 5591ff640b7f -r 6de805ec2198 pkgtools/rc.subr/Makefile
--- a/pkgtools/rc.subr/Makefile Sun May 30 23:41:05 2021 +0000
+++ b/pkgtools/rc.subr/Makefile Sun May 30 23:46:26 2021 +0000
@@ -1,7 +1,7 @@
-# $NetBSD: Makefile,v 1.34 2020/03/22 13:21:05 tnn Exp $
+# $NetBSD: Makefile,v 1.35 2021/05/30 23:46:26 khorben Exp $
 #
 
-PKGNAME=               rc.subr-20181226
+PKGNAME=               rc.subr-20210517
 CATEGORIES=            pkgtools
 
 MAINTAINER=            sbd%NetBSD.org@localhost
@@ -10,27 +10,34 @@
 LICENSE=               original-bsd
 
 ONLY_FOR_PLATFORM=     Darwin-*-* FreeBSD-[0-4].*-* Interix-*-* IRIX*-*-*
-ONLY_FOR_PLATFORM+=    Linux-*-* OpenBSD-*-* QNX-*-* SunOS-*-*
+ONLY_FOR_PLATFORM+=    Linux-*-* NetBSD-*-* OpenBSD-*-* QNX-*-* SunOS-*-*
 
 NO_BUILD=              yes
 NO_CONFIGURE=          yes
-NOT_FOR_UNPRIVILEGED=  yes
 
 CHECK_FILES_SUPPORTED= no
+BUILD_DEFS+=           SYSCONFBASE
 BUILD_DEFS+=           RCD_SCRIPTS_DIR
 
+
+SUBST_CLASSES+=                subr
+SUBST_STAGE.subr=      post-extract
+SUBST_FILES.subr=      rc.subr
+SUBST_VARS.subr=       SYSCONFBASE
+
+PLIST_SUBST+=          SYSCONFBASE=${SYSCONFBASE:S/^\///}
 PLIST_SUBST+=          RCD_SCRIPTS_DIR=${RCD_SCRIPTS_DIR:S/^\///}
 
-CONF_FILES+=           etc/rc.conf.example etc/rc.conf
+CONF_FILES+=           ${SYSCONFBASE:S/^\///}/rc.conf.example ${SYSCONFBASE:S/^\///}/rc.conf
 
-INSTALLATION_DIRS=     etc ${RCD_SCRIPTS_DIR:S/^\///}
+INSTALLATION_DIRS=     ${SYSCONFBASE:S/^\///} ${RCD_SCRIPTS_DIR:S/^\///}
 
 do-extract:
        ${CP} -R ${FILESDIR} ${WRKSRC}
 
 do-install:
-       ${INSTALL_DATA} ${WRKSRC}/rc.conf.example ${DESTDIR}${PREFIX}etc/rc.conf.example
-       ${INSTALL_DATA} ${WRKSRC}/rc.subr ${DESTDIR}${PREFIX}etc/rc.subr
+       ${INSTALL_DATA} ${WRKSRC}/rc.conf.example ${DESTDIR}${PREFIX}${SYSCONFBASE}/rc.conf.example
+       ${INSTALL_DATA} ${WRKSRC}/rc.subr ${DESTDIR}${PREFIX}${SYSCONFBASE}/rc.subr
        ${INSTALL_SCRIPT} ${WRKSRC}/rc.d/DAEMON ${DESTDIR}${PREFIX}${RCD_SCRIPTS_DIR}
        ${INSTALL_SCRIPT} ${WRKSRC}/rc.d/LOGIN ${DESTDIR}${PREFIX}${RCD_SCRIPTS_DIR}
        ${INSTALL_SCRIPT} ${WRKSRC}/rc.d/NETWORKING ${DESTDIR}${PREFIX}${RCD_SCRIPTS_DIR}
diff -r 5591ff640b7f -r 6de805ec2198 pkgtools/rc.subr/PLIST
--- a/pkgtools/rc.subr/PLIST    Sun May 30 23:41:05 2021 +0000
+++ b/pkgtools/rc.subr/PLIST    Sun May 30 23:46:26 2021 +0000
@@ -1,6 +1,6 @@
-@comment $NetBSD: PLIST,v 1.4 2008/06/04 13:34:46 sketch Exp $
-etc/rc.conf.example
-etc/rc.subr
+@comment $NetBSD: PLIST,v 1.5 2021/05/30 23:46:26 khorben Exp $
+${SYSCONFBASE}/rc.conf.example
+${SYSCONFBASE}/rc.subr
 ${RCD_SCRIPTS_DIR}/DAEMON
 ${RCD_SCRIPTS_DIR}/LOGIN
 ${RCD_SCRIPTS_DIR}/NETWORKING
diff -r 5591ff640b7f -r 6de805ec2198 pkgtools/rc.subr/files/rc.conf.example
--- a/pkgtools/rc.subr/files/rc.conf.example    Sun May 30 23:41:05 2021 +0000
+++ b/pkgtools/rc.subr/files/rc.conf.example    Sun May 30 23:46:26 2021 +0000
@@ -1,6 +1,4 @@
-#      $NetBSD: rc.conf.example,v 1.2 2003/06/23 07:02:16 grant Exp $
-#
-# see rc.conf(5) for more information.
+#      $NetBSD: rc.conf.example,v 1.3 2021/05/30 23:46:26 khorben Exp $
 #
 # Use program=YES to enable program, NO to disable it. program_flags are
 # passed to the program on the command line.
diff -r 5591ff640b7f -r 6de805ec2198 pkgtools/rc.subr/files/rc.subr
--- a/pkgtools/rc.subr/files/rc.subr    Sun May 30 23:41:05 2021 +0000
+++ b/pkgtools/rc.subr/files/rc.subr    Sun May 30 23:46:26 2021 +0000
@@ -1,4 +1,4 @@
-# $NetBSD: rc.subr,v 1.16 2019/10/11 11:56:06 triaxx Exp $
+# $NetBSD: rc.subr,v 1.17 2021/05/30 23:46:26 khorben Exp $
 #
 # Copyright (c) 1997-2002 The NetBSD Foundation, Inc.
 # All rights reserved.
@@ -34,6 +34,7 @@
 #      global variables
 #      ----------------
 
+sysconfbase=@SYSCONFBASE@
 _RCCMD_chown="/usr/sbin/chown"
 _RCCMD_chroot="/usr/sbin/chroot"
 _RCCMD_ci="/usr/bin/ci"
@@ -857,14 +858,14 @@
        if ${_rc_conf_loaded:-false}; then
                :
        else
-               . /etc/rc.conf
+               . ${sysconfbase}/rc.conf
                _rc_conf_loaded=true
        fi
-       if [ "$_osname" = "OpenBSD" ] && [ -f /etc/rc.conf.local ]; then
-               . /etc/rc.conf.local
+       if [ "$_osname" = "OpenBSD" ] && [ -f ${sysconfbase}/rc.conf.local ]; then
+               . ${sysconfbase}/rc.conf.local
        fi
-       if [ -f /etc/rc.conf.d/"$_command" ]; then
-               . /etc/rc.conf.d/"$_command"
+       if [ -f ${sysconfbase}/rc.conf.d/"$_command" ]; then
+               . ${sysconfbase}/rc.conf.d/"$_command"
        fi
 }
 



Home | Main Index | Thread Index | Old Index