pkgsrc-Changes archive

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

CVS commit: pkgsrc



Module Name:    pkgsrc
Committed By:   khorben
Date:           Sun May 30 23:41:05 UTC 2021

Modified Files:
        pkgsrc/bootstrap: bootstrap
        pkgsrc/mk/defaults: mk.conf
        pkgsrc/mk/pkginstall: bsd.pkginstall.mk

Log Message:
Introduce a new SYSCONFBASE variable (defaults to /etc)

This is part 1 to support additional platforms with the RC scripts provided in
pkgsrc, in privileged as well as in unprivileged mode, including on NetBSD
(with part 2 in pkgtools/rc.subr).

This variable is meant to point to the configuration directory of the base
system (as opposed to pkgsrc's own prefix) when it should be used by pkgsrc in
special cases (e.g. installing RC scripts), or to point to the existing
PKG_SYSCONFBASE directory otherwise (e.g. for any unprivileged bootstrap).
This teaches pkgsrc where the RC scripts should be installed, and more
importantly, where the local copy of rc.subr can be expected. Part 3 will
progressively update each and every RC script to substitute this path as
expected.

No functional changes are intended in privileged mode without a bootstrap. The
only variable affected by this change directly is RCD_SCRIPTS_DIR, which
currently remains with the same default of /etc/rc.d, and can be overridden as
before.

When bootstrapping, SYSCONFBASE also remains with the existing default when no
prefix is set or is "/usr/pkg" or "/usr"; it is set to $prefix/etc otherwise. It
can be specified specifically with --sysconfbase if necessary.

Existing installations or bootstraps are not affected, as this change needs
setting SYSCONFBASE in the corresponding $sysconfdir/mk.conf to have an impact.

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


To generate a diff of this commit:
cvs rdiff -u -r1.299 -r1.300 pkgsrc/bootstrap/bootstrap
cvs rdiff -u -r1.317 -r1.318 pkgsrc/mk/defaults/mk.conf
cvs rdiff -u -r1.74 -r1.75 pkgsrc/mk/pkginstall/bsd.pkginstall.mk

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

Modified files:

Index: pkgsrc/bootstrap/bootstrap
diff -u pkgsrc/bootstrap/bootstrap:1.299 pkgsrc/bootstrap/bootstrap:1.300
--- pkgsrc/bootstrap/bootstrap:1.299    Wed Apr 28 11:14:51 2021
+++ pkgsrc/bootstrap/bootstrap  Sun May 30 23:41:05 2021
@@ -1,6 +1,6 @@
 #! /bin/sh
 
-# $NetBSD: bootstrap,v 1.299 2021/04/28 11:14:51 maya Exp $
+# $NetBSD: bootstrap,v 1.300 2021/05/30 23:41:05 khorben Exp $
 #
 # Copyright (c) 2001-2011 Alistair Crooks <agc%NetBSD.org@localhost>
 # All rights reserved.
@@ -74,6 +74,7 @@ usage="Usage: $0 "'
     [ --prefix <prefix> ]
     [ --preserve-path ]
     [ --quiet ]
+    [ --sysconfbase <sysconfbase> ]
     [ --sysconfdir <sysconfdir> ]
     [ --unprivileged | --ignore-user-check ]
     [ --varbase <varbase> ]
@@ -413,6 +414,7 @@ prefix=
 pkgdbdir=
 pkginfodir=
 pkgmandir=
+sysconfbase=
 sysconfdir=
 varbase=
 
@@ -440,6 +442,8 @@ while [ $# -gt 0 ]; do
        --pkginfodir)   pkginfodir="$2"; shift ;;
        --pkgmandir=*)  pkgmandir=`get_optarg "$1"` ;;
        --pkgmandir)    pkgmandir="$2"; shift ;;
+       --sysconfbase=*)sysconfbase=`get_optarg "$1"` ;;
+       --sysconfbase)  sysconfbase="$2"; shift ;;
        --sysconfdir=*) sysconfdir=`get_optarg "$1"` ;;
        --sysconfdir)   sysconfdir="$2"; shift ;;
        --varbase=*)    varbase=`get_optarg "$1"` ;;
@@ -485,6 +489,7 @@ while [ $# -gt 0 ]; do
 done
 
 checkarg_sane_absolute_path "$pkgdbdir" "--pkgdbdir"
+checkarg_sane_absolute_path "$sysconfbase" "--sysconfbase"
 checkarg_sane_absolute_path "$sysconfdir" "--sysconfdir"
 checkarg_sane_absolute_path "$varbase" "--varbase"
 checkarg_sane_relative_path "$pkginfodir" "--pkginfodir"
@@ -500,6 +505,7 @@ if [ "$unprivileged" = "yes" ]; then
        [ -z "$prefix" ] && prefix=${HOME}/pkg
 elif [ -z "$prefix" -o "$prefix" = "/usr/pkg" ]; then
        prefix=/usr/pkg
+       [ -z "$sysconfbase" ] && sysconfbase=/etc
        [ -z "$varbase" ] && varbase=/var
 fi
 checkarg_sane_absolute_path "$prefix" "--prefix"
@@ -510,9 +516,11 @@ checkarg_sane_absolute_path "$prefix" "-
 if [ "$prefix" = "/usr" ]; then
        [ -z "$pkginfodir" ] && pkginfodir=share/info
        [ -z "$pkgmandir" ] && pkgmandir=share/man
+       [ -z "$sysconfbase" ] && sysconfbase=/etc
 else
        [ -z "$pkginfodir" ] && pkginfodir=info
        [ -z "$pkgmandir" ] && pkgmandir=man
+       [ -z "$sysconfbase" ] && sysconfbase=${prefix}/etc
 fi
 infodir=${prefix}/${pkginfodir}
 mandir=${prefix}/${pkgmandir}
@@ -1087,6 +1095,9 @@ fi
 # save environment in example mk.conf
 echo "PKG_DBDIR=               $pkgdbdir" >> ${TARGET_MKCONF}
 echo "LOCALBASE=               $prefix" >> ${TARGET_MKCONF}
+if [ "${sysconfbase}" != "/etc" ]; then
+echo "SYSCONFBASE=             $sysconfbase" >> ${TARGET_MKCONF}
+fi
 echo "VARBASE=         $varbase" >> ${TARGET_MKCONF}
 if [ "${sysconfdir}" != "${prefix}/etc" ]; then
        echo "PKG_SYSCONFBASE=  $sysconfdir" >> ${TARGET_MKCONF}

Index: pkgsrc/mk/defaults/mk.conf
diff -u pkgsrc/mk/defaults/mk.conf:1.317 pkgsrc/mk/defaults/mk.conf:1.318
--- pkgsrc/mk/defaults/mk.conf:1.317    Fri Jan 15 19:47:33 2021
+++ pkgsrc/mk/defaults/mk.conf  Sun May 30 23:41:05 2021
@@ -1,4 +1,4 @@
-# $NetBSD: mk.conf,v 1.317 2021/01/15 19:47:33 schmonz Exp $
+# $NetBSD: mk.conf,v 1.318 2021/05/30 23:41:05 khorben Exp $
 #
 
 # This file provides default values for variables that may be overridden
@@ -489,6 +489,12 @@ PKG_RESUME_TRANSFERS?=     NO
 # Possible: yes or no.
 # Default: no.
 
+SYSCONFBASE?= /etc
+# This is the config directory under which system configuration files are
+# expected.
+# Possible: any path you like
+# Default: /etc
+
 PKG_SYSCONFBASE?= ${PREFIX}/etc
 # This is the main config directory under which all package configuration
 # files should be found.
@@ -500,12 +506,12 @@ PKG_SYSCONFBASE?= ${PREFIX}/etc
 # Possible: any of: rc.d, smf
 # Default: Platform-dependent, otherwise rc.d
 
-RCD_SCRIPTS_DIR?= /etc/rc.d
+RCD_SCRIPTS_DIR?= ${SYSCONFBASE}/rc.d
 # This is the system rc.d script directory in which all rc.d scripts
 # expected to be executed at boot-time should be found.  Package views
 # users may want to set this to "${PKG_SYSCONFBASEDIR}/rc.d".
 # Possible: any path you like
-# Default: /etc/rc.d
+# Default: ${SYSCONFBASE}/rc.d
 
 PACKAGES?=     ${PKGSRCDIR}/packages
 # Stores generated packages

Index: pkgsrc/mk/pkginstall/bsd.pkginstall.mk
diff -u pkgsrc/mk/pkginstall/bsd.pkginstall.mk:1.74 pkgsrc/mk/pkginstall/bsd.pkginstall.mk:1.75
--- pkgsrc/mk/pkginstall/bsd.pkginstall.mk:1.74 Sat May  9 16:48:57 2020
+++ pkgsrc/mk/pkginstall/bsd.pkginstall.mk      Sun May 30 23:41:05 2021
@@ -1,4 +1,4 @@
-# $NetBSD: bsd.pkginstall.mk,v 1.74 2020/05/09 16:48:57 rillig Exp $
+# $NetBSD: bsd.pkginstall.mk,v 1.75 2021/05/30 23:41:05 khorben Exp $
 #
 # This Makefile fragment is included by bsd.pkg.mk and implements the
 # common INSTALL/DEINSTALL scripts framework.  To use the pkginstall
@@ -146,6 +146,7 @@ INSTALL_SRC?=               ${_INSTALL_TEMPLATES}
 #
 FILES_SUBST+=          PREFIX=${PREFIX:Q}
 FILES_SUBST+=          LOCALBASE=${LOCALBASE:Q}
+FILES_SUBST+=          SYSCONFBASE=${SYSCONFBASE:Q}
 FILES_SUBST+=          X11BASE=${X11BASE:Q}
 FILES_SUBST+=          VARBASE=${VARBASE:Q}
 FILES_SUBST+=          PKG_SYSCONFBASE=${PKG_SYSCONFBASE:Q}



Home | Main Index | Thread Index | Old Index