From owner-freebsd-rc@FreeBSD.ORG Sat Dec 24 15:22:19 2011 Return-Path: Delivered-To: freebsd-rc@freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2001:4f8:fff6::34]) by hub.freebsd.org (Postfix) with ESMTP id 4EFE3106564A for ; Sat, 24 Dec 2011 15:22:19 +0000 (UTC) (envelope-from gelraen.ua@gmail.com) Received: from mail-vx0-f182.google.com (mail-vx0-f182.google.com [209.85.220.182]) by mx1.freebsd.org (Postfix) with ESMTP id 026428FC14 for ; Sat, 24 Dec 2011 15:22:18 +0000 (UTC) Received: by vcbfk1 with SMTP id fk1so13888054vcb.13 for ; Sat, 24 Dec 2011 07:22:18 -0800 (PST) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=gamma; h=mime-version:in-reply-to:references:from:date:message-id:subject:to :cc:content-type:content-transfer-encoding; bh=KTQJzHGPdzKqdpoaN0khtyCRsudRRyW+BHUI2aQXZzw=; b=JebHmSWD+T9wkJHge8/caeI7w0EAqMTOkrEWnyz4pIPXiOhLGQh9khPfwz8Eabx+cd 3AGGpxjLjfjGLJO3ZcEn8izvJDfAAkOxNNHJ+e95ZIbqeH9sepco1KmUt0twS1gob9LG 03zSF0caHxMkdbeOFCxAMXZa542oto2Uvqhbw= Received: by 10.221.13.196 with SMTP id pn4mr12189558vcb.74.1324738423189; Sat, 24 Dec 2011 06:53:43 -0800 (PST) MIME-Version: 1.0 Received: by 10.52.29.225 with HTTP; Sat, 24 Dec 2011 06:53:22 -0800 (PST) In-Reply-To: References: <201112241230.pBOCUF3h064098@freefall.freebsd.org> From: Maxim Ignatenko Date: Sat, 24 Dec 2011 16:53:22 +0200 Message-ID: To: Chris Rees Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: quoted-printable Cc: freebsd-rc@freebsd.org Subject: Re: conf/163508: [rc.subr] [patch] Add "enable" and "disable" commands to rc.subr X-BeenThere: freebsd-rc@freebsd.org X-Mailman-Version: 2.1.5 Precedence: list List-Id: "Discussion related to /etc/rc.d design and implementation." List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Sat, 24 Dec 2011 15:22:19 -0000 On 24 December 2011 15:15, Chris Rees wrote: > On 24 December 2011 12:30, Maxim Ignatenko wrote: >> The following reply was made to PR conf/163508; it has been noted by GNA= TS. >> >> From: Maxim Ignatenko >> To: Doug Barton >> Cc: bug-followup@freebsd.org >> Subject: Re: conf/163508: [rc.subr] [patch] Add "enable" and >> =C2=A0"disable" commands to rc.subr >> Date: Sat, 24 Dec 2011 14:20:19 +0200 >> >> =C2=A0On 24 December 2011 04:15, Doug Barton wrote: >> =C2=A0> This idea has been considered before and rejected because it's t= oo >> =C2=A0> difficult to catch all the corner cases, and actually editing a = config >> =C2=A0> file is not really all that hard of a thing to do. >> =C2=A0> >> >> =C2=A0The idea was to make enabling/disabling services less error-prone.= It >> =C2=A0don't need to catch _all_ corner cases, because if administrator d= o >> =C2=A0something unusual with startup configuration he should be able to >> =C2=A0manipulate it in proper way, or even have tools that do something >> =C2=A0similar. >> =C2=A0Proposed patch handles /etc/rc.conf, /etc/rc.conf.local and >> =C2=A0/etc/rc.conf.d/* properly (I hope), so it should fit nicely in 95%= of >> =C2=A0cases. >> =C2=A0Doing `service someserive enable` is much faster and less error-pr= one >> =C2=A0that `service someservice rcvar ; echo someservicercvar_enable=3DY= ES >> >> =C2=A0/etc/rc.conf` > > Disagree, sorry. > > If we're going to implement these ideas we should do it properly, not > for 95% of cases. > It's impossible to handle all cases. For example, how this can be detected and properly altered without bloating code: for c in n a m e d _ e n a b l e; do var=3D${var}${c} done for c in y e s; do val=3D${val}${c} done eval ${var}=3D\$${val} Since proposed patch adds variable to last included file, it will not actually work only if user changed /etc/rc.subr to include one more file after /etc/rc.conf.d/${name}. So, while /etc/rc.subr is unmdified, it will do the job.