From nobody Wed May 08 09:42:23 2024 X-Original-To: dev-commits-ports-main@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 4VZ9D03HQjz5KkbY; Wed, 08 May 2024 09:42:24 +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 4VZ9D013rjz42P1; Wed, 8 May 2024 09:42:24 +0000 (UTC) (envelope-from git@FreeBSD.org) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=freebsd.org; s=dkim; t=1715161344; 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=S6H2EtIsbd1HxGnA/iNzdMTfkPYPCkGXXFia38R7xFA=; b=N6kfYKN/P1gEPOvRsztWcM+xmEc+uPf8NwJ3G4ezFt2Rxk3DInltOJblaIYeJK6Mw4Js8m 65TaEHZUPu7cubazfQ8QJhHbs9GIce9kIyKfEFI/gTTUK0IRkzhKlVZns6KZRlTtx1B78/ kbNqpiU4fFvA9zippsngMdiWmKzRVh/1uIUEBUiaM0w7EX4PnE5N6sIbJLXIc31K+haO22 rElkZz1Sfpg4IJCVqLQNWrkfS8YsvBEEArcdgrw+jM6hnE+HLz1mfdEaBp+vm+AGiA4rF7 z337X4luZvM+x1sYZnjpvN6DBeg2T57/FyLAz+9OqDowJ2/4f/jYSs94YgkViQ== ARC-Seal: i=1; s=dkim; d=freebsd.org; t=1715161344; a=rsa-sha256; cv=none; b=AitzOgca1TblXVZYq4NKlNSOlkOXhQLQRSjrlChUyrR1z6AzuDNSYkUdbB8WOmpkVSx24/ Gg5gw5RHm5YVsv64CMu37vKPmlozKKpvXU0/3Md8bLOGzJULMLVCqA4P8BugpmkXfH08wz NePVQoUwetaoyg6WVV8XykNr4CAOXou10AIIYqrWz7v9YQMfGIOqLWEUKd8X7E1mumTHWt adH8pej5nZDzIelX+MB2xe+AmQEhQij3iqmGo/DYz/JUt1W5X7RXG3oLKmZOd7esbO5up2 VrHV0LbxZgqkPsoW26xBhKquiJXSBIbFJ+hjkq94KZXPl036x5PMWYJdM7ZyOw== ARC-Authentication-Results: i=1; mx1.freebsd.org; none ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=freebsd.org; s=dkim; t=1715161344; 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=S6H2EtIsbd1HxGnA/iNzdMTfkPYPCkGXXFia38R7xFA=; b=YAzaZNkLCVQVBHTTEGMvQkKUrLaIY+/u/z8OfonX9pcGOi5/IQEtErFGC3Tpm1ODywbArf rrxoV0oXj5oFMWVCkWzfy0xRBD5jkOMLGezDDxqaBua2gesv0SYxeHvoUzwK1qx1/FSKd+ koWZl/1hD+oHVgids44OLtHEw7eh6KC/PfNGIVO/6xxVtgUakEyPblxcp0Gk54bXqOJKrh PhYMugLHER1lFkmETtRB2bJd+vYVgTuXV3cb1eFuttCWqe6ja//tK2PFc215KbIi2IpbRt QGSqmgjO3DiKszfTvyJdjbWjmoK0a1Sj8WQxPhSstTMnOxmBhnBsOH2t+IbPOA== 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 4VZ9D00LK2zKsW; Wed, 8 May 2024 09:42:24 +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 4489gNMB039301; Wed, 8 May 2024 09:42:23 GMT (envelope-from git@gitrepo.freebsd.org) Received: (from git@localhost) by gitrepo.freebsd.org (8.17.1/8.17.1/Submit) id 4489gNQi039298; Wed, 8 May 2024 09:42:23 GMT (envelope-from git) Date: Wed, 8 May 2024 09:42:23 GMT Message-Id: <202405080942.4489gNQi039298@gitrepo.freebsd.org> To: ports-committers@FreeBSD.org, dev-commits-ports-all@FreeBSD.org, dev-commits-ports-main@FreeBSD.org From: Alexander Leidinger Subject: git: 7f80d7465ec9 - main - www/oauth2-proxy: convert rc script to be instance-aware List-Id: Commits to the main branch of the FreeBSD ports repository List-Archive: https://lists.freebsd.org/archives/dev-commits-ports-main List-Help: List-Post: List-Subscribe: List-Unsubscribe: X-BeenThere: dev-commits-ports-main@freebsd.org Sender: owner-dev-commits-ports-main@FreeBSD.org MIME-Version: 1.0 Content-Type: text/plain; charset=utf-8 Content-Transfer-Encoding: 8bit X-Git-Committer: netchild X-Git-Repository: ports X-Git-Refname: refs/heads/main X-Git-Reftype: branch X-Git-Commit: 7f80d7465ec9d85666472f99df16ba71b1e8c9d5 Auto-Submitted: auto-generated The branch main has been updated by netchild: URL: https://cgit.FreeBSD.org/ports/commit/?id=7f80d7465ec9d85666472f99df16ba71b1e8c9d5 commit 7f80d7465ec9d85666472f99df16ba71b1e8c9d5 Author: Alexander Leidinger AuthorDate: 2024-05-08 09:34:27 +0000 Commit: Alexander Leidinger CommitDate: 2024-05-08 09:42:19 +0000 www/oauth2-proxy: convert rc script to be instance-aware Like the tomcat ports or openhab, make the rc script instance aware. To use it: - cp /usr/local/etc/oauth2-proxy.cfg.sample /usr/local/etc/oauth2-proxy-myapp.cfg - vi /usr/local/etc/oauth2-proxy-myapp.cfg - ln -s oauth2_proxy /usr/local/etc/rc.d/oauth2_proxy_myapp - sysctl oauth2_proxy_myapp_enable=YES - service oauth2_proxy_myapp start Approved by: maintainer timeout (3 weeks) PR: 278325 --- UPDATING | 15 +++++++ www/oauth2-proxy/Makefile | 4 +- .../files/{oauth2-proxy.in => oauth2_proxy.in} | 50 ++++++++++++++-------- 3 files changed, 49 insertions(+), 20 deletions(-) diff --git a/UPDATING b/UPDATING index 090819e783e1..4ad684dbe534 100644 --- a/UPDATING +++ b/UPDATING @@ -5,6 +5,21 @@ they are unavoidable. You should get into the habit of checking this file for changes each time you update your ports collection, before attempting any port upgrades. +202408: + AFFECTS: www/oauth2-proxy + AUTHOR: netchild@FreeBSD.org + + The start script is converted to be instance aware. To use it: + - cp /usr/local/etc/oauth2-proxy.cfg.sample /usr/local/etc/oauth2-proxy-myapp.cfg + - vi /usr/local/etc/oauth2-proxy-myapp.cfg + - ln -s oauth2_proxy /usr/local/etc/rc.d/oauth2_proxy_myapp + - sysctl oauth2_proxy_myapp_enable=YES + - service oauth2_proxy_myapp start + This allows to easily start multiple instances on the same system. + + As part of this, the start script was renamed to oauth2_proxy. This only + affects manual restarts, no change in rc.conf is needed. + 20240430: AFFECTS: audio/py-pyradio AUTHOR: nivit@FreeBSD.org diff --git a/www/oauth2-proxy/Makefile b/www/oauth2-proxy/Makefile index 29d9e5edb8ed..a34af1989feb 100644 --- a/www/oauth2-proxy/Makefile +++ b/www/oauth2-proxy/Makefile @@ -1,7 +1,7 @@ PORTNAME= oauth2-proxy PORTVERSION= 7.5.1 DISTVERSIONPREFIX= v -PORTREVISION= 4 +PORTREVISION= 5 CATEGORIES= www MAINTAINER= freebsd@rheinwolf.de @@ -13,7 +13,7 @@ LICENSE_FILE= ${WRKSRC}/LICENSE USES= go:modules -USE_RC_SUBR= oauth2-proxy +USE_RC_SUBR= oauth2_proxy USE_GITHUB= yes GH_TUPLE= \ diff --git a/www/oauth2-proxy/files/oauth2-proxy.in b/www/oauth2-proxy/files/oauth2_proxy.in similarity index 51% rename from www/oauth2-proxy/files/oauth2-proxy.in rename to www/oauth2-proxy/files/oauth2_proxy.in index 17122e3eff13..5c8aeab10dcb 100644 --- a/www/oauth2-proxy/files/oauth2-proxy.in +++ b/www/oauth2-proxy/files/oauth2_proxy.in @@ -16,21 +16,35 @@ . /etc/rc.subr -name=oauth2_proxy -rcvar=oauth2_proxy_enable +case $0 in +/etc/rc*) + # during boot (shutdown) $0 is /etc/rc (/etc/rc.shutdown), + # so get the name of the script from $_file + name=$_file + ;; +*) + name=$0 + ;; +esac + +name=${name##*/} +rcvar=${name}_enable desc="OAuth 2.0 proxy server" -load_rc_config $name +load_rc_config "$name" -: ${oauth2_proxy_enable:=NO} -: ${oauth2_proxy_user:=%%USER%%} -: ${oauth2_proxy_group:=%%GROUP%%} -: ${oauth2_proxy_flags:=""} -: ${oauth2_proxy_restart:=60} +eval "${rcvar}=\${${rcvar}:-'NO'}" +eval "_oauth2_proxy_user=\${${name}_user:-'%%USER%%'}" +eval "_oauth2_proxy_group=\${${name}_group:-'%%GROUP%%'}" +eval "_oauth2_proxy_flags=\${${name}_flags:-''}" +eval "_oauth2_proxy_restart=\${${name}_restart:-'60'}" -pidfile=%%RUN_DIR%%/%%PORTNAME%%.pid +configname=$(echo ${name}.cfg | sed -e 's:_:-:g') + +pidfile=%%RUN_DIR%%/${name}.pid +childpidfile=%%RUN_DIR%%/${name}_child.pid command=/usr/sbin/daemon -command_args="-u ${oauth2_proxy_user} -o %%LOG_DIR%%/%%PORTNAME%%.out -t %%PORTNAME%% -R ${oauth2_proxy_restart} -P ${pidfile}" +command_args="-u ${_oauth2_proxy_user} -o %%LOG_DIR%%/${name}.out -t ${name} -R ${_oauth2_proxy_restart} -P ${pidfile} -p ${childpidfile}" start_cmd="oauth2_proxy_start" stop_cmd="oauth2_proxy_stop" @@ -38,19 +52,19 @@ stop_cmd="oauth2_proxy_stop" oauth2_proxy_start() { if [ ! -d "%%LOG_DIR%%" ]; then - install -d -o ${oauth2_proxy_user} %%LOG_DIR%% + install -d -o ${_oauth2_proxy_user} %%LOG_DIR%% fi if [ ! -d "%%RUN_DIR%%" ]; then - install -d -o ${oauth2_proxy_user} %%RUN_DIR%% + install -d -o ${_oauth2_proxy_user} %%RUN_DIR%% fi - chown -R ${oauth2_proxy_user} %%LOG_DIR%% + chown -R ${_oauth2_proxy_user} %%LOG_DIR%% - echo "Starting %%PORTNAME%%." + echo "Starting ${name}." ${command} ${command_args} \ %%PREFIX%%/bin/%%PORTNAME%% \ - --config %%PREFIX%%/etc/%%PORTNAME%%.cfg \ - ${oauth2_proxy_flags} + --config %%PREFIX%%/etc/${configname} \ + ${_oauth2_proxy_flags} } oauth2_proxy_stop() @@ -58,7 +72,7 @@ oauth2_proxy_stop() local pid_daemon local pid_child - echo "Stopping %%PORTNAME%%." + echo "Stopping ${name}." pid_daemon=$(check_pidfile ${pidfile} ${command}) if [ ! -z "${pid_daemon}" ]; then @@ -66,7 +80,7 @@ oauth2_proxy_stop() fi - pid_child=$(pgrep -U ${oauth2_proxy_user} -f %%PREFIX%%/bin/%%PORTNAME%%) + pid_child=$(check_pidfile ${childpidfile} %%PREFIX%%/bin/%%PORTNAME%%) if [ ! -z "${pid_child}" ]; then kill -TERM ${pid_child} fi