From nobody@FreeBSD.org  Wed Nov 15 13:09:02 2006
Return-Path: <nobody@FreeBSD.org>
Received: from mx1.FreeBSD.org (mx1.freebsd.org [216.136.204.125])
	by hub.freebsd.org (Postfix) with ESMTP id 9481F16A412
	for <freebsd-gnats-submit@FreeBSD.org>; Wed, 15 Nov 2006 13:09:02 +0000 (UTC)
	(envelope-from nobody@FreeBSD.org)
Received: from www.freebsd.org (www.freebsd.org [216.136.204.117])
	by mx1.FreeBSD.org (Postfix) with ESMTP id DB40743D98
	for <freebsd-gnats-submit@FreeBSD.org>; Wed, 15 Nov 2006 13:08:46 +0000 (GMT)
	(envelope-from nobody@FreeBSD.org)
Received: from www.freebsd.org (localhost [127.0.0.1])
	by www.freebsd.org (8.13.1/8.13.1) with ESMTP id kAFD8k8H092028
	for <freebsd-gnats-submit@FreeBSD.org>; Wed, 15 Nov 2006 13:08:46 GMT
	(envelope-from nobody@www.freebsd.org)
Received: (from nobody@localhost)
	by www.freebsd.org (8.13.1/8.13.1/Submit) id kAFD8k0w092027;
	Wed, 15 Nov 2006 13:08:46 GMT
	(envelope-from nobody)
Message-Id: <200611151308.kAFD8k0w092027@www.freebsd.org>
Date: Wed, 15 Nov 2006 13:08:46 GMT
From: Pietro Cerutti<pietro.cerutti@gmail.com>
To: freebsd-gnats-submit@FreeBSD.org
Subject: Add more flexibility to rc.conf, to choose "_enable" values at startup
X-Send-Pr-Version: www-3.0

>Number:         105568
>Category:       conf
>Synopsis:       [patch] [request] Add more flexibility to rc.conf, to choose "_enable" values at startup
>Confidential:   no
>Severity:       non-critical
>Priority:       low
>Responsible:    dougb
>State:          closed
>Quarter:        
>Keywords:       
>Date-Required:  
>Class:          change-request
>Submitter-Id:   current-users
>Arrival-Date:   Wed Nov 15 13:10:01 GMT 2006
>Closed-Date:    Fri Oct 07 02:32:27 UTC 2011
>Last-Modified:  Fri Oct 07 02:32:27 UTC 2011
>Originator:     Pietro Cerutti
>Release:        6.2-PRERELEASE
>Organization:
>Environment:
FreeBSD gahr-laptop 6.2-PRERELEASE FreeBSD 6.2-PRERELEASE #0: Tue Nov 14 22:09:12 CET 2006     root@gahr-laptop:/usr/obj/usr/src/sys/GAHR  i386
>Description:
The rc.conf(5) file is the configuration mechanism of the RC process, which is responsible to bring up the system after init(8).
Among the other functions (i.e. setting the hostname), a list of variable of the form DAEMON_enable=[yes|no] is used to decide whether a particular DAEMON should be started at boot.

This configuration mechanism is rather static, because it requires editing the rc.conf file to change the decision about a daemon. 
To disable a daemon, at the present is required in the best case to boot in single user mode (so that the daemon is not started), change the variable, and exit in multiuser mode without the daemon being started.

The attached patch permits a variable to be set to "ask" [i.e. samba_enable=ask]. At startup, a message of the form "RC_ASK - Enable samba? [yes|no] " will be displayed, and the user will be allowed to choose whether samba will be enabled or not. The decision will be stored in the file /var/run/samba.ask, so that at shutdown the RC mechanism is able to decide whether stopping the service is required or not.

I found it useful specially on laptops, where the networking environment often changes, and the set of needed daemons change from session to session.

This patch affects /etc/rc.subr, enhancing the "checkyesno" routine to accept "ask" values.
>How-To-Repeat:

>Fix:
1) Apply the patch:
     cd /etc
     patch < rc.subr.diff.txt
2) Modify some decisions in rc.conf (i.e. postfix_enable="ask", ...)
3) Shutdown in single user mode, and exit on multiuser mode (no reboot is required)
4) When prompted, decide whether postfix should be started or not

Patch attached with submission follows:

--- rc.subr.orig	Wed Nov 15 14:03:59 2006
+++ rc.subr	Wed Nov 15 13:44:31 2006
@@ -122,7 +122,8 @@
 
 #
 # checkyesno var
-#	Test $1 variable, and warn if not set to YES or NO.
+#	Test $1 variable, and warn if not set to YES, NO or ASK.
+#	If it's "ask", let the user choose at runtime between "yes" and "no".
 #	Return 0 if it's "yes" (et al), nonzero otherwise.
 #
 checkyesno()
@@ -140,7 +141,36 @@
 	[Nn][Oo]|[Ff][Aa][Ll][Ss][Ee]|[Oo][Ff][Ff]|0)
 		return 1
 		;;
-	*)
+
+      # "ask"
+	[Aa][Ss][Kk])
+      
+      # answer already stored in .ask file,
+      # this should be the case on shutdown
+      _file="/var/run/$name.ask"
+      if [ -f $_file ]; then
+         read _response < $_file
+         if checkyesno _response; then
+            return 0
+         else
+            return 1
+         fi
+      fi
+      # prompt and save choice to file,
+      # this should be the case on startup
+      read -p "RC_ASK - Enable $name? [yes|no] " _enable
+      if checkyesno _enable; then
+         _choice="yes"
+         _return=0
+      else
+         _choice="no"
+         _return=1
+      fi
+      echo "$_choice" > $_file
+      return  $_return;
+      ;;
+
+   *)
 		warn "\$${1} is not set properly - see ${rcvar_manpage}."
 		return 1
 		;;

>Release-Note:
>Audit-Trail:
Responsible-Changed-From-To: freebsd-bugs->freebsd-rc 
Responsible-Changed-By: linimon 
Responsible-Changed-When: Wed Nov 15 17:02:20 UTC 2006 
Responsible-Changed-Why:  
Over to maintainer(s). 

http://www.freebsd.org/cgi/query-pr.cgi?pr=105568 

From: "Pietro Cerutti" <pietro.cerutti@gmail.com>
To: bug-followup@FreeBSD.org, pietro.cerutti@gmail.com
Cc:  
Subject: Re: conf/105568: [patch] Add more flexibility to rc.conf, to choose "_enable" values at startup
Date: Wed, 15 Nov 2006 20:21:29 +0100

 ------=_Part_83855_8042419.1163618489179
 Content-Type: text/plain; charset=ISO-8859-1; format=flowed
 Content-Transfer-Encoding: 7bit
 Content-Disposition: inline
 
 This new patch allows to:
 - specify a default response
    set DAEMON_ask_default="[yes|no]" in rc.conf
 - specify a timeout after which the default response will be taken as good
    set DAEMON_ask_timeout="{0-9}[s|m|h]" in rc.conf
 
 Default values have been set in rc.subr
 ASK_TIMEOUT="5s"
 ASK_DEFAULT="YES"
 
 -- 
 Pietro Cerutti
 ICQ: 117293691
 PGP: 0x9571F78E
 
 - ASCII Ribbon Campaign -
  against HTML e-mail and
  proprietary attachments
    www.asciiribbon.org
 
 ------=_Part_83855_8042419.1163618489179
 Content-Type: application/octet-stream; name=rc.subr.diff
 Content-Transfer-Encoding: base64
 X-Attachment-Id: f_euk4dzcf
 Content-Disposition: attachment; filename="rc.subr.diff"
 
 LS0tIC9ldGMvcmM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IF9jaG9pY2U9Im5vIgorICAgICAgICAgX3Jl
 dHVybj0xCisgICAgICBmaQorICAgICAgZWNobyAiJF9jaG9pY2UiID4gJF9maWxlCisgICAgICBy
 ZXR1cm4gICRfcmV0dXJuOworICAgICAgOzsKKworICAgKikKIAkJd2FybiAiXCQkezF9IGlzIG5v
 dCBzZXQgcHJvcGVybHkgLSBzZWUgJHtyY3Zhcl9tYW5wYWdlfS4iCiAJCXJldHVybiAxCiAJCTs7
 Cg==
 ------=_Part_83855_8042419.1163618489179--

From: "Pietro Cerutti" <pietro.cerutti@gmail.com>
To: bug-followup@freebsd.org
Cc:  
Subject: Re: conf/105568: [patch] Add more flexibility to rc.conf, to choose "_enable" values at startup
Date: Wed, 15 Nov 2006 20:45:34 +0100

 ------=_Part_84371_3004703.1163619934329
 Content-Type: text/plain; charset=ISO-8859-1; format=flowed
 Content-Transfer-Encoding: 7bit
 Content-Disposition: inline
 
 Trying to get the attachment encoded as txt....
 
 -- 
 Pietro Cerutti
 ICQ: 117293691
 PGP: 0x9571F78E
 
 - ASCII Ribbon Campaign -
  against HTML e-mail and
  proprietary attachments
    www.asciiribbon.org
 
 ------=_Part_84371_3004703.1163619934329
 Content-Type: text/plain; name="rc.subr.diff.txt"
 Content-Transfer-Encoding: base64
 Content-Disposition: attachment; filename="rc.subr.diff.txt"
 X-Attachment-Id: f_euk592yf
 
 LS0tIC9ldGMvcmMuc3Vici5vcmlnCVdlZCBOb3YgMTUgMTQ6MDM6NTkgMjAwNgorKysgL2V0Yy9y
 Yy5zdWJyCVdlZCBOb3YgMTUgMjA6MTA6MzIgMjAwNgpAQCAtNTYsNiArNTYsOCBAQAogSUQ9Ii91
 c3IvYmluL2lkIgogSklEPWBwcyAtcCAkJCAtbyBqaWQ9YAogSURDTUQ9ImlmIFsgLXggJElEIF07
 IHRoZW4gJElEIC11bjsgZmkiCitBU0tfVElNRU9VVD0iNXMiCitBU0tfREVGQVVMVD0iWUVTIgog
 CiBjYXNlICR7T1NUWVBF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dGhpcyBzaG91bGQgYmUgdGhlIGNhc2Ugb24gc3Rh
 cnR1cAorCisgICAgICAjIFJlYWQgdGltZW91dCBhbmQgZGVmYXVsdCBhbnN3ZXIgZm9yIGRhZW1v
 bgorICAgICAgZXZhbCBfdGltZW91dD1cJCR7bmFtZX1fYXNrX3RpbWVvdXQKKyAgICAgIGV2YWwg
 X3Jlc3BvbnNlPVwkJHtuYW1lfV9hc2tfZGVmYXVsdAorCisgICAgICBpZiBbICEgJF90aW1lb3V0
 IF07IHRoZW4KKyAgICAgICAgIF90aW1lb3V0PSRBU0tfVElNRU9VVAorICAgICAgZmkKKworICAg
 ICAgaWYgWyAhICRfcmVzcG9uc2UgXTsgdGhlbgorICAgICAgICAgX3Jlc3BvbnNlPSRBU0tfREVG
 QVVMVAorICAgICAgZmkKKworICAgICAgcmVhZCAtdCAkX3RpbWVvdXQgLXAgIlJDX0FTSyAtIEVu
 YWJsZSAkbmFtZT8gW3llc3xub10gIiBfZW5hYmxlCisgICAgICBpZiBbICQ/IC1lcSAxIF07IHRo
 ZW4KKyAgICAgICAgIF9lbmFibGU9JHtfcmVzcG9uc2V9CisgICAgICBmaQorICAgICAgaWYgY2hl
 Y2t5ZXNubyBfZW5hYmxlOyB0aGVuCisgICAgICAgICBfY2hvaWNlPSJ5ZXMiCisgICAgICAgICBf
 cmV0dXJuPTAKKyAgICAgIGVsc2UKKyAgICAgICAgIF9jaG9pY2U9Im5vIgorICAgICAgICAgX3Jl
 dHVybj0xCisgICAgICBmaQorICAgICAgZWNobyAiJF9jaG9pY2UiID4gJF9maWxlCisgICAgICBy
 ZXR1cm4gICRfcmV0dXJuOworICAgICAgOzsKKworICAgKikKIAkJd2FybiAiXCQkezF9IGlzIG5v
 dCBzZXQgcHJvcGVybHkgLSBzZWUgJHtyY3Zhcl9tYW5wYWdlfS4iCiAJCXJldHVybiAxCiAJCTs7
 Cg==
 ------=_Part_84371_3004703.1163619934329--

From: Ceri Davies <ceri@submonkey.net>
To: Pietro Cerutti <pietro.cerutti@gmail.com>
Cc: FreeBSD Gnats Submit <freebsd-gnats-submit@FreeBSD.org>
Subject: Re: conf/105568: [patch] Add more flexibility to rc.conf, to choose "_enable" values at startup
Date: Wed, 15 Nov 2006 21:38:30 +0000

 On Wed, Nov 15, 2006 at 08:45:34PM +0100, Pietro Cerutti wrote:
 
 > Trying to get the attachment encoded as txt....
 
 Just put the patch inline is easiest.
 
 Ceri

From: "Pietro Cerutti" <pietro.cerutti@gmail.com>
To: bug-followup@freebsd.org
Cc:  
Subject: Re: conf/105568: [patch] Add more flexibility to rc.conf, to choose "_enable" values at startup
Date: Wed, 15 Nov 2006 22:49:17 +0100

 The patch is inline:
 
 --- /etc/rc.subr.orig	Wed Nov 15 14:03:59 2006
 +++ /etc/rc.subr	Wed Nov 15 20:10:32 2006
 @@ -56,6 +56,8 @@
  ID="/usr/bin/id"
  JID=`ps -p $$ -o jid=`
  IDCMD="if [ -x $ID ]; then $ID -un; fi"
 +ASK_TIMEOUT="5s"
 +ASK_DEFAULT="YES"
 
  case ${OSTYPE} in
  FreeBSD)
 @@ -122,7 +124,8 @@
 
  #
  # checkyesno var
 -#	Test $1 variable, and warn if not set to YES or NO.
 +#	Test $1 variable, and warn if not set to YES, NO or ASK.
 +#	If it's "ask", let the user choose at runtime between "yes" and "no".
  #	Return 0 if it's "yes" (et al), nonzero otherwise.
  #
  checkyesno()
 @@ -140,7 +143,52 @@
  	[Nn][Oo]|[Ff][Aa][Ll][Ss][Ee]|[Oo][Ff][Ff]|0)
  		return 1
  		;;
 -	*)
 +
 +      # "ask"
 +	[Aa][Ss][Kk])
 +
 +      # answer already stored in .ask file,
 +      # this should be the case on shutdown
 +      _file="/var/run/$name.ask"
 +      if [ -f $_file ]; then
 +         read _response < $_file
 +         if checkyesno _response; then
 +            return 0
 +         else
 +            return 1
 +         fi
 +      fi
 +      # prompt and save choice to file,
 +      # this should be the case on startup
 +
 +      # Read timeout and default answer for daemon
 +      eval _timeout=\$${name}_ask_timeout
 +      eval _response=\$${name}_ask_default
 +
 +      if [ ! $_timeout ]; then
 +         _timeout=$ASK_TIMEOUT
 +      fi
 +
 +      if [ ! $_response ]; then
 +         _response=$ASK_DEFAULT
 +      fi
 +
 +      read -t $_timeout -p "RC_ASK - Enable $name? [yes|no] " _enable
 +      if [ $? -eq 1 ]; then
 +         _enable=${_response}
 +      fi
 +      if checkyesno _enable; then
 +         _choice="yes"
 +         _return=0
 +      else
 +         _choice="no"
 +         _return=1
 +      fi
 +      echo "$_choice" > $_file
 +      return  $_return;
 +      ;;
 +
 +   *)
  		warn "\$${1} is not set properly - see ${rcvar_manpage}."
  		return 1
  		;;

From: Pietro Cerutti <gahr@gahr.ch>
To: bug-followup@FreeBSD.org,  pietro.cerutti@gmail.com
Cc:  
Subject: Re: conf/105568: [patch] Add more flexibility to rc.conf, to choose
 "_enable" values at startup
Date: Mon, 01 Oct 2007 13:42:43 +0200

 This is an OpenPGP/MIME signed message (RFC 2440 and 3156)
 --------------enig71BA73101BF0FB5456761C13
 Content-Type: text/plain; charset=UTF-8
 Content-Transfer-Encoding: quoted-printable
 
 This patch applies against 6.2-STABLE
 
 --- rc.subr.orig        2007-10-01 13:21:35.000000000 +0200
 +++ rc.subr	        2007-10-01 13:37:10.000000000 +0200
 @@ -58,6 +58,9 @@
  PS=3D"/bin/ps -ww"
  JID=3D`$PS -p $$ -o jid=3D`
 
 +ASK_TIMEOUT=3D"5s"
 +ASK_DEFAULT=3D"YES"
 +
  case ${OSTYPE} in
  FreeBSD)
  	SYSCTL_W=3D"${SYSCTL}"
 @@ -123,7 +126,9 @@
 
  #
  # checkyesno var
 -#	Test $1 variable, and warn if not set to YES or NO.
 +#       Test $1 variable, and warn if not set to YES, NO or ASK.
 +#       If it's "ask", prompt the user to decide wheter to set
 +#       $1 to YES or NO.
  #	Return 0 if it's "yes" (et al), nonzero otherwise.
  #
  checkyesno()
 @@ -141,6 +146,63 @@
  	[Nn][Oo]|[Ff][Aa][Ll][Ss][Ee]|[Oo][Ff][Ff]|0)
  		return 1
  		;;
 +        [Aa][Ss][Kk])
 +                #       "ask"
 +
 +                # Answer is stored in .ask file
 +                # -> we are shutting down
 +                _file=3D"/var/run/$name.ask"
 +                if [ -f $_file ]; then
 +                        read _response < $_file
 +                        if checkyesno _response; then
 +                                return 0
 +                        else
 +                                return 1
 +                        fi
 +                fi
 +
 +                # Prompt and save answer in .ask file
 +                # -> we are entering multi-user mode
 +
 +                # Read timeout and default answer fo this daemon
 +                eval _timeout=3D\$${name}_ask_timeout
 +                eval _default=3D\=C3=A0=C3=A0{name}_ask_default
 +
 +                # Timeout not set for this daemon
 +                # -> revert to global default timeout
 +                if [ ! $_timeout ]; then
 +                        _timeout=3D$ASK_TIMEOUT
 +                fi
 +
 +                # Default answer not set for this daemon
 +                # -> revert to global default answer
 +                if [ ! $_default ]; then
 +                        _default=3D$ASK_DEFAULT
 +                fi
 +
 +                # Read decision from stdin
 +                read -t $_timeout -p "RC_ASK - Enable $name? [yes|no]"
 _enable
 +
 +                # If timeout is elapsed, set default answer
 +                if [ $? -eq 1 ]; then
 +                        _enable=3D${_response}
 +                fi
 +
 +                # Call checkyes no on answer
 +                if checkyesno _enable; then
 +                        _choice=3D"yes"
 +                        _return=3D0
 +                else
 +                        _choice=3D"no"
 +                        _return=3D1
 +                fi
 +
 +                # Save decision to .ask file
 +                echo "$_choice" > $_file
 +
 +                return $_return
 +                ;;
 +
  	*)
  		warn "\$${1} is not set properly - see ${rcvar_manpage}."
  		return 1
 
 --=20
 Pietro Cerutti
 
 PGP Public Key:
 http://gahr.ch/pgp
 
 
 --------------enig71BA73101BF0FB5456761C13
 Content-Type: application/pgp-signature; name="signature.asc"
 Content-Description: OpenPGP digital signature
 Content-Disposition: attachment; filename="signature.asc"
 
 -----BEGIN PGP SIGNATURE-----
 Version: GnuPG v1.4.7 (FreeBSD)
 
 iD8DBQFHAN04wMJqmJVx944RCmhSAKCS8s4ExqdfiLgNfMxsVOzsnPn7kACdEXzg
 1VPh3f5DkPtn+jbXqZWXFzA=
 =+Gcs
 -----END PGP SIGNATURE-----
 
 --------------enig71BA73101BF0FB5456761C13--
State-Changed-From-To: open->closed 
State-Changed-By: dougb 
State-Changed-When: Fri Oct 7 02:29:59 UTC 2011 
State-Changed-Why:  

No interest in this patch has come up in 5 years, I think it's safe to say 
it's not going to happen. Also FYI, it's no longer necessary to have _enable 
set to use the stop argument. 

What you describe could also be accomplished with an rc.local script that 
calls the various rc.d scripts with the onestart argument. 


hth, 

Doug 


Responsible-Changed-From-To: freebsd-rc->dougb 
Responsible-Changed-By: dougb 
Responsible-Changed-When: Fri Oct 7 02:29:59 UTC 2011 
Responsible-Changed-Why:  

I closed it. 

http://www.freebsd.org/cgi/query-pr.cgi?pr=105568 
>Unformatted:
