Skip site navigation (1)Skip section navigation (2)
Date:      Mon, 22 Mar 1999 18:10:14 +0900
From:      "Daniel C. Sobral" <dcs@newsguy.com>
To:        "Jordan K. Hubbard" <jkh@zippy.cdrom.com>, current@freebsd.org
Subject:   Re: /etc/rc.conf, take 46!
Message-ID:  <36F608F6.1F2C1160@newsguy.com>
References:  <39218.922068401@zippy.cdrom.com>

next in thread | previous in thread | raw e-mail | index | archive | help
Forget about code in rc.conf. Put the logic in the the scripts. Or,
better, put the logic in rc.suck (well, find a better name... :),
and . /etc/rc.suck instead.

"Jordan K. Hubbard" wrote:
> 
> OK, so it seems everyone's found something to like and dislike about
> the new scheme.  In that regard, it seems pretty much equivalent to
> the previous layout when that was first introduced. :)
> 
> However, incremental refinement for this stuff has always been the
> order of the day, so in that spirit, here's my proposal to deal with
> the most recent set of gripes: That rc.conf contains "code" in
> addition to data.
> 
> The following diffs make rc.conf a variable-only file, at the cost of
> distributing the hook-calling mechanism into all the former clients of
> rc.conf.  That really doesn't bother me if it doesn't bother you, and
> further optimization of it can always be another future incremental
> refinement.  Another incremental, albeit contraversial, refinement
> would be to change /etc/defaults/rc.conf and friends into something
> truely machine-parsable, changing statements like this:
> 
>        if [ -f /some/conf/file ]; then
>             . /some/conf/file
>        fi
> 
> Into something like this:
> 
>        if [ -f /some/conf/file ]; then
>             eval `/sbin/rcvtosh /some/conf/file`
>        fi
> 
> But these changes do not attempt to do that, they simply attempt to
> make the existing rc.conf format somewhat easier to parse.  Comments
> requested.
> 
> Index: netstart
> ===================================================================
> RCS file: /home/ncvs/src/etc/netstart,v
> retrieving revision 1.53
> diff -u -u -r1.53 netstart
> --- netstart    1999/02/10 18:08:16     1.53
> +++ netstart    1999/03/22 01:54:16
> @@ -12,8 +12,11 @@
>  # If there is a global system configuration file, suck it in.
>  if [ -f /etc/defaults/rc.conf ]; then
>         . /etc/defaults/rc.conf
> -elif [ -f /etc/rc.conf ]; then
> -       . /etc/rc.conf
> +       for i in ${rc_conf_files}; do
> +               if [ -f $i ]; then
> +                       . $i
> +               fi
> +       done
>  fi
> 
>  if [ -f /etc/rc.network ]; then
> Index: pccard_ether
> ===================================================================
> RCS file: /home/ncvs/src/etc/pccard_ether,v
> retrieving revision 1.11
> diff -u -u -r1.11 pccard_ether
> --- pccard_ether        1999/02/22 02:55:18     1.11
> +++ pccard_ether        1999/03/22 01:55:27
> @@ -7,11 +7,14 @@
>  # example: pccard_ether ep0 -link0
>  #
> 
> -# Suck in the configuration variables
> +# If there is a global system configuration file, suck it in.
>  if [ -f /etc/defaults/rc.conf ]; then
>         . /etc/defaults/rc.conf
> -elif [ -f /etc/rc.conf ]; then
> -       . /etc/rc.conf
> +       for i in ${rc_conf_files}; do
> +               if [ -f $i ]; then
> +                       . $i
> +               fi
> +       done
>  fi
> 
>  if [ "x$pccard_ifconfig" != "xNO" ] ; then
> Index: rc
> ===================================================================
> RCS file: /home/ncvs/src/etc/rc,v
> retrieving revision 1.183
> diff -u -u -r1.183 rc
> --- rc  1999/03/17 04:00:04     1.183
> +++ rc  1999/03/22 01:56:24
> @@ -33,11 +33,13 @@
>  fi
> 
>  # If there is a global system configuration file, suck it in.
> -#
>  if [ -f /etc/defaults/rc.conf ]; then
>         . /etc/defaults/rc.conf
> -elif [ -f /etc/rc.conf ]; then
> -       . /etc/rc.conf
> +       for i in ${rc_conf_files}; do
> +               if [ -f $i ]; then
> +                       . $i
> +               fi
> +       done
>  fi
> 
>  # Configure ccd devices.
> Index: rc.devfs
> ===================================================================
> RCS file: /home/ncvs/src/etc/rc.devfs,v
> retrieving revision 1.4
> diff -u -u -r1.4 rc.devfs
> --- rc.devfs    1999/02/10 18:08:16     1.4
> +++ rc.devfs    1999/03/22 01:56:39
> @@ -1,11 +1,15 @@
>  #
>  # $Id: rc.devfs,v 1.4 1999/02/10 18:08:16 jkh Exp $
>  #
> +
>  # If there is a global system configuration file, suck it in.
>  if [ -f /etc/defaults/rc.conf ]; then
>         . /etc/defaults/rc.conf
> -elif [ -f /etc/rc.conf ]; then
> -       . /etc/rc.conf
> +       for i in ${rc_conf_files}; do
> +               if [ -f $i ]; then
> +                       . $i
> +               fi
> +       done
>  fi
> 
>  # Setup DEVFS, ie permisisons, links etc.
> Index: rc.diskless2
> ===================================================================
> RCS file: /home/ncvs/src/etc/rc.diskless2,v
> retrieving revision 1.2
> diff -u -u -r1.2 rc.diskless2
> --- rc.diskless2        1999/02/10 18:08:16     1.2
> +++ rc.diskless2        1999/03/22 01:57:04
> @@ -2,11 +2,13 @@
>  #
> 
>  # If there is a global system configuration file, suck it in.
> -#
>  if [ -f /etc/defaults/rc.conf ]; then
>         . /etc/defaults/rc.conf
> -elif [ -f /etc/rc.conf ]; then
> -       . /etc/rc.conf
> +       for i in ${rc_conf_files}; do
> +               if [ -f $i ]; then
> +                       . $i
> +               fi
> +       done
>  fi
> 
>  mount_mfs -s ${var_run_sectors:=2048} -T qp120at dummy /var/run
> Index: rc.firewall
> ===================================================================
> RCS file: /home/ncvs/src/etc/rc.firewall,v
> retrieving revision 1.20
> diff -u -u -r1.20 rc.firewall
> --- rc.firewall 1999/02/10 18:08:16     1.20
> +++ rc.firewall 1999/03/22 01:57:16
> @@ -2,11 +2,14 @@
>  # Setup system for firewall service.
>  # $Id: rc.firewall,v 1.20 1999/02/10 18:08:16 jkh Exp $
> 
> -# Suck in the configuration variables.
> +# If there is a global system configuration file, suck it in.
>  if [ -f /etc/defaults/rc.conf ]; then
>         . /etc/defaults/rc.conf
> -elif [ -f /etc/rc.conf ]; then
> -       . /etc/rc.conf
> +       for i in ${rc_conf_files}; do
> +               if [ -f $i ]; then
> +                       . $i
> +               fi
> +       done
>  fi
> 
>  ############
> Index: defaults/rc.conf
> ===================================================================
> RCS file: /home/ncvs/src/etc/defaults/rc.conf,v
> retrieving revision 1.4
> diff -u -u -r1.4 rc.conf
> --- rc.conf     1999/03/17 04:00:04     1.4
> +++ rc.conf     1999/03/22 01:58:02
> @@ -202,16 +202,3 @@
>  kern_securelevel="-1"  # range: -1..3 ; `-1' is the most insecure
>  update_motd="YES"      # update version info in /etc/motd (or NO)
>  vinum_drives=""                # put in names of disks containing vinum drives
> -
> -##############################################################
> -### Allow local configuration override at the very end here ##
> -##############################################################
> -#
> -#
> -
> -for i in ${rc_conf_files}; do
> -       if [ -f $i ]; then
> -               . $i
> -       fi
> -done
> -
> 
> To Unsubscribe: send mail to majordomo@FreeBSD.org
> with "unsubscribe freebsd-current" in the body of the message

--
Daniel C. Sobral			(8-DCS)
dcs@newsguy.com
dcs@freebsd.org

	"What happened?"
	"It moved, sir!"



To Unsubscribe: send mail to majordomo@FreeBSD.org
with "unsubscribe freebsd-current" in the body of the message




Want to link to this message? Use this URL: <https://mail-archive.FreeBSD.org/cgi/mid.cgi?36F608F6.1F2C1160>