From nobody Sun Nov 19 17:34:38 2023 X-Original-To: dev-commits-ports-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 4SYHnq2g98z5154N; Sun, 19 Nov 2023 17:34:39 +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 4SYHnq24Bdz4LRL; Sun, 19 Nov 2023 17:34:39 +0000 (UTC) (envelope-from git@FreeBSD.org) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=freebsd.org; s=dkim; t=1700415279; 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=VdTlAGcLiq2qxXJP+/89m7Shkine3GM4aHJ78rF1NLw=; b=I+RMEIkhgHvexZUG6hWD2RjUKSKsqzKXq+wvs9mb/TBRO6LTcHErnCkrG0M+ZHOGdS3KFu G3FjjwAlXF31Ty1QSeAfaNu/1CWbrOQcgg/qFdHAn7617aT197Nz3M7nZnC+kpLPSYGj/r QooSyQHoNXXuNKlyLdtwy5OKWEhADl9ef6kH3nIQjS6mi5GhZfBgjsLZkz1mg8jHIIDWHP dmx8LLRreAjELIa7J1QtUII1yrUFK0081ZEqewMarC2Fjo2wLrbKcCtAgdh8bASgRIONVe 6O6+/Bp4AgDPkJBV9qWAC8DCcg9enwP/0oKvKtMyTFppzmRtXyvcC7EJq9H/IQ== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=freebsd.org; s=dkim; t=1700415279; 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=VdTlAGcLiq2qxXJP+/89m7Shkine3GM4aHJ78rF1NLw=; b=la4hciSS2dty7aHjp4E5GcKG6p18SiqCLIzTr39e9wlsn2yktmS9pf0KWuYCp12zVxdVaq h1eQQB8JbNEyq6hiUTJZb9zH6Lhn29mIiHtx1qXeDM1UBNad6H8dKNPbmePoCbxXDPdTXw fhFKUxSxsObTR6CnQc1tO0nQIGQ59OEyn/dTWmEvxECK1txMEWRk/xZOtyL6ivCXEES0Yc LAmznYMYk4OFQUbDNcKcBj6+G8KlyWV14h9uCZ5EY79TS4zAB/h220qfZJlzd5pWNoVS0J Z5L9kqJScMpWYM9MTGtAWVnnHi2Sq3LfFi7GrDrwcxlCos1hTbjMcPW/pofXDw== ARC-Authentication-Results: i=1; mx1.freebsd.org; none ARC-Seal: i=1; s=dkim; d=freebsd.org; t=1700415279; a=rsa-sha256; cv=none; b=Go8upRsySVF+nnt2mRhHRMRh0W92glNQnqG/QiDCnm1kQYEj80rsElclSP5t9KMI6X99HA 3/pZCbF4puRPFstpWblMvNzfg2FecziD+qr1VmsLfRvvrfReGHSQmPUFOn8QXz5I+hkCxs C2A7q+qAqKsC2iW3FeX/nTVbfWoRv+WQOsgZjfM4/dD5r1CGsNUaYZqEKueZk+gDmsoXXy PJL3gzhKLU/0nKwfPwqy/8KGlt8H48U3gQRRPU4AaCovwyGpw1BNqDPELPUxk/DGoCtnFZ 5mfn1jlzkAgbjUmaX0jDcZYkUnGY+9hg3mTtKplyBeifYmq1uYh63z8V9ojRPA== 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 4SYHnq0sQmz3Q4; Sun, 19 Nov 2023 17:34:39 +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 3AJHYc73033797; Sun, 19 Nov 2023 17:34:38 GMT (envelope-from git@gitrepo.freebsd.org) Received: (from git@localhost) by gitrepo.freebsd.org (8.17.1/8.17.1/Submit) id 3AJHYcMr033795; Sun, 19 Nov 2023 17:34:38 GMT (envelope-from git) Date: Sun, 19 Nov 2023 17:34:38 GMT Message-Id: <202311191734.3AJHYcMr033795@gitrepo.freebsd.org> To: ports-committers@FreeBSD.org, dev-commits-ports-all@FreeBSD.org, dev-commits-ports-main@FreeBSD.org From: Dirk Meyer Subject: git: 1d7b2b3983c9 - main - audio/owntone: support for multiple profiles List-Id: Commit messages for all branches of the ports repository List-Archive: https://lists.freebsd.org/archives/dev-commits-ports-all List-Help: List-Post: List-Subscribe: List-Unsubscribe: Sender: owner-dev-commits-ports-all@freebsd.org X-BeenThere: dev-commits-ports-all@freebsd.org MIME-Version: 1.0 Content-Type: text/plain; charset=utf-8 Content-Transfer-Encoding: 8bit X-Git-Committer: dinoex X-Git-Repository: ports X-Git-Refname: refs/heads/main X-Git-Reftype: branch X-Git-Commit: 1d7b2b3983c9ab9e4b9232b567625ceca3803b27 Auto-Submitted: auto-generated The branch main has been updated by dinoex: URL: https://cgit.FreeBSD.org/ports/commit/?id=1d7b2b3983c9ab9e4b9232b567625ceca3803b27 commit 1d7b2b3983c9ab9e4b9232b567625ceca3803b27 Author: Dirk Meyer AuthorDate: 2023-11-19 17:33:27 +0000 Commit: Dirk Meyer CommitDate: 2023-11-19 17:33:27 +0000 audio/owntone: support for multiple profiles Submitted by: Raivo Hool --- audio/owntone/files/owntone.in | 66 +++++++++++++++++++++++++++++++++++------- 1 file changed, 56 insertions(+), 10 deletions(-) diff --git a/audio/owntone/files/owntone.in b/audio/owntone/files/owntone.in index c4209cf44a0c..0c4173e197e1 100644 --- a/audio/owntone/files/owntone.in +++ b/audio/owntone/files/owntone.in @@ -11,23 +11,69 @@ # Set it to YES to enable owntone. # owntone_config (path): Set to %%PREFIX%%/etc/owntone.conf # by default. -# owntone_flags (str): Set to "" by default +# owntone_flags (str): Set to "" by default +# +# for mutiple profiles create an symlink +# cd %%PREFIX%%/etc/rc.d/ && ln -s owntone NAME +# and set this lines: +# +# NAME_enable (bool): Set to NO by default. +# Set it to YES to enable owntone. +# NAME_config="/usr/local/etc/owntone/NAME.conf" # config file +# NAME_flags (str): Set to "" by default . /etc/rc.subr -name=owntone +# service(8) does not create an authentic environment, try to guess, +# and as of 10.3-RELEASE-p0, it will not find the indented name +# assignments below. So give it a default. +# Trailing semicolon also for service(8)'s benefit: +name="$file" ; +rcvar=${name}_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" + ;; +*/service) + # do not use this as $0 + ;; +*) + name="$0" + ;; +esac + +# default name to "owntone" if guessing failed +# Trailing semicolon also for service(8)'s benefit: +name="${name:-owntone}" ; +name="${name##*/}" rcvar=${name}_enable -load_rc_config $name +stop_postcmd() +{ + rm -f "$pidfile" || warn "Could not remove $pidfile." +} + +# pidfile +pidfile="/var/run/${name}.pid" + +# command and arguments +command="/usr/local/sbin/owntone" + +# run this last +stop_postcmd="stop_postcmd" + +load_rc_config ${name} +eval ": \${${name}_enable:=\"NO\"}" +eval ": \${${name}_config:=\"/usr/local/etc/${name}.conf\"}" -: ${owntone_enable:="NO"} -: ${owntone_config:="%%PREFIX%%/etc/owntone.conf"} -: ${owntone_flags:=""} +config="$(eval echo \${${name}_config})" +flags="$(eval echo \${${name}_flags})" -pidfile="/var/run/owntone.pid" -required_files="$owntone_config" +required_files=${config} -command="%%PREFIX%%/sbin/owntone" -command_args="-P $pidfile -c $owntone_config $owntone_flags" +command_args="-P ${pidfile} -c ${config} ${flags}" run_rc_command "$1"