diff options
author | khorben <khorben@pkgsrc.org> | 2021-05-30 23:41:05 +0000 |
---|---|---|
committer | khorben <khorben@pkgsrc.org> | 2021-05-30 23:41:05 +0000 |
commit | a23037528d3587738b5237f047a92284b1b3c49e (patch) | |
tree | 566140424c85144e11dab1e58d0b2c29f24b5f8d /bootstrap/bootstrap | |
parent | 6bbcce1c8f10290754442ef145afa0928194fad4 (diff) | |
download | pkgsrc-a23037528d3587738b5237f047a92284b1b3c49e.tar.gz |
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@.
Diffstat (limited to 'bootstrap/bootstrap')
-rwxr-xr-x | bootstrap/bootstrap | 13 |
1 files changed, 12 insertions, 1 deletions
diff --git a/bootstrap/bootstrap b/bootstrap/bootstrap index 971177eb275..5f761ce2ae5 100755 --- a/bootstrap/bootstrap +++ b/bootstrap/bootstrap @@ -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> # 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" "--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} |