From nobody Tue Sep 28 03:23:43 2021 X-Original-To: ports@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 D34A317E4E85 for ; Tue, 28 Sep 2021 03:23:48 +0000 (UTC) (envelope-from danm@prime.gushi.org) Received: from prime.gushi.org (prime.gushi.org [IPv6:2620:137:6000:10::142]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (Client CN "prime.gushi.org", Issuer "RapidSSL TLS DV RSA Mixed SHA256 2020 CA-1" (verified OK)) by mx1.freebsd.org (Postfix) with ESMTPS id 4HJPx00DFfz3jmV for ; Tue, 28 Sep 2021 03:23:47 +0000 (UTC) (envelope-from danm@prime.gushi.org) Received: from prime.gushi.org (localhost [127.0.0.1]) by prime.gushi.org (8.16.1/8.16.1) with ESMTPS id 18S3NidJ027061 (version=TLSv1.2 cipher=ECDHE-RSA-AES256-GCM-SHA384 bits=256 verify=NO) for ; Mon, 27 Sep 2021 20:23:45 -0700 (PDT) (envelope-from danm@prime.gushi.org) DKIM-Filter: OpenDKIM Filter v2.10.3 prime.gushi.org 18S3NidJ027061 DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gushi.org; s=prime2014; t=1632799426; bh=BkXELKKkdqj7Mls3efcHmR89CHgJV+kNDg+T5GlIzKI=; h=Date:From:To:Subject; z=Date:=20Mon,=2027=20Sep=202021=2020:23:43=20-0700=20(PDT)|From:=2 0"Dan=20Mahoney=20(Gushi)"=20|To:=20ports@freeb sd.org|Subject:=20Quick=20fun=20question:=20only=20set=20an=20rc.d =20variable=20sometimes?; b=MlX217Ey9ATUo9jgOn7DwtX+u2BIqbrq5jjd66cPXwAKmWLQ/VQaYTH1FN6SWo7OZ uTZT3MFpC3QH0KDvtHLf6W1JIkke72MuXrpdi9xqGNNactcQihD83nCTY8PWMW0+D2 Ygd8aVA+KoeQPZwQpCPNR7HkDON7oDM17jFzzC0Ylg8Yr3P+5WeEiS40Lay2dJ2275 V0EfFgDZ58nk0qEbeiSevVbj+9x6FlRIMaIRFYCx4WZmY+V49yinPHXUZQudcdTczG /Nu7YB4H7vduBrJObuTCSlOZDVTfjfQz3V3rMG2KqJPXgz8ieSMcvR8g299/b9eAGj RJmJz3LpPfLUg== Received: (from danm@localhost) by prime.gushi.org (8.16.1/8.16.1/Submit) id 18S3NicD027060; Mon, 27 Sep 2021 20:23:44 -0700 (PDT) (envelope-from danm) Date: Mon, 27 Sep 2021 20:23:43 -0700 (PDT) From: "Dan Mahoney (Gushi)" To: ports@freebsd.org Subject: Quick fun question: only set an rc.d variable sometimes? Message-ID: <5dabceea-7f3c-efbe-3778-67ca360547a@prime.gushi.org> X-OpenPGP-Key-ID: 0x624BB249 List-Id: Porting software to FreeBSD List-Archive: https://lists.freebsd.org/archives/freebsd-ports List-Help: List-Post: List-Subscribe: List-Unsubscribe: Sender: owner-freebsd-ports@freebsd.org X-BeenThere: freebsd-ports@freebsd.org MIME-Version: 1.0 Content-Type: text/plain; format=flowed; charset=US-ASCII X-Greylist: Sender passed SPF test, not delayed by milter-greylist-4.6.2 (prime.gushi.org [0.0.0.0]); Tue, 28 Sep 2021 03:23:46 +0000 (UTC) X-Rspamd-Queue-Id: 4HJPx00DFfz3jmV X-Spamd-Bar: ----- Authentication-Results: mx1.freebsd.org; dkim=pass header.d=gushi.org header.s=prime2014 header.b=MlX217Ey; dmarc=pass (policy=none) header.from=gushi.org; spf=pass (mx1.freebsd.org: domain of danm@prime.gushi.org designates 2620:137:6000:10::142 as permitted sender) smtp.mailfrom=danm@prime.gushi.org X-Spamd-Result: default: False [-5.40 / 15.00]; ARC_NA(0.00)[]; NEURAL_HAM_MEDIUM(-1.00)[-1.000]; R_DKIM_ALLOW(-0.20)[gushi.org:s=prime2014]; FROM_HAS_DN(0.00)[]; DWL_DNSWL_MED(-2.00)[gushi.org:dkim]; TO_MATCH_ENVRCPT_ALL(0.00)[]; R_SPF_ALLOW(-0.20)[+a]; MIME_GOOD(-0.10)[text/plain]; TO_DN_NONE(0.00)[]; PREVIOUSLY_DELIVERED(0.00)[ports@freebsd.org]; RCVD_DKIM_ARC_DNSWL_MED(-0.50)[]; RCPT_COUNT_ONE(0.00)[1]; NEURAL_HAM_LONG(-1.00)[-1.000]; MID_RHS_MATCH_FROMTLD(0.00)[]; RCVD_IN_DNSWL_MED(-0.20)[2620:137:6000:10::142:from]; DKIM_TRACE(0.00)[gushi.org:+]; DMARC_POLICY_ALLOW(-0.50)[gushi.org,none]; NEURAL_HAM_SHORT(-1.00)[-1.000]; FORGED_SENDER(0.30)[freebsd@gushi.org,danm@prime.gushi.org]; MIME_TRACE(0.00)[0:+]; SUBJECT_ENDS_QUESTION(1.00)[]; ASN(0.00)[asn:393507, ipnet:2620:137:6000::/44, country:US]; FROM_NEQ_ENVFROM(0.00)[freebsd@gushi.org,danm@prime.gushi.org]; RCVD_TLS_ALL(0.00)[]; RCVD_COUNT_TWO(0.00)[2] X-ThisMailContainsUnwantedMimeParts: N Hey all, I'm dealing with rc.d scripting and reading https://docs.freebsd.org/en/articles/rc-scripting/ Here's my question: Is there a sane way to have something like foo_pid *completely unset* in one case, but overridable by rc.conf after? It took me a bit to wrap my head around the: : ${dummy_enable:=no} : ${dummy_msg="Nothing started."} Examples. (Why that first colon, what is this := syntax), etc. What I'm trying to say in rc.subr language is: If the user has set something in rc.conf, use it. Otherwise, leave it TOTALLY UNSET. Not to the null string. Undefined. Anyway, here's my use case: The "kdc" program can optionally have a pidfile (if you install mit krb5, it uses the same startup script rather than one in /usr/local/etc/rc.d) But the base kdc doesn't support a pidfile at all. So "status" won't work if pid is set at all in /etc/rc.d/kdc -- but if it's unset, rc_subr will just search for the process without the pid, by name. A line like the one above would define it. Even to a default. So it would break "status". But I'd like to actually be able to *check* a pidfile if I configure one. Since then a cleaner shutdown is possible, and code that relies on this stuff externally, like puppet, are cleaner. This isn't about "why is a port using a base startup script, especially when that port drops other files into /usr/local/etc/rc.d", it's more a "hey, this syntax isn't clear in the above article, and how does one do it, and should it be added to the above?" -- --------Dan Mahoney-------- Techie, Sysadmin, WebGeek Gushi on efnet/undernet IRC FB: fb.com/DanielMahoneyIV LI: linkedin.com/in/gushi Site: http://www.gushi.org ---------------------------