On 2021-08-28 19:45 +0200, Sebastien Marie <sema...@online.fr> wrote:
> On Sat, Aug 28, 2021 at 05:05:18PM +0000, Klemens Nanni wrote:
> > On Sat, Aug 28, 2021 at 10:44:48AM -0500, Aaron Poffenberger wrote:
> > > Based on conversations in another thread, here's a patch documenting
> > > use of /upgrade.site in the sysupgrade(8) man page.
> > > 
> > > The revised doc references /upgrade.site and includes examples for
> > > updating packages from Sebastien Marie.
> > 
> > Documenting is the right approach, imho (I didn't even know about
> > $MODE.site) but this should probably be done in autoinstall(8).
> > 
> > This feature has nothing to do with sysupgrade per se and next to
> > upgrade.site there's also install.site.
> 
> $MODE.site isn't specially related to autoinstall(8) too :)
> 
> > I'd amend autoinstall(8) and briefly mention it in sysupgrade(8), just
> > via EXAMPLES or so to avoid duplication but showing a neat usecase.
> 
> Currently, these scripts seems to be only documented in the FAQ
> (https://www.openbsd.org/faq/faq4.html#site). so having some
> additionnal references at them in few man pages would be good.
> 
> Having examples in sysupgrade(8) and in autoinstall(8) makes sense to
> me.
> 
> FAQ could be expanded a bit too.
> 
> Thanks.
> -- 
> Sebastien Marie
> 

I agree that /install.site needs explaining, but I don't think it fits
well in autoinstall(8). siteXX.tgz isn't touched on there and would have
to be addressed as well.

I wouldn't mine working on that, but I'd prefer to put it where it belongs,
or in a separate man page.

New diff attached. I see I put the wrong file name in the FILES section. Also,
I simplified the example back to Sebastien Marie's original.

--Aaron


Index: sysupgrade.8
===================================================================
RCS file: /cvs/src/usr.sbin/sysupgrade/sysupgrade.8,v
retrieving revision 1.10
diff -u -p -r1.10 sysupgrade.8
--- sysupgrade.8        3 Oct 2019 12:43:58 -0000       1.10
+++ sysupgrade.8        28 Aug 2021 17:48:18 -0000
@@ -46,6 +46,11 @@ The bootloader will automatically choose
 triggering a one-shot upgrade using the files in
 .Pa /home/_sysupgrade .
 .Pp
+If
+.Pa /upgrade.site
+exists and is executable, it is executed at the end of the upgrade
+process, prior to rebooting.
+.Pp
 The options are as follows:
 .Bl -tag -width Ds
 .It Fl f
@@ -73,16 +78,39 @@ This is the default if the system is cur
 Response file for the ramdisk kernel.
 .It Pa /bsd.upgrade
 The ramdisk kernel to trigger an unattended upgrade.
+.It Pa /upgrade.site
+Executable file of actions to run after upgrade.
 .It Pa /etc/installurl
 .Ox
 mirror top-level URL for fetching an upgrade.
 .It Pa /home/_sysupgrade
 Directory the upgrade is downloaded to.
 .El
+.Sh EXAMPLES
+.Pa /upgrade.site
+script to upgrade packages and check sysclean when
+.Pa /etc/rc.firsttime
+runs:
+.Bd -literal
+       #!/bin/sh
+       PATH=/sbin:/bin:/usr/sbin:/usr/bin
+
+       # upgrade packages
+       echo 'pkg_add -Iu' >>/etc/rc.firsttime
+
+       # run sysclean (if installed)
+       echo '[ -x /usr/local/sbin/sysclean ] && \\
+       /usr/local/sbin/sysclean | mail -Es sysclean \\
+       root &' >>/etc/rc.firsttime
+
+       exit 0
+       #
+.Ed
 .Sh SEE ALSO
 .Xr signify 1 ,
 .Xr installurl 5 ,
 .Xr autoinstall 8 ,
+.Xr rc 8 ,
 .Xr release 8
 .Sh HISTORY
 .Nm

Reply via email to