Re: [Patch] - Add -u (update packages) to sysupgrade(8)
On 2021-08-30 22:16 +0100, Stuart Henderson wrote: > On 2021/08/28 09:26, Sebastien Marie wrote: > > On Fri, Aug 27, 2021 at 08:17:51PM -0500, Aaron Poffenberger wrote: > > > Following is patch to add a flag to upgrade packages during > > > rc.firsttime after a sysupgrade. > > > > > > > if you need this flag, is it a ponctual usage (running sysupgrade with > > the flag or not, depending the moment) ? or you will use it everytime > > you use sysupgrade ? > > For my normal use, I decide at the time I run sysupgrade whether I want > to update packages or not (if it's just a small bump in base, or I'm > updating to test something quickly and it won't matter about packages, > then I'll often skip it to save time - also I'll skip it if I know > there's a major pgsql update in the way). I'd say my "more common" case > would be to _not_ update. > > > for permanent usage, I would recommand using existing facility: the > > /upgrade.site script. > > That's handy and I didn't know about it (though it does break /u > for /usr tab-completion though :p). I don't think I'll use it for this > usage but it's nice to have. > I tried /upgrade.site. It works, but I have to agree there are times I'd rather upgrade and move on without packages. A flag provides that flexibility. Regardless, documenting /upgrade.site is useful I didn't know about it until Sebastien Marie brought it up. On some machines I find it helpful.
Re: [Patch] - Add -u (update packages) to sysupgrade(8)
On 2021/08/28 09:26, Sebastien Marie wrote: > On Fri, Aug 27, 2021 at 08:17:51PM -0500, Aaron Poffenberger wrote: > > Following is patch to add a flag to upgrade packages during > > rc.firsttime after a sysupgrade. > > > > if you need this flag, is it a ponctual usage (running sysupgrade with > the flag or not, depending the moment) ? or you will use it everytime > you use sysupgrade ? For my normal use, I decide at the time I run sysupgrade whether I want to update packages or not (if it's just a small bump in base, or I'm updating to test something quickly and it won't matter about packages, then I'll often skip it to save time - also I'll skip it if I know there's a major pgsql update in the way). I'd say my "more common" case would be to _not_ update. > for permanent usage, I would recommand using existing facility: the > /upgrade.site script. That's handy and I didn't know about it (though it does break /u for /usr tab-completion though :p). I don't think I'll use it for this usage but it's nice to have.
Re: [Patch] - Add -u (update packages) to sysupgrade(8)
Oooh, neat. Thanks for this! On 2021-08-28 09:26 +02, Sebastien Marie wrote: > On Fri, Aug 27, 2021 at 08:17:51PM -0500, Aaron Poffenberger wrote: >> Following is patch to add a flag to upgrade packages during >> rc.firsttime after a sysupgrade. >> > > if you need this flag, is it a ponctual usage (running sysupgrade with > the flag or not, depending the moment) ? or you will use it everytime > you use sysupgrade ? > > for permanent usage, I would recommand using existing facility: the > /upgrade.site script. > > for example: > > # cat /upgrade.site > #!/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 > # > > bsd.rd upgrade will run /upgrade.site (/ from target root disk) at end > of the upgrade process (it is ran chrooted in the target root > disk). during upgrade it is adding lines in /etc/rc.firsttime, and at > reboot it will run "pkg_add -Iu" and "sysclean" (mailing output to > root) each time. > > It would be more convinent than using a flag at sysupgrade invocation > (no risk to omit it). > > Thanks. > -- > Sebastien Marie > -- I'm not entirely sure you are real.
Re: [Patch] - Add -u (update packages) to sysupgrade(8)
On Fri, Aug 27, 2021 at 08:17:51PM -0500, Aaron Poffenberger wrote: > Following is patch to add a flag to upgrade packages during > rc.firsttime after a sysupgrade. > if you need this flag, is it a ponctual usage (running sysupgrade with the flag or not, depending the moment) ? or you will use it everytime you use sysupgrade ? for permanent usage, I would recommand using existing facility: the /upgrade.site script. for example: # cat /upgrade.site #!/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 # bsd.rd upgrade will run /upgrade.site (/ from target root disk) at end of the upgrade process (it is ran chrooted in the target root disk). during upgrade it is adding lines in /etc/rc.firsttime, and at reboot it will run "pkg_add -Iu" and "sysclean" (mailing output to root) each time. It would be more convinent than using a flag at sysupgrade invocation (no risk to omit it). Thanks. -- Sebastien Marie
Re: [Patch] - Add -u (update packages) to sysupgrade(8)
On 2021/08/27 23:07, Aaron Poffenberger wrote: > On 2021-08-27 23:00 -0400, Daniel Jakots wrote: > > On Fri, 27 Aug 2021 20:17:51 -0500, Aaron Poffenberger > > wrote: > > > > > + ${PKGS} && echo "pkg_add -Iu" >> /etc/rc.firsttime > > > > I don't think this addition is worth it, but anyway this won't work for I do - I do this a lot manually and it's a pain to start sysupgrade downloading with -n, wait for it to finish, then edit the file so would welcome a flag to do it. I find the method helpful as it means you don't run outdated packages after reboot (which might even crash after some updates) and don't need to reboot 3 times (to bsd.rd for sysupgrade, then to the new kernel, then again to restart package daemons etc) which takes flipping ages on some servers. It's not perfect because some packages ask questions if pkg_adf is run in interactive mode (mostly just postgresql across major version updates). Aaron's diff uses -I to disable that which stops those packages from getting updated when the trigger condition applies, but that's not very common in the ports tree and doesn't make it less useful. The point at which rc.firsttime runs is after sshd starts, so if the package update does run into any problems you can still connect in to fix, and progress can be seen in "dmesg -s" or syslog. > > people running -current when it's release time and the release isn't > > available yet (-Dsnap). sysupgrade itself doesn't work properly in that case either, you need tricks to get from "not quite release but the -beta suffix was removed" to actual release. I think there might be other problems with the system relating to version handling in that time too. Basically we just need to keep that to the smallest possible time window. > Initially I considered a PKG_ADD environment variable to let the > override the command concatenated to /etc/rc.firsttime, but held > off until needed. Something like the following would resolve that > concern. > > PKG_ADD='pkg_add -Iu -Dsnap' sysupgrade -u No need for that complexity, just set a variable to -Dsnap if sysupgrade -s was used and include it on the line that adds pkg_add to the file. Bikeshed: I think I'd prefer using a -p flag to signify packages rather than -u.
Re: [Patch] - Add -u (update packages) to sysupgrade(8)
On 2021-08-27 23:00 -0400, Daniel Jakots wrote: > On Fri, 27 Aug 2021 20:17:51 -0500, Aaron Poffenberger > wrote: > > > + ${PKGS} && echo "pkg_add -Iu" >> /etc/rc.firsttime > > I don't think this addition is worth it, but anyway this won't work for > people running -current when it's release time and the release isn't > available yet (-Dsnap). > > Cheers, > Daniel > Initially I considered a PKG_ADD environment variable to let the override the command concatenated to /etc/rc.firsttime, but held off until needed. Something like the following would resolve that concern. PKG_ADD='pkg_add -Iu -Dsnap' sysupgrade -u --Aaron
Re: [Patch] - Add -u (update packages) to sysupgrade(8)
On Fri, 27 Aug 2021 20:17:51 -0500, Aaron Poffenberger wrote: > + ${PKGS} && echo "pkg_add -Iu" >> /etc/rc.firsttime I don't think this addition is worth it, but anyway this won't work for people running -current when it's release time and the release isn't available yet (-Dsnap). Cheers, Daniel
[Patch] - Add -u (update packages) to sysupgrade(8)
Following is patch to add a flag to upgrade packages during rc.firsttime after a sysupgrade. --Aaron Index: sysupgrade.8 === RCS file: /cvs/src/usr.sbin/sysupgrade/sysupgrade.8,v retrieving revision 1.10 diff -u -p -u -r1.10 sysupgrade.8 --- sysupgrade.83 Oct 2019 12:43:58 - 1.10 +++ sysupgrade.827 Aug 2021 19:33:11 - @@ -66,6 +66,11 @@ This is the default if the system is cur .It Fl s Upgrade to a snapshot. This is the default if the system is currently running a snapshot. +.It Fl u +Upgrade packages. +Upgrade installed packages when +.Xr rc.firsttime 8 +is run. .El .Sh FILES .Bl -tag -width "/auto_upgrade.conf" -compact @@ -84,6 +89,7 @@ Directory the upgrade is downloaded to. .Xr installurl 5 , .Xr autoinstall 8 , .Xr release 8 +.Xr rc.firsttime 8 .Sh HISTORY .Nm first appeared in Index: sysupgrade.sh === RCS file: /cvs/src/usr.sbin/sysupgrade/sysupgrade.sh,v retrieving revision 1.44 diff -u -p -u -r1.44 sysupgrade.sh --- sysupgrade.sh 22 Oct 2020 07:19:42 - 1.44 +++ sysupgrade.sh 27 Aug 2021 19:29:01 - @@ -77,14 +77,16 @@ SNAP=false FORCE=false KEEP=false REBOOT=true +PKGS=false -while getopts fknrs arg; do +while getopts fknrsu arg; do case ${arg} in f) FORCE=true;; k) KEEP=true;; n) REBOOT=false;; r) RELEASE=true;; s) SNAP=true;; + u) PKGS=true;; *) usage;; esac done @@ -193,6 +195,7 @@ if ! ${KEEP}; then cat <<__EOT > /etc/rc.firsttime rm -f ${SETSDIR}/{${CLEAN}} __EOT + ${PKGS} && echo "pkg_add -Iu" >> /etc/rc.firsttime fi echo Fetching updated firmware.