Using /etc/rc.d/devfs from command-line
Jeremie Le Hen
jeremie at le-hen.org
Thu Feb 22 08:45:07 UTC 2007
Yar, all,
Thank you for your feedback. Please Cc: me in reply.
On Thu, Feb 22, 2007 at 05:02:51AM +0300, Yar Tikhiy wrote:
> On Thu, Feb 22, 2007 at 12:11:08AM +0100, Jeremie Le Hen wrote:
> > Hi,
> >
> > The attached patch allows to provide arguments to rc.d/devfs with
> > the same syntax as $devfs_set_rulesets. This is then easier to mount
> > manually devfs inside a directory and apply some predefined rulesets
> > on it. Before this patch you had to manually apply rules to the
> > devfs mount point, provided pre-configured rulesets had been loaded
> > into the kernel (with rc.subr's devfs_init_rulesets()).
>
> This topic could be more appropriate on freebsd-rc.
Granted. Sorry I haven't thought of it before my first post.
> > [...previous patch snipped...]
>
> Excuse me, but the last part of your patch looks like an unjustified
> hack. The proper way is to pass additional arguments to run_rc_command
> so that it passes them on to the respective method. If you just
> change
>
> run_rc_command "$1"
>
> to
>
> run_rc_command "$@"
>
> devfs_start() will get the additional arguments as its positional
> parameters $1, $2, ... Then you will be able to detect that
> there are such arguments and act correspondingly from devfs_start().
>
> There are other examples in /etc/rc.d. Note that for some reason
> they use $*, not "$@":
>
> run_rc_command $*
>
> I cannot think of a good reason to do so.
Actually I only knew one rc.d script accepting command-line arguments
(rc.d/jail) and wanted to stay as close to it as possible.
Unfortunately this involved hijacking $start_cmd here.
I've rewritten the script in a less hackish way following your advices.
I have one concern though, I wonder whether devfs_init_rulesets() could
be called unconditionally at the beginning of devfs_start() or not.
The result would be to load pre-defined rulesets from devfs.rules(5)
at boot time regardless $devfs_system_ruleset or $devfs_set_rulesets
are defined. This surely should not be MFC'd though.
Best regards,
--
Jeremie Le Hen
< jeremie at le-hen dot org >< ttz at chchile dot org >
More information about the freebsd-rc
mailing list