From nobody Sat Dec 02 08:39:00 2023 X-Original-To: dev-commits-src-all@mlmmj.nyi.freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2610:1c1:1:606c::19:1]) by mlmmj.nyi.freebsd.org (Postfix) with ESMTP id 4Sj3Hm3BjPz52SLm; Sat, 2 Dec 2023 08:39:00 +0000 (UTC) (envelope-from git@FreeBSD.org) Received: from mxrelay.nyi.freebsd.org (mxrelay.nyi.freebsd.org [IPv6:2610:1c1:1:606c::19:3]) (using TLSv1.3 with cipher TLS_AES_256_GCM_SHA384 (256/256 bits) key-exchange X25519 server-signature RSA-PSS (4096 bits) server-digest SHA256 client-signature RSA-PSS (4096 bits) client-digest SHA256) (Client CN "mxrelay.nyi.freebsd.org", Issuer "R3" (verified OK)) by mx1.freebsd.org (Postfix) with ESMTPS id 4Sj3Hm2cKbz3QGN; Sat, 2 Dec 2023 08:39:00 +0000 (UTC) (envelope-from git@FreeBSD.org) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=freebsd.org; s=dkim; t=1701506340; h=from:from:reply-to:subject:subject:date:date:message-id:message-id: to:to:cc:mime-version:mime-version:content-type:content-type: content-transfer-encoding:content-transfer-encoding; bh=+MoP0hHt27BLqPElWJwLvuGJFU63Yop1CU7Y8ElDcxE=; b=YCEvNDHciXkdJ5eGT6N5IXTnqfhN1UzPYeiMgwkISEVvK0ChF31od+OaR2lE/6lz1Pd7dc ueNaqWMbhWtrU8Uliec0Nm7/1D+OVWWjYUuExK3/pkjSXzaO8yka6k5llZVEY0T2pay6sG VI7H7PLb7FahfNMbHSLMVQ0inBAt5uZ0L4SOGPu7AQqCdA5jvR7HBAbNDemHd67U7/L5SA LK/S/4U/CsO6OGdcisx4kJDjOdw7k+RB2yGjaQ27lNOPU+hpYZ/5CtS3A8U1dmzCVyGJxh tnqNv9EGiLcmuCkL+RCQYpHcYwAZX7st4+IzBaOVngVD5qv7iSwFJ/z4MDmv9A== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=freebsd.org; s=dkim; t=1701506340; h=from:from:reply-to:subject:subject:date:date:message-id:message-id: to:to:cc:mime-version:mime-version:content-type:content-type: content-transfer-encoding:content-transfer-encoding; bh=+MoP0hHt27BLqPElWJwLvuGJFU63Yop1CU7Y8ElDcxE=; b=H59ECV+H+YKXPh5AsCXZiCOAdxNLqLerJ+5bqj0PGcE8kaA6jyCSVCyvqXEC6Hqqgzx9Zs NypcasfmXbnrvWmcXyvrIeE/pMRtl5BCm9z/auxMzkZfCiNFnZ7xKmXUGXBZr/cquPaTy5 aoOFrgYngDv+ioUefNRno+0FMVrNCGDtOp8aQu/q7qudDv08kVkiCutK4k0sDBqv2Lhdpr GD40fKGdt+gPVqaYPvt9p0m3H3S2jLb0sqgoOAEX731sgJMytMNRwo9J10jjEkVoV58pwU +Im9p0eBnaWi0IsX/mo75N1dvwyTHAZxQXTRYnbGGbCSIKisnILizUZY15wjxw== ARC-Authentication-Results: i=1; mx1.freebsd.org; none ARC-Seal: i=1; s=dkim; d=freebsd.org; t=1701506340; a=rsa-sha256; cv=none; b=LVGEo8MmnvTfBEC3hpNSlz0Y+S+9lxmDDZqR/o8NTQGQIBZnhU99fEmywjrQTce+SQRdFL SUu10vNqnkv7d9fuQLn0AMqjx5q+HcPLTuZywV2+bMeIyH1Vo3sNHa0nyyQVIfBx7pUHm8 EIArXRRuWJKUsA0beK1bux25b/tLrQzoiLmSycRb3t1Y69bPVivGGRF7oZ8Oh2a0Kg19bd 1RpNX8k+7ZZOXakYCd9/lftk18pqxKSaQM86DItlut0a/Y/sznnBN099UHf+bn0jn4ycyx 55VspXYbwwWTAh9KQn3PbqwYxj56NykGiSACBBfSr6AbJ6o/RM54uxNQwvoibg== Received: from gitrepo.freebsd.org (gitrepo.freebsd.org [IPv6:2610:1c1:1:6068::e6a:5]) (using TLSv1.3 with cipher TLS_AES_256_GCM_SHA384 (256/256 bits) key-exchange X25519 server-signature RSA-PSS (4096 bits) server-digest SHA256) (Client did not present a certificate) by mxrelay.nyi.freebsd.org (Postfix) with ESMTPS id 4Sj3Hm1YK4z18GV; Sat, 2 Dec 2023 08:39:00 +0000 (UTC) (envelope-from git@FreeBSD.org) Received: from gitrepo.freebsd.org ([127.0.1.44]) by gitrepo.freebsd.org (8.17.1/8.17.1) with ESMTP id 3B28d0kr095196; Sat, 2 Dec 2023 08:39:00 GMT (envelope-from git@gitrepo.freebsd.org) Received: (from git@localhost) by gitrepo.freebsd.org (8.17.1/8.17.1/Submit) id 3B28d0bs095193; Sat, 2 Dec 2023 08:39:00 GMT (envelope-from git) Date: Sat, 2 Dec 2023 08:39:00 GMT Message-Id: <202312020839.3B28d0bs095193@gitrepo.freebsd.org> To: src-committers@FreeBSD.org, dev-commits-src-all@FreeBSD.org, dev-commits-src-branches@FreeBSD.org From: Eugene Grosbein Subject: git: b1e0b0cb7ce1 - stable/12 - rc: add ${name}_setup script support List-Id: Commit messages for all branches of the src repository List-Archive: https://lists.freebsd.org/archives/dev-commits-src-all List-Help: List-Post: List-Subscribe: List-Unsubscribe: Sender: owner-dev-commits-src-all@freebsd.org X-BeenThere: dev-commits-src-all@freebsd.org MIME-Version: 1.0 Content-Type: text/plain; charset=utf-8 Content-Transfer-Encoding: 8bit X-Git-Committer: eugen X-Git-Repository: src X-Git-Refname: refs/heads/stable/12 X-Git-Reftype: branch X-Git-Commit: b1e0b0cb7ce100b317cf69ec5180660d31e25c3c Auto-Submitted: auto-generated The branch stable/12 has been updated by eugen: URL: https://cgit.FreeBSD.org/src/commit/?id=b1e0b0cb7ce100b317cf69ec5180660d31e25c3c commit b1e0b0cb7ce100b317cf69ec5180660d31e25c3c Author: Franco Fichtner AuthorDate: 2022-08-15 14:41:31 +0000 Commit: Eugene Grosbein CommitDate: 2023-12-02 08:20:40 +0000 rc: add ${name}_setup script support Run a service-based setup script before running the start command. Useful for automatic configuration file generation. Reviewed by: https://reviews.freebsd.org/D36006 (cherry picked from commit c9be47b34dd847da1d4ab0feee4a6100b2c5ea0d) --- libexec/rc/rc.subr | 14 +++++++++++--- 1 file changed, 11 insertions(+), 3 deletions(-) diff --git a/libexec/rc/rc.subr b/libexec/rc/rc.subr index c64186608aa2..e9a2feeb6d1a 100644 --- a/libexec/rc/rc.subr +++ b/libexec/rc/rc.subr @@ -783,6 +783,8 @@ check_startmsgs() # # ${name}_prepend n Command added before ${command}. # +# ${name}_setup n Command executed before ${command}. +# # ${name}_login_class n Login class to use, else "daemon". # # ${name}_limits n limits(1) to apply to ${command}. @@ -967,8 +969,8 @@ run_rc_command() _group=\$${name}_group _groups=\$${name}_groups \ _fib=\$${name}_fib _env=\$${name}_env \ _prepend=\$${name}_prepend _login_class=\${${name}_login_class:-daemon} \ - _limits=\$${name}_limits _oomprotect=\$${name}_oomprotect \ - _env_file=\$${name}_env_file + _limits=\$${name}_limits _oomprotect=\$${name}_oomprotect \ + _setup=\$${name}_setup _env_file=\$${name}_env_file if [ -n "$_env_file" ] && [ -r "${_env_file}" ]; then # load env from file set -a @@ -1123,6 +1125,12 @@ $command $rc_flags $command_args" fi fi + if [ -n "$_setup" ]; then + if ! _run_rc_doit "$_setup"; then + warn "failed to setup ${name}" + fi + fi + # Prepend default limits _doit="$_cd limits -C $_login_class $_limits $_doit" @@ -2139,7 +2147,7 @@ check_kern_features() # check_namevarlist var # Return "0" if ${name}_var is reserved in rc.subr. -_rc_namevarlist="program chroot chdir env flags fib nice user group groups prepend" +_rc_namevarlist="program chroot chdir env flags fib nice user group groups prepend setup" check_namevarlist() { local _v