Commit Graph

114 Commits

Author SHA1 Message Date
Ed Maste
e27ded83c7 freebsd-update: use grep -E instead of egrep
GNU egrep emits a warning that it is obsolescent and suggests grep -E
instead.  Switch to grep -E in case we end up invoking GNU (e)grep (and
for consistency with other invocations in this file).

Reported by:	Steffen Nurpmeso
Sponsored by:	The FreeBSD Foundation
2023-03-02 18:58:58 -05:00
Ed Maste
ceb5f28ba5 freebsd-update: re-edit files if merge conflict markers remain
freebsd-update will open ${EDITOR} if conflicts occur while merging
updates to config files.  Inform the user if they've left conflict
markers behind, and go back to editing the file.

PR:		185546
PR:		229689
Reviewed by:	delphij
Sponsored by:	The FreeBSD Foundation
Differential Revision:	https://reviews.freebsd.org/D37703
2023-03-01 20:20:33 -05:00
Ed Maste
e093c61b2d freebsd-update: avoid effects of user's environment on grep
A user had GREP_OPTIONS containing --color=always, which broke grep use
in freebsd-update.  Unset this environment variable.

PR:		255990
Reviewed by:	kevans
MFC after:	3 days
Sponsored by:	The FreeBSD Foundation
2023-03-01 11:02:54 -05:00
Gordon Bergling
8f98a937ed uname.1: Clarify the -r option
It is some times hard to understand the difference between
kernel version and userland version. So clarify the -r option
of uname(1) in terms of a printed kernel version.

While here, add some cross references:

- cross reference freebsd-version(1) in uname(1)
- cross reference freebsd-version(1) and uname(1) in freebsd-update(8)

PR:		265594
Reported by:	rwatson
Reviewed by:	gbe, imp
MFC after:	1 week
Differential Revision:	https://reviews.freebsd.org/D36516
2022-09-16 13:27:54 +02:00
Ed Maste
6cd1bc5316 freebsd-update: restart sshd after upgrade
Sometimes the parent-child sshd protocol changes during an upgrade, and
when this happens sshd will not accept new connections until it is
restarted.

PR:		263489
Reviewed by:	kevans, gjb
MFC after:	2 weeks
Sponsored by:	The FreeBSD Foundation
Differential Revision:	https://reviews.freebsd.org/D35109
2022-05-02 14:38:19 -04:00
Mateusz Piotrowski
460ad988a9 freebsd-update.8: Note availability of updates for ALPHA, BETA, and RC
While here, restructure the section about the binary updates
availability.

MFC after:	1 week
2022-04-22 14:37:14 +02:00
Mateusz Piotrowski
f69f064483 freebsd-update.8: Add --currently-running to synopsis
While here, sort flags in synopsis.

MFC after:	3 days
2022-04-22 13:57:11 +02:00
Mateusz Piotrowski
075999d3f1 Cross-reference nextboot(8) and freebsd-update(8)
MFC after:	1 week
2022-03-29 15:15:35 +02:00
Mateusz Piotrowski
15647a7106 freebsd-update.8: Fix use of mdoc(8) macros
- Use Ar for arguments.
- Use Cm for freebsd-update commands like "upgrade".
- Reference other manuals with Xr when possible.

MFC after:	1 week
2022-03-29 14:39:15 +02:00
Kyle Evans
e01e8f911b freebsd-update: improve BE creation feature
This addresses one nit and one bug in the BE creation feature of
freebsd-update:

The nit addressed is that it currently only names the BEs after the
userland version, but the kernel version may be higher.  After this
change, we request both and pass them through sort(1) to choose the
highest.  This is especially helpful if a freebsd-update patch touched
one but not the other.

The bug fixed is that roots updated that are not located at '/', e.g.,
by using -b or -j, will no longer create boot environments
automatically.  There's a very low chance these will actually change the
BE in any meaningful way, anyways.  It could make sense in the future
to allow an argument-override to create the BE anyways if someone comes
up with a non-standard setup, e.g., where a jail is an important part of
their boot environment on an appliance or some such setup.

Half of this patch is submitted by delphij@, the other half kevans@.

PR:		261446
MFC after:	3 days
Reviewed by:	delphij, emaste, Dave Fullard <dave_fullard.ca>
Differential Revision:	https://reviews.freebsd.org/D34257
2022-02-12 15:36:24 -06:00
Faraz Vahedi
c76da1f010 freebsd-update(8): Add -j flag to support jails
Make freebsd-update(8) support jails by adding the -j flag which takes
a jail jid or name as an argument. This takes advantage of the recently
added -j support to freebsd-version(8) in order to get the version of
the installed userland.

Reviewed by:	dteske, kevans
MFC after:	1 week
Differential Revision:	https://reviews.freebsd.org/D25711
2021-10-01 13:51:03 -05:00
Dave Fullard
f28f138905 freebsd-update: create a ZFS boot environment on install
Updated freebsd-update to allow it to create boot environments using
bectl should the system support it. The bectl utility was updated in
r352211 (490e13c140) to support a 'check' to determine if the system
supports boot environments.  If UFS is used, the bectl check will fail
then no attempt will be made to create the boot environment.

If freebsd-update is run inside a jail, no attempt will be made to
create a boot environment.

The boot environment function will create a new environment using the
format: current FreeBSD kernel version and date/timestamp, example:

12.0-RELEASE-p10_2019-10-03_185233

This functionality can be disabled by setting 'CreateBootEnv' in
freebsd-update.conf to 'no'.

Discussed with:	allanjude
MFC after:	1 week
Differential Revision:	https://reviews.freebsd.org/D21892
2021-07-15 23:07:00 -05:00
Li-Wen Hsu
86d0d3aadb
freebsd-update: Update URL of supported platforms information
MFC after:	3 days
2021-07-04 21:45:08 +08:00
Ed Maste
741223a65c freebsd-update: improve mandoc db generation
freebsd-update compares the dates on man pages with mandoc.db, and if
any newer pages are found it regenerates mandoc.db.

Previously, if mandoc.db did not already exist the check failed and
freebsd-update then failed to create one.  Now, check that mandoc.db
exists before performing the check for newer pages.

Reported by:	bdrewery (in D10482)
Reviewed by:	gordon
MFC after:	1 week
Sponsored by:	The FreeBSD Foundation
Differential Revision:	https://reviews.freebsd.org/D29575
2021-04-05 13:23:37 -04:00
Kyle Evans
ebebc41e4c freebsd-update: unconditionally regenerate passwd/login.conf files
The existing logic is nice in theory, but in practice freebsd-update will
not preserve the timestamps on these files. When doing a major upgrade, e.g.
from 12.1-RELEASE -> 12.2-RELEASE, pwd.mkdb et al. appear in the INDEX and
we clobber the timestamp several times in the process of packaging up the
existing system into /var/db/freebsd-update/files and extracting for
comparisons. This leads to these files not getting regenerated when they're
most likely to be needed.

Measures could be taken to preserve timestamps, but it's unclear whether
the complexity and overhead of doing so is really outweighed by the marginal
benefit.

I observed this issue when pkg subsequently failed to install a package that
wanted to add a user, claiming that the user was removed in the process.
bapt@ pointed to this pre-existing bug with freebsd-update as the cause.

PR:		234014, 232921
Reviewed by:	bapt, emaste
MFC after:	1 week
Differential Revision:	https://reviews.freebsd.org/D27635
2020-12-17 03:42:54 +00:00
Mateusz Piotrowski
32f4592764 Document the PAGER environment variable
Sometimes users want to use freebsd-update(8) in a non-interactive way and
what they often miss is that they have to set PAGER to cat(1) in order to
avoid interactive prompts from less(1).

MFC after:	4 weeks
2020-11-14 13:07:41 +00:00
Colin Percival
9a63bbc93e Move finalize_components_config from get_params to cmd_*.
This allows us to redirect its output in cmd_cron, so that the
"src component not installed, skipped" message will be treated
the same way as other output from freebsd-update cron: Sent
in an email to root (or other address specified) if there are
updates to install, and silenced otherwise.

PR:		202492
MFC After:	1 week
Differential Revision:	https://reviews.freebsd.org/D26432
2020-09-19 02:15:56 +00:00
Michael Gmelin
101d33b8fb Unbreak `freebsd-update updatesready'.
The command would only work if PWD happened to be WORKDIR.
Also, exit 1 in case WORKDIR exists, but isn't accessible
by the current user.

PR:		242709
Reported by:	Max Fiedler
MFC after:	1 week
2020-08-19 15:11:27 +00:00
Kyle Evans
2b17527cea freebsd-update: rehash certs
With the inclusion of caroot bits, we'll need to also rehash on update as we
do in mergemaster/etcupdate.

If certctl's installed on the system, just unconditionally rehash. This
isn't an expensive operation, and we can refine it to compare
INDEX-{OLD,NEW} later if we really want to.

Reviewed by:	emaste, allanjude
MFC after:	3 days
Differential Revision:	https://reviews.freebsd.org/D21805
2020-04-25 00:14:17 +00:00
Michael Gmelin
8cfda118cb freebsd-update: Add updatesready' and showconfig' commands
`freebsd-update updatesready' can be used to check if there are any pending
fetched updates that can be installed.

`freebsd-update showconfig' writes freebsd-update's configuration to
stdout.

This also changes the exit code of `freebsd-update install' to 2 in case
there are no updates pending to be installed and there wasn't a fetch phase
in the same invocation. This allows scripts to tell apart these error
conditions without breaking existing jail managers.

See freebsd-update(8) for details.

PR:		240757, 240177, 229346
Reviewed by:	manpages (bcr), sectam (emaste), yuripv
Differential Revision:	https://reviews.freebsd.org/D21473
2019-09-24 20:49:33 +00:00
Michael Gmelin
12294db4ac Fix src component detection
Reviewed by:	emaste
MFC after:	3 days
Differential Revision:	https://reviews.freebsd.org/D21579
2019-09-19 21:13:51 +00:00
Ed Maste
75cb6429f5 freebsd-update: make usage output consistent
Drop trailing . which appeared only on description of IDS.

Submitted by:	grembo
Event:		EuroBSDCon Norway FreeBSD DevSummit
2019-09-19 11:46:43 +00:00
Ed Maste
18a52cf418 freebsd-update.8: appease igor
igor follows American style guides in the belief that abbreviations i.e.
and e.g. are always followed by a comma.  Make that change now so that
future updates to freebsd-update.8 do not complain about this.

Submitted by:	grembo
Event:		EuroBSDCon Norway FreeBSD DevSummit
2019-09-19 11:34:35 +00:00
Pietro Cerutti
5654a00747 freebsd-update: restore old exit code when no updates are available locally
This unbreaks ezjail and iocell, which get into an endless loop trying to
figure out how many times "freebsd-update install" needs to be called.

PR:		229346
Submitted by:	Mike Cole <mcole36@gmail.com>
Approved by:	bapt
MFC after:	1 week
2019-03-12 08:31:43 +00:00
Ed Maste
3f877103dd freebsd-update.8: update example to contemporary versions
PR:		235761
Reported by:	linimon
MFC after:	1 week
2019-03-05 19:17:24 +00:00
Ed Maste
df7e2e0d99 freebsd-update: Clarify help text
Improve help text to include example release numbers for reference
and clarify the -F option.

PR:		231185, 214619
Submitted by:	Gerald Aryeetey <aryeeteygerald_rogers.com>
Reviewed by:	delphij, rgrimes
MFC after:	1 month
Sponsored by:	The FreeBSD Foundation
Differential Revision:	https://reviews.freebsd.org/D18944
2019-02-19 17:38:24 +00:00
Ed Maste
9c812c8d4e freebsd-update: regenerate man page database after update
These are currently not reproducible because they're built by the
makewhatis on the freebsd-update build host, not the one in the tree.
Regenerate after update, and later we can avoid including it in
freebsd-update data.

PR:		214545, 217389
Reviewed by:	delphij
MFC after:	1 month
Sponsored by:	The FreeBSD Foundation
Differential Revision:	https://reviews.freebsd.org/D10482
2019-01-30 19:19:14 +00:00
Enji Cooper
b882e02bc4 Fix a typo/wordsmith a description modified in r343407
r343407 accidentally introduced a typo (folling -> following). While
reading the change out loud, I realized that the original sentence was
wordy. almost sounding like a run-on sentence.

Improve the flow by splitting up the two thoughts into two distinct sentence
fragments.

PR:		194547, 208497
Reviewed by:	emaste
Approved by:	emaste (mentor)
MFC after:	1 month
MFC with:	r343407
Differential Revision: https://reviews.freebsd.org/D18947
2019-01-24 20:35:58 +00:00
Ed Maste
9e8c28fcc0 freebsd-update: Clarify unsupported upgrade message
PR:		204115
Submitted by:	Gerald Aryeetey <aryeeteygerald_rogers.com>
Reviewed by:	delphij
MFC after:	1 month
Sponsored by:	The FreeBSD Foundation
Differential Revision:	https://reviews.freebsd.org/D18916
2019-01-24 18:51:15 +00:00
Ed Maste
ed1b6cec4f freebsd-update: fix style from r343271 change
PR:		234771
Submitted by:	Gerald Aryeetey <aryeeteygerald_rogers.com>
MFC with:	r343271
Sponsored by:	The FreeBSD Foundation
2019-01-24 18:48:15 +00:00
Ed Maste
ae97aa98ea freebsd-update: Stop installing empty component sets
Submitted by:	Gerald Aryeetey <aryeeteygerald_rogers.com>
Reported by:	rgrimes
Reviewed by:	delphij
MFC after:	1 month
Sponsored by:	The FreeBSD Foundation
Differential Revision:	https://reviews.freebsd.org/D18927
2019-01-24 18:41:00 +00:00
Ed Maste
fc24ba59ee freebsd-update: open $PAGER only if necessary
PR:		194547, 208497
Submitted by:	Gerald Aryeetey <aryeeteygerald_rogers.com>
Reviewed by:	delphij
MFC after:	1 month
Sponsored by:	The FreeBSD Foundation
2019-01-24 18:26:30 +00:00
Ed Maste
d308a8bf0f freebsd-update: Allow upgrade from pre-release builds
Update r343122 to include -ALPHA, -BETA and -RC releases as
upgrade-able via freebsd-update.

PR:		234771
Submitted by:	Gerald Aryeetey <aryeeteygerald_rogers.com>
Reported by:	delphij, des
Reviewed by:	delphij
MFC with:	r343122
Sponsored by:	The FreeBSD Foundation
Differential Revision:	https://reviews.freebsd.org/D18881
2019-01-21 19:21:11 +00:00
Ed Maste
9b6591109e freebsd-update: Update /etc/passwd after password db changes
Add -p to pwd_mkdb in order to ensure password db changes are also
included in /etc/passwd.

PR:		165954, 232921, 229487
Submitted by:	Gerald Aryeetey <aryeeteygerald_rogers.com>
Reviewed by:	jilles
MFC after:	1 month
Sponsored by:	The FreeBSD Foundation
Differential Revision:	https://reviews.freebsd.org/D18827
2019-01-21 19:04:37 +00:00
Ed Maste
b958d4b255 frebsd-update: fix --currently-running after r343122
PR:		234771
Submitted by:	Gerald Aryeetey <aryeeteygerald_rogers.com>
Reported by:	Brandon Schneider
MFC with:	r343122
Sponsored by:	The FreeBSD Foundation
Differential Revision:	https://reviews.freebsd.org/D18896
2019-01-21 18:41:57 +00:00
Ed Maste
c075542050 freebsd-update.8: mandoc -Tlint fixes
PR:		185389
Reported by:	bcr
MFC after:	3 days
Sponsored by:	The FreeBSD Foundation
2019-01-18 18:22:47 +00:00
Ed Maste
cfd9be9c1f freebsd-update: Use BASEDIR when checking for src component
src could potentially be installed under the based dir
and not under the root or vice versa.

PR:		224048
Submitted by:	Gerald Aryeetey <aryeeteygerald_rogers.com>
Reviewed by:	delphij
MFC after:	1 month
Sponsored by:	The FreeBSD Foundation
Differential Revision:	https://reviews.freebsd.org/D18849
2019-01-18 17:41:45 +00:00
Ed Maste
0d5c5243af freebsd-update: Clarify unsupported release upgrade error message
Notify users that upgrading from -CURRENT or -STABLE is unsupported by
freebsd-update.

Also ensure --currently-running provides a correctly formatted release
(as done by -r).

PR:		234771
Submitted by:	Gerald Aryeetey <aryeeteygerald_rogers.com>
Reported by:	yuri
Reviewed by:	bcran
MFC after:	1 month
Sponsored by:	The FreeBSD Foundation
Differential Revision:	https://reviews.freebsd.org/D18803
2019-01-17 21:38:57 +00:00
Conrad Meyer
d6e1e31a0e freebsd-update: add a progress report for the "fetching files..."
After patching step is done.

PR:		232857
Submitted by:	mat@
MFC after:	a week
2018-10-31 17:37:54 +00:00
Alan Somers
47cc9ee1b1 Switch the default pager for most commands to less
Finally, a pager for the nineties.

MFC after:	Never
Relnotes:	Yes
Differential Revision:	https://reviews.freebsd.org/D13465
Poll:		https://reviews.freebsd.org/V7
2018-08-08 19:24:20 +00:00
Brad Davis
6e6d254d7c Move freebsd-update.conf to usr.sbin/freebsd-update.
This is prep for pkgbase so that config files are tagged as such.

Approved by:	will (mentor)
Differential Revision:	https://reviews.freebsd.org/D16556
2018-08-04 22:25:41 +00:00
Pedro F. Giffuni
1de7b4b805 various: general adoption of SPDX licensing ID tags.
Mainly focus on files that use BSD 2-Clause license, however the tool I
was using misidentified many licenses so this was mostly a manual - error
prone - task.

The Software Package Data Exchange (SPDX) group provides a specification
to make it easier for automated tools to detect and summarize well known
opensource licenses. We are gradually adopting the specification, noting
that the tags are considered only advisory and do not, in any way,
superceed or replace the license texts.

No functional change intended.
2017-11-27 15:37:16 +00:00
Ed Maste
f6e2146105 freebsd-update: do not duplicate patchlist entries
PR:		221079
Submitted by:	Masachika ISHIZUKA
Submitted by:	ota@j.email.ne.jp
Reviewed by:	cperciva
MFC after:	1 week
2017-11-22 01:50:23 +00:00
Guangyuan Yang
33bd05c318 Fix freebsd-update(8) erroneous message and exit status when "fetch install" used.
PR:		190660
Reviewed by:	allanjude
Approved by:	emaste
Differential Revision:	https://reviews.freebsd.org/D12037
2017-10-09 16:33:37 +00:00
Glen Barber
1a20115c11 Modernize FreeBSD version numbers in freebsd-update(8).
While here, expand a contraction to make textproc/igor happy.

MFC after:	3 days
Sponsored by:	The FreeBSD Foundation
2017-06-14 18:34:22 +00:00
Colin Percival
e7fd266eaf MFportsnap r264740: Use case insensitive match when parsing host(1) output.
Some DNS caches turn "FreeBSD.org" into "freebsd.org", which was causing
the printed SRV records to not match our regex.

PR:		170503
MFC after:	2 weeks
2016-10-12 20:24:33 +00:00
Baptiste Daroussin
073dd71287 In preparation for removal of GNU rcs, replace merge(1) usage with direct
diff3(1) usage
2016-09-18 14:48:28 +00:00
Xin LI
823c0d5f5e Allow - in distribution names. This is needed for freebsd-update to work
with 11.0+, where the debugging symbols use a new naming scheme for release
distribution files.

Errata candidate.

Approved by:	cperciva
Differential Revision:	https://reviews.freebsd.org/D7170
2016-07-11 03:31:12 +00:00
Gleb Smirnoff
dd917c79b4 Provide a future release as an example, instead of a historical one. 2016-02-05 21:57:50 +00:00
Ed Maste
7e1ed2c72c Add debug file extension to freebsd-update(8) after r288176
Reviewed by:	delphij
Sponsored by:	The FreeBSD Foundation
Differential Revision:	https://reviews.freebsd.org/D3784
2015-10-15 01:48:52 +00:00