Add a -l option telling etcupdate to skip any file who's RCS id has
not been changed. (-l means "skip local modifications".) Code and documentation from Christopher Richards in PR bin/20200
This commit is contained in:
parent
d470cda51b
commit
fec4dbea24
@ -1,6 +1,6 @@
|
||||
#!/bin/sh
|
||||
#
|
||||
# $NetBSD: etcupdate,v 1.12 2003/03/03 14:07:11 martti Exp $
|
||||
# $NetBSD: etcupdate,v 1.13 2003/04/02 03:07:30 perry Exp $
|
||||
#
|
||||
# Copyright (c) 2001 The NetBSD Foundation, Inc.
|
||||
# All rights reserved.
|
||||
@ -60,6 +60,7 @@ VERBOSE=
|
||||
CONTINUE=
|
||||
BINARY=
|
||||
AUTOMATIC=
|
||||
LOCALSKIP=
|
||||
|
||||
# Settings for post-installation procedures
|
||||
NEED_MTREE=
|
||||
@ -81,6 +82,8 @@ Options:
|
||||
-w width Screen width (default: 80)
|
||||
|
||||
-a Automatically update unmodified files
|
||||
-l Automatically skip files with strictly local changes
|
||||
(this option has no effect on files lacking RCS Ids)
|
||||
-h This help text
|
||||
-v Be more verbose
|
||||
|
||||
@ -173,6 +176,18 @@ diff_and_merge_file() {
|
||||
fi
|
||||
fi
|
||||
|
||||
if [ "${LOCALSKIP}" = "YES" ] ; then
|
||||
ID1=`ident -q "${TEMPROOT}${1}" | sed -n 2p`
|
||||
ID1="${ID1:-0}"
|
||||
ID2=`ident -q "${1}" | sed -n 2p`
|
||||
ID2="${ID2:-1}"
|
||||
if [ "${ID1}" = "${ID2}" ] ; then
|
||||
verbose "===> ${1} (ok:RCS)"
|
||||
rm -f "${TEMPROOT}${1}"
|
||||
return
|
||||
fi
|
||||
fi
|
||||
|
||||
clear
|
||||
if [ ! -f "${1}" ]; then
|
||||
verbose "===> ${1} (missing)"
|
||||
@ -300,7 +315,7 @@ USERRC="${HOME}/.`basename $0`rc"
|
||||
[ -r ${USERRC} ] && . ${USERRC}
|
||||
|
||||
# Read command line arguments
|
||||
ARGV=`getopt ab:hp:s:t:vw: $*`
|
||||
ARGV=`getopt ab:hlp:s:t:vw: $*`
|
||||
[ $? != 0 ] && usage
|
||||
set -- ${ARGV}
|
||||
for i; do
|
||||
@ -317,6 +332,10 @@ for i; do
|
||||
-h)
|
||||
usage
|
||||
;;
|
||||
-l)
|
||||
LOCALSKIP=YES
|
||||
shift
|
||||
;;
|
||||
-p)
|
||||
PAGER="${2}"
|
||||
shift 2
|
||||
|
@ -1,4 +1,4 @@
|
||||
.\" $NetBSD: etcupdate.8,v 1.7 2003/03/17 08:19:22 wiz Exp $
|
||||
.\" $NetBSD: etcupdate.8,v 1.8 2003/04/02 03:07:30 perry Exp $
|
||||
.\"
|
||||
.\" Copyright (c) 2001 The NetBSD Foundation, Inc.
|
||||
.\" All rights reserved.
|
||||
@ -46,6 +46,7 @@
|
||||
.Op Fl a
|
||||
.Op Fl b Ar srcdir
|
||||
.Op Fl h
|
||||
.Op Fl l
|
||||
.Op Fl p Ar pager
|
||||
.Op Fl s Ar srcdir
|
||||
.Op Fl t Ar temproot
|
||||
@ -114,6 +115,18 @@ to store MD5 checksums in
|
||||
.Pa /var/etcupdate
|
||||
and use these checksums to determine if there have been any
|
||||
local modifications.
|
||||
.Pp
|
||||
Inversely, if given the
|
||||
.Fl l
|
||||
flag,
|
||||
.Nm
|
||||
will automatically skip files which have been modified strictly
|
||||
locally.
|
||||
(As an exception, files distributed without RCS IDs will not be
|
||||
skipped, since the logic for this flag requires their presence.)
|
||||
This flag may be used together with the
|
||||
.Fl a
|
||||
flag described above.
|
||||
.Sh ENVIRONMENT
|
||||
.Bl -tag -width TEMPROOT
|
||||
.It Ev TEMPROOT
|
||||
|
Loading…
x
Reference in New Issue
Block a user