Index | Thread | Search

From:
Christian Schulte <cs@schulte.it>
Subject:
Re: Clarify -f option in dbupdate(8), tune -n
To:
tech@openbsd.org
Date:
Sat, 24 Oct 2026 09:22:30 +0200

Download raw body.

Thread
Am 23.10.2026 um 14:02 schrieb Mikolaj Kucharski:
> Hi.
> 
> When I read explanation of -f option for dbupdate, it was not clear to
> me what means "normally only updates new files". What means "new" in
> this context. Are missing files new or outdated are new too?
> 
> Proposed patch for clarification. I also tuned -n option, however -n was
> clear for me, so it can stay as is.
> 
> 
> Index: dbupdate.8
> ===================================================================
> RCS file: /cvs/src/usr.sbin/dbupdate/dbupdate.8,v
> diff -u -p -r1.3 dbupdate.8
> --- dbupdate.8	21 Oct 2026 01:49:32 -0000	1.3
> +++ dbupdate.8	23 Oct 2026 11:58:50 -0000
> @@ -48,11 +48,10 @@ and
>  The options are as follows:
>  .Bl -tag -width Ds
>  .It Fl f
> -.Nm
> -normally only updates new files.
> -This option forces download and installation.
> +Force download and reinstallation of all databases,
> +even if they are already up to date.
>  .It Fl n
> -Dry run (prints out what it would have done).
> +Report which databases would be installed without installing them.
>  .Sh FILES
>  .Bl -tag -width Ds
>  .It Pa /var/dbupdate
> 

Would not improve things for me, IMHO. Reading that man page it mentions
 
"...which is kept simple as possible so that it can be run regularily
as root in cron(8)."

Maybe a good candidate for daily(8), weekly, monthly? Something like
below?

Regards,
-- 
Christian


Index: etc/daily
===================================================================
RCS file: /cvs/src/etc/daily,v
diff -u -p -u -r1.103 daily
--- etc/daily	2 Jun 2026 07:17:35 -0000	1.103
+++ etc/daily	24 Oct 2026 07:19:24 -0000
@@ -162,6 +162,11 @@ if [ -f /etc/Distfile ]; then
 fi
 
 end_part
+
+next_part "Running dbupdate:"
+dbupdate -q
+end_part
+
 [ -s $MAINOUT ] && {
 	sysctl -n kern.version
 	uptime
Index: usr.sbin/dbupdate/dbupdate.8
===================================================================
RCS file: /cvs/src/usr.sbin/dbupdate/dbupdate.8,v
diff -u -p -u -r1.3 dbupdate.8
--- usr.sbin/dbupdate/dbupdate.8	21 Oct 2026 01:49:32 -0000	1.3
+++ usr.sbin/dbupdate/dbupdate.8	24 Oct 2026 07:19:24 -0000
@@ -53,6 +53,8 @@ normally only updates new files.
 This option forces download and installation.
 .It Fl n
 Dry run (prints out what it would have done).
+.It Fl q
+Suppresses any output when nothing has been done.
 .Sh FILES
 .Bl -tag -width Ds
 .It Pa /var/dbupdate
Index: usr.sbin/dbupdate/dbupdate.sh
===================================================================
RCS file: /cvs/src/usr.sbin/dbupdate/dbupdate.sh,v
diff -u -p -u -r1.11 dbupdate.sh
--- usr.sbin/dbupdate/dbupdate.sh	22 Oct 2026 02:52:49 -0000	1.11
+++ usr.sbin/dbupdate/dbupdate.sh	24 Oct 2026 07:19:24 -0000
@@ -31,11 +31,13 @@ trap "rm -rf $D" 0 1 2 3 13 15
 
 FORCE=false
 DRY=false
+QUIET=false
 
-while getopts "fn" name; do
+while getopts "fnq" name; do
 	case "$name" in
 	f) FORCE=true ;;
 	n) DRY=true ;;
+	q) QUIET=true ;;
 	?) usage ;;
 	esac
 done
@@ -52,13 +54,17 @@ cd $D
 if ! ftp -o out-SHA256.sig \
     https://ftp.openbsd.org/pub/OpenBSD/dbupdates/$R/SHA256.sig \
     > /dev/null 2>&1 ; then
-	echo $PROG: no databases available.
+	if [ $QUIET != true ]; then
+		echo $PROG: no databases available.
+	fi
 	exit 0
 fi
 
 if cmp -s ${CACHE}/out-SHA256.sig out-SHA256.sig ; then
 	if [ $FORCE != true ]; then
-		echo $PROG: databases have not changed.
+		if [ $QUIET != true ]; then
+			echo $PROG: databases have not changed.
+		fi
 		exit 0
 	fi
 fi
@@ -73,7 +79,9 @@ tar xfz dbupdates.tgz
 # check if the contents are same as previously processed
 if cmp -s ${CACHE}/in-SHA256 SHA256 ; then
 	if [ $FORCE != true ]; then
-		echo $PROG: same internals, nothing to do
+		if [ $QUIET != true ]; then
+			echo $PROG: same internals, nothing to do
+		fi
 		exit 0
 	fi
 fi