From 6eea9e5ef4a53da98f6aac32ec00a8b11d97a2a0 Mon Sep 17 00:00:00 2001 From: Bryan Drewery Date: Sat, 28 May 2022 07:46:00 -0700 Subject: options: Add -o flag to specify PORT_DBDIR name to write to. -o port_dbdir will expand to $POUDRIERE_ETC/$port_dbdir. The -jpz flags will be used for the make.conf, poudriere.conf, and ports tree. Fixes #111 Fixes #583 Fixes #176 --- src/man/poudriere-options.8 | 12 +++++++++++- src/share/poudriere/options.sh | 20 +++++++++++++++----- 2 files changed, 26 insertions(+), 6 deletions(-) (limited to 'src') diff --git a/src/man/poudriere-options.8 b/src/man/poudriere-options.8 index a88883fd..4c5c0a63 100644 --- a/src/man/poudriere-options.8 +++ b/src/man/poudriere-options.8 @@ -28,7 +28,7 @@ .\" .\" Note: The date here should be updated whenever a non-trivial .\" change is made to the manual page. -.Dd April 26, 2021 +.Dd May 28, 2022 .Dt POUDRIERE-OPTIONS 8 .Os .Sh NAME @@ -74,6 +74,16 @@ and shell-style comments are allowed. If given, configure the options only for the given jail. .It Fl n Do not be recursive +.It Fl o Ar port_dbdirname +Use the specified directory name to write the options to. +This name will expand to +.Pa $POUDRIERE_ETC/$port_dbdirname . +This can be used to write options to a different directory than +.Fl jpz +specify. +The +.Fl jpz +flags will be used for the make.conf, poudriere.conf, and ports dir. .It Fl p Ar portstree Run the configuration inside the given ports tree. .Pq Default: Dq Li default diff --git a/src/share/poudriere/options.sh b/src/share/poudriere/options.sh index e325cde8..df66b9f2 100755 --- a/src/share/poudriere/options.sh +++ b/src/share/poudriere/options.sh @@ -42,6 +42,7 @@ Options: -c -- Use 'make config' target -C -- Use 'make config-conditional' target (default) -j name -- Run on the given jail + -o name -- Specify name of options directory to write to -p tree -- Specify on which ports tree the configuration will be done -n -- Do not configure/show/remove options of dependencies -r -- Remove port options instead of configuring them @@ -58,10 +59,11 @@ PTNAME_TMP="" DO_RECURSE=y COMMAND=config-conditional RECURSE_COMMAND=config-recursive +OFLAG=0 [ $# -eq 0 ] && usage -while getopts "a:cCj:f:p:nrsz:" FLAG; do +while getopts "a:cCj:f:o:p:nrsz:" FLAG; do case "${FLAG}" in a) ARCH=${OPTARG} @@ -86,6 +88,10 @@ while getopts "a:cCj:f:p:nrsz:" FLAG; do OPTARG="${SAVED_PWD}/${OPTARG}" LISTPKGS="${LISTPKGS:+${LISTPKGS} }${OPTARG}" ;; + o) + PORT_DBDIRNAME="${OPTARG}" + OFLAG=1 + ;; p) porttree_exists ${OPTARG} || err 2 "No such ports tree: ${OPTARG}" @@ -132,11 +138,14 @@ command -v dialog4ports >/dev/null 2>&1 || err 1 "You must have ports-mgmt/dialo read_packages_from_params "$@" OLD_PORT_DBDIR=${POUDRIERED}/${JAILNAME}${JAILNAME:+-}${SETNAME}${SETNAME:+-}options -PORT_DBDIR=${POUDRIERED}/${JAILNAME}${JAILNAME:+-}${PTNAME_TMP}${PTNAME_TMP:+-}${SETNAME}${SETNAME:+-}options +: ${PORT_DBDIRNAME:="${JAILNAME}${JAILNAME:+-}${PTNAME_TMP}${PTNAME_TMP:+-}${SETNAME}${SETNAME:+-}options"} +PORT_DBDIR="${POUDRIERED}/${PORT_DBDIRNAME}" -if [ -d "${OLD_PORT_DBDIR}" ] && [ ! -d "${PORT_DBDIR}" ]; then +if [ "${OFLAG}" -eq 0 ] && + [ -d "${OLD_PORT_DBDIR}" ] && [ ! -d "${PORT_DBDIR}" ]; then msg_warn "You already have options configured without '-p ${PTNAME_TMP}' that will no longer be used." msg_warn "Drop the '-p ${PTNAME_TMP}' option to avoid this problem." + msg_warn "Alternatively use '-o dirname' to write to a different directory than -jpz specify." if [ -t 0 ]; then confirm_if_tty "Are you sure you want to continue?" || exit 0 else @@ -144,8 +153,9 @@ if [ -d "${OLD_PORT_DBDIR}" ] && [ ! -d "${PORT_DBDIR}" ]; then fi fi -mkdir -p ${PORT_DBDIR} -msg "Working on options directory ${PORT_DBDIR}" +mkdir -p "${PORT_DBDIR}" +msg "Working on options directory: ${PORT_DBDIR}" +msg "Using ports from: ${PORTSDIR}" __MAKE_CONF=$(mktemp -t poudriere-make.conf) export __MAKE_CONF -- cgit v1.2.3