Skip site navigation (1)Skip section navigation (2)
Date:      Mon, 01 Apr 2019 22:25:38 +0000
From:      bugzilla-noreply@freebsd.org
To:        bugs@FreeBSD.org
Subject:   [Bug 236949] Attempt to provide a boot profile manager
Message-ID:  <bug-236949-227@https.bugs.freebsd.org/bugzilla/>

next in thread | raw e-mail | index | archive | help
https://bugs.freebsd.org/bugzilla/show_bug.cgi?id=3D236949

            Bug ID: 236949
           Summary: Attempt to provide a boot profile manager
           Product: Base System
           Version: CURRENT
          Hardware: Any
                OS: Any
            Status: New
          Severity: Affects Only Me
          Priority: ---
         Component: misc
          Assignee: bugs@FreeBSD.org
          Reporter: phascolarctos@protonmail.ch

Created attachment 203310
  --> https://bugs.freebsd.org/bugzilla/attachment.cgi?id=3D203310&action=
=3Dedit
boot profile manager rc script

At the moment, as far as I know, it is not possible in FreeBSD to have
different profiles to select services at startup. For example, I can not de=
cide
at boot time to start netif on my laptop if and only if I have access to a
connection: my choices are to always start it at boot or to always start it=
 by
hand after boot.
My rc script aims to give users choice at boot time.

The service is called "boot_profile_manager" and is of course activated by
setting boot_profile_manager=3D"YES" into rc.conf (but do not use rc.conf.d=
: see
later).
The script should be the first service started on the system: I tried to de=
fine
this condition by setting "BEFORE: systcl". At boot time it will print a
numbered list of profiles given by the variable $boot_profile_manager_profi=
les
that must be defined in rc.conf -- e.g, if boot_profile_manager=3D"default
no_network testing", the menu will be:
1. default
2. no_network
3. testing

To each profile must correpond a directory into
/usr/local/etc/boot_profile_manager. Thus in the example we will have the
directories /usr/local/etc/boot_profile_manager/default,
/usr/local/etc/boot_profile_manager/no_network and
/usr/local/etc/boot_profile_manager/testing.

When user selects a profile, /etc/rc.conf.d becomes a symlink to the direct=
ory
of the selected profile. Thus if user selects profile 2 of our example, then
/etc/rc.conf.d will be a symlink to
/usr/local/etc/boot_profile_manager/no_network.
(To be able to make the symlink, / is temporarly mounted rw and then restor=
ed
read-only.)

A timeout is set by default to 5 seconds in case user does not select any
profile and can be set to any value through "boot_profile_manager_timeout"
variable: after the timeout, profile 1 is selected by default.

That way users can put in /etc/rc.conf any configuration common to all prof=
iles
(e.g. hostname) and use directories into /usr/local/etc/boot_profile_manage=
r as
choices for /etc/rc.conf.d.

I have tested successfully my script in a virtual machine running 13.0-CURR=
ENT
r345444 through bhyve and in my own system running 12.0-STABLE r345758.

I think it would be nice to include this service into base system, but feel
free to ask me to make a port of it if it would be preferable.
Of course, I will be glad to make any modification required to meet standar=
ds,
improve quality etc. and I will write a manpage once the final version will=
 be
ready.

--=20
You are receiving this mail because:
You are the assignee for the bug.=



Want to link to this message? Use this URL: <https://mail-archive.FreeBSD.org/cgi/mid.cgi?bug-236949-227>