diff options
author | martti <martti> | 2003-01-27 07:54:22 +0000 |
---|---|---|
committer | martti <martti> | 2003-01-27 07:54:22 +0000 |
commit | e461cc6f6fb3b5da763845466fd5ebb57844f4a9 (patch) | |
tree | e08fe063be60628f5790bd25eec90b5c1ee3ca0c /sysutils/etcupdate | |
parent | c965a23a48baa464da9a5502524779685220d03b (diff) | |
download | pkgsrc-e461cc6f6fb3b5da763845466fd5ebb57844f4a9.tar.gz |
Updated etcupdate to 20030124
Add a new -a flag (automatically update files which have not been
locally modified). Patch provided by Sverre Froyen in a private mail,
slightly modified by me.
Diffstat (limited to 'sysutils/etcupdate')
-rw-r--r-- | sysutils/etcupdate/Makefile | 4 | ||||
-rwxr-xr-x | sysutils/etcupdate/files/etcupdate | 34 | ||||
-rw-r--r-- | sysutils/etcupdate/files/etcupdate.8 | 30 |
3 files changed, 61 insertions, 7 deletions
diff --git a/sysutils/etcupdate/Makefile b/sysutils/etcupdate/Makefile index 849ea6c797c..73bd0665b64 100644 --- a/sysutils/etcupdate/Makefile +++ b/sysutils/etcupdate/Makefile @@ -1,6 +1,6 @@ -# $NetBSD: Makefile,v 1.17 2002/12/27 19:41:45 jmmv Exp $ +# $NetBSD: Makefile,v 1.18 2003/01/27 07:54:22 martti Exp $ -DISTNAME= etcupdate-20021227 +DISTNAME= etcupdate-20030124 CATEGORIES= sysutils MASTER_SITES= # empty DISTFILES= # empty diff --git a/sysutils/etcupdate/files/etcupdate b/sysutils/etcupdate/files/etcupdate index 9271033224d..e42313f3f30 100755 --- a/sysutils/etcupdate/files/etcupdate +++ b/sysutils/etcupdate/files/etcupdate @@ -1,6 +1,6 @@ #!/bin/sh # -# $NetBSD: etcupdate,v 1.18 2002/12/27 19:41:46 jmmv Exp $ +# $NetBSD: etcupdate,v 1.19 2003/01/27 07:54:23 martti Exp $ # # Copyright (c) 2001 The NetBSD Foundation, Inc. # All rights reserved. @@ -59,6 +59,7 @@ WIDTH="${WIDTH:=80}" VERBOSE= CONTINUE= BINARY= +AUTOMATIC= # Settings for post-installation procedures NEED_MTREE= @@ -79,6 +80,7 @@ Options: -t temproot Where to store temporary files (default: /tmp/temproot) -w width Screen width (default: 80) + -a Automatically update unmodified files -h This help text -v Be more verbose @@ -141,15 +143,36 @@ install_file() { esac } +install_checksum() { + # $1 = target file + + [ "${AUTOMATIC}" != "YES" ] && return + + D=`dirname "${1}"` + mkdir -p "/etc/etcupdate/${D}" + md5 "${1}" > "/etc/etcupdate/${1}" +} + diff_and_merge_file() { # $1 = target file if cmp -s "${TEMPROOT}${1}" "${1}"; then verbose "===> ${1} (ok)" rm -f "${TEMPROOT}${1}" + install_checksum "${1}" return fi + if [ "${AUTOMATIC}" = "YES" -a -f "/etc/etcupdate/${1}" ] ; then + SUM1=`sum "${1}"` + SUM2=`cat "/etc/etcupdate/${1}"` + if [ "${SUM1}" = "${SUM2}" ] ; then + install_file "${1}" + install_checksum "${1}" + return + fi + fi + clear if [ ! -f "${1}" ]; then verbose "===> ${1} (missing)" @@ -223,6 +246,9 @@ EOF ;; [iI]) install_file "${1}" + if [ -z "${ALREADY_MERGED}" ]; then + install_checksum "${1}" + fi STAY_HERE=NO ;; [mM]) @@ -274,11 +300,15 @@ USERRC="${HOME}/.`basename $0`rc" [ -r ${USERRC} ] && . ${USERRC} # Read command line arguments -ARGV=`getopt b:hp:s:t:vw: $*` +ARGV=`getopt ab:hp:s:t:vw: $*` [ $? != 0 ] && usage set -- ${ARGV} for i; do case "${i}" in + -a) + AUTOMATIC=YES + shift + ;; -b) BINARY=YES SRCDIR="${2}" diff --git a/sysutils/etcupdate/files/etcupdate.8 b/sysutils/etcupdate/files/etcupdate.8 index 32ea926adce..01ee14ccd19 100644 --- a/sysutils/etcupdate/files/etcupdate.8 +++ b/sysutils/etcupdate/files/etcupdate.8 @@ -1,4 +1,4 @@ -.\" $NetBSD: etcupdate.8,v 1.7 2001/12/15 09:05:08 martti Exp $ +.\" $NetBSD: etcupdate.8,v 1.8 2003/01/27 07:54:24 martti Exp $ .\" .\" Copyright (c) 2001 The NetBSD Foundation, Inc. .\" All rights reserved. @@ -34,7 +34,7 @@ .\" ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE .\" POSSIBILITY OF SUCH DAMAGE. .\" -.Dd November 14, 2001 +.Dd January 24, 2003 .Dt ETCUPDATE 8 .Os .Sh NAME @@ -43,6 +43,7 @@ .Pa /etc .Sh SYNOPSIS .Nm +.Op Fl a .Op Fl b Ar srcdir .Op Fl h .Op Fl p Ar pager @@ -102,6 +103,17 @@ corresponding tasks like remaking device nodes or rebuilding a database from the .Xr aliases 5 file. +.Pp +.Nm +can automatically update files which have not been modified locally. +The +.Fl a +flag instructs +.Nm +to store MD5 checksums in +.Pa /etc/etcupdate +and use these checksums to determine if there have been any +local modifications. .Sh ENVIRONMENT .Bl -tag -width TEMPROOT .It Ev TEMPROOT @@ -157,7 +169,7 @@ settings. .Sh EXAMPLES You have just upgraded your .Nx -host from 1.5.2 to 1.5.3 and now it's time +host from 1.6 to 1.6.1 and now it's time to update the configuration files as well. To update the configuration files from the sources (if you have the .Pa /usr/src/etc @@ -181,11 +193,23 @@ do something like this: .Dl tar xpzf /some/where/etc.tgz .Dl etcupdate -b /tmp/temproot .Pp +You have modified only few files in the +.Pa /etc +directory so you would like install most of the updates without being asked. +To automatically update the unmodified configuration files: +.Pp +.Dl etcupdate -a +.Pp To get a better idea what's going on, use the .Fl v flag: .Pp .Dl etcupdate -v +.Sh HISTORY +The +.Nm +command appeared in +.Nx 1.6 . .Sh AUTHORS The script was written by Martti Kuparinen <martti@netbsd.org> and |