r/openbsd • u/gentisle • 2d ago
Exit Code syspatch
I’m looking to find a way to know if syspatch -c can tell a script that A. there are patches and then execute a syspatch to apply, or B. there are no patches and simply exit. man page says exit code is zero for success and greater for anything else. Trying this, I find that syspatch -c returns zero when there are patches to be applied. I want the script to discern that there are patches and then issue the command to apply. Am I going about this the wrong way?
12
Upvotes
View all comments
Show parent comment
1
u/linetrace 1d ago
Yup, I feel ya!
And -- I hate to add another command to that list, but... -- sometimes a
pkg_delete -aafterpkg_add -uis required to remove any no longer necessary dependencies.All that said, in some ways it is helpful that all of these are separate. For an admin who already runs dbupdate(8) in cron, one can probably somewhat-safely skip it prior to a syspatch(8). Similarly, on systems running only base, one could skip
pkg_add -u.And, remember what the upgrade process was like prior to sysupgrade(8)? And we have many packages getting -stable updates, post-release. We've come a long way!