Re: git: 27b9777c28b4 - main - libexec/rc: Add var_run rc script
- In reply to: Bryan Drewery : "Re: git: 27b9777c28b4 - main - libexec/rc: Add var_run rc script"
- Go to: [ bottom of page ] [ top of archives ] [ this month ]
Date: Tue, 20 Sep 2022 18:51:17 UTC
On Tue, 20 Sep 2022 10:44:05 -0700
Bryan Drewery <bdrewery@FreeBSD.org> wrote:
> On 9/5/2022 6:20 AM, Cy Schubert wrote:
> > The branch main has been updated by cy:
> >
> > URL: https://cgit.FreeBSD.org/src/commit/?id=27b9777c28b4e9474bdc500c28d04feec48fbb84
> >
> > commit 27b9777c28b4e9474bdc500c28d04feec48fbb84
> > Author: Cy Schubert <cy@FreeBSD.org>
> > AuthorDate: 2022-08-28 12:48:25 +0000
> > Commit: Cy Schubert <cy@FreeBSD.org>
> > CommitDate: 2022-09-05 13:19:42 +0000
> >
> > libexec/rc: Add var_run rc script
> >
> > Users with a tmpfs /var/run will lose the directory tree state of
> > /var/run at reboot. This rc script will optionally (by default)
> > capture the state of the directory structure in /var/run prior to
> > shutdown and recreate it at system boot.
> >
> > Alternatively a user can save the state of the /var/run directories
> > manually using service var_run save and disable the autosaving of
> > /var/run state using the var_run_autosave variable, for those
> > paranoid SSD users.
> >
> > PR: 259585, 259699
> > Reported by: freebsd@walstatt-de.de,
> > Reviewed by: philip, gbe (previous version)
> > MFC after: 1 week
> > Differential Revision: https://reviews.freebsd.org/D36386
> > ---
> > etc/mtree/BSD.var.dist | 2 ++
> > libexec/rc/rc.conf | 6 ++++++
> > libexec/rc/rc.d/Makefile | 1 +
> > libexec/rc/rc.d/var_run | 47 +++++++++++++++++++++++++++++++++++++++++++++++
> > share/man/man5/rc.conf.5 | 28 ++++++++++++++++++++++++++++
> > 5 files changed, 84 insertions(+)
> >
> > diff --git a/etc/mtree/BSD.var.dist b/etc/mtree/BSD.var.dist
> > index 0f73ba1824ae..24961accf7fb 100644
> > --- a/etc/mtree/BSD.var.dist
> > +++ b/etc/mtree/BSD.var.dist
> > @@ -46,6 +46,8 @@
> > ..
> > ipf mode=0700 tags=package=ipf
> > ..
> > + mtree
> > + ..
> > ntp uname=ntpd gname=ntpd
> > ..
> > pkg
> > diff --git a/libexec/rc/rc.conf b/libexec/rc/rc.conf
> > index 6b2c33792ea7..bc908075d033 100644
> > --- a/libexec/rc/rc.conf
> > +++ b/libexec/rc/rc.conf
> > @@ -61,6 +61,12 @@ varmfs_flags="-S" # Extra mount options for the mfs /var
> > mfs_type="auto" # "md", "tmpfs", "auto" to prefer tmpfs with md as fallback
> > populate_var="AUTO" # Set to YES to always (re)populate /var, NO to never
> > cleanvar_enable="YES" # Clean the /var directory
> > +var_run_enable="NO" # Save/restore /var/run structure at shutdown/reboot
> > +var_run_autosave="NO" # Only restore /var/run structure at shutdown/reboot
> > + # The user is expected to issue service var_run save to
> > + # manually save the /var/run mtree
> > +var_run_mtree="/var/db/mtree/BSD.var-run.mtree"
> > + # Where to save /var/run mtree
> > local_startup="${_localbase}/etc/rc.d" # startup script dirs.
> > script_name_sep=" " # Change if your startup scripts' names contain spaces
> > rc_conf_files="/etc/rc.conf /etc/rc.conf.local"
> > diff --git a/libexec/rc/rc.d/Makefile b/libexec/rc/rc.d/Makefile
> > index 3eabd17df993..e8ee61ffdff8 100644
> > --- a/libexec/rc/rc.d/Makefile
> > +++ b/libexec/rc/rc.d/Makefile
> > @@ -111,6 +111,7 @@ CONFS= DAEMON \
> > ugidfw \
> > ${_utx} \
> > var \
> > + var_run \
> > watchdogd
> >
> > .if ${MK_NIS} != "no"
> > diff --git a/libexec/rc/rc.d/var_run b/libexec/rc/rc.d/var_run
> > new file mode 100755
> > index 000000000000..8da3f40a0e7c
> > --- /dev/null
> > +++ b/libexec/rc/rc.d/var_run
> > @@ -0,0 +1,47 @@
> > +#!/bin/sh
> > +
> > +# PROVIDE: var_run
> > +# REQUIRE: mountcritlocal
> > +# BEFORE: cleanvar
>
> Don't we need the shutdown keyword too?
>
> # KEYWORD: shutdown
Thanks. Fixed in b77b3099685f.
--
Cheers,
Cy Schubert <Cy.Schubert@cschubert.com>
FreeBSD UNIX: <cy@FreeBSD.org> Web: http://www.FreeBSD.org
NTP: <cy@nwtime.org> Web: https://nwtime.org
e^(i*pi)+1=0