etcupdate: fix arguments order of diff command

Due to misplacement of the second -L argument of diff command, it is
treated by getopt_long as an error.

Also add -l option for a diff command that alters the way it shows
differences. Instead of printing full diff, it reports changed file
the same way as added/removed files are reported.

Reviewed by:	imp
Obtained from:	Yandex LLC
MFC after:	1 week
Differential Revision:	https://reviews.freebsd.org/D56708
This commit is contained in:
Boris Lytochkin
2026-04-30 14:31:34 +03:00
committed by Andrey V. Elsukov
parent 226b37dc3a
commit 6d65c91b9a
2 changed files with 18 additions and 3 deletions
+6 -1
View File
@@ -23,7 +23,7 @@
.\" OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF
.\" SUCH DAMAGE.
.\"
.Dd July 15, 2024
.Dd April 30, 2026
.Dt ETCUPDATE 8
.Os
.Sh NAME
@@ -51,6 +51,7 @@
.Ar tarball
.Nm
.Cm diff
.Op Fl l
.Op Fl d Ar workdir
.Op Fl D Ar destdir
.Op Fl I Ar patterns
@@ -468,6 +469,10 @@ shell pattern.
This option may be specified multiple times to specify multiple patterns.
Multiple space-separated patterns may also be specified in a single
option.
.It Fl l
In
.Cm diff
mode list files that are changed locally, omit printing content difference.
.It Fl L Ar logfile
Specify an alternate path for the log file.
The
+12 -2
View File
@@ -527,9 +527,15 @@ diffnode()
echo
;;
$COMPARE_DIFFFILES)
if [ -n "$difflistonly" ]; then
echo
echo "Changed: $3"
echo
break;
fi
echo "Index: $3"
rule "="
diff -u $diffargs -L "$3 ($4)" $1/$3 -L "$3 ($5)" $2/$3
diff -u $diffargs -L "$3 ($4)" -L "$3 ($5)" $1/$3 $2/$3
;;
esac
}
@@ -1787,11 +1793,15 @@ ignore=
nobuild=
preworld=
noroot=
while getopts "d:m:nprs:t:A:BD:FI:L:M:N" option; do
difflistonly=
while getopts "d:lm:nprs:t:A:BD:FI:L:M:N" option; do
case "$option" in
d)
WORKDIR=$OPTARG
;;
l)
difflistonly=YES
;;
m)
MAKE_CMD=$OPTARG
;;