diff options
author | martti <martti@pkgsrc.org> | 2001-11-22 15:39:30 +0000 |
---|---|---|
committer | martti <martti@pkgsrc.org> | 2001-11-22 15:39:30 +0000 |
commit | 89fad25f161d47d531b361533f6bbaa5fa892504 (patch) | |
tree | 893611fb2b6a373d6b8f46880600aa55791e0c82 | |
parent | cec9d19d6f893e1398f159afa989107e849200b2 (diff) | |
download | pkgsrc-89fad25f161d47d531b361533f6bbaa5fa892504.tar.gz |
Added a new switch (-b binfile) to allow binary upgrades for those
who don't have the /usr/src/etc directory.
Usage example: etcupdate -b /some/where/etc.tgz
-rw-r--r-- | sysutils/etcupdate/Makefile | 6 | ||||
-rwxr-xr-x | sysutils/etcupdate/files/etcupdate | 56 | ||||
-rw-r--r-- | sysutils/etcupdate/files/etcupdate.8 | 47 |
3 files changed, 69 insertions, 40 deletions
diff --git a/sysutils/etcupdate/Makefile b/sysutils/etcupdate/Makefile index c2bf006967a..27a922e61ed 100644 --- a/sysutils/etcupdate/Makefile +++ b/sysutils/etcupdate/Makefile @@ -1,13 +1,13 @@ -# $NetBSD: Makefile,v 1.4 2001/11/22 13:20:00 martti Exp $ +# $NetBSD: Makefile,v 1.5 2001/11/22 15:39:30 martti Exp $ -DISTNAME= etcupdate-20011122 +DISTNAME= etcupdate-20011122.1 CATEGORIES= sysutils MASTER_SITES= # empty DISTFILES= # empty MAINTAINER= packages@netbsd.org HOMEPAGE= http://www.netbsd.org/Documentation/current/ -COMMENT= Script to update configuration files in /etc +COMMENT= Script to update the configuration and startup files in /etc EXTRACT_ONLY= # defined WRKSRC= ${WRKDIR} diff --git a/sysutils/etcupdate/files/etcupdate b/sysutils/etcupdate/files/etcupdate index b3de1b5ebca..815291f7399 100755 --- a/sysutils/etcupdate/files/etcupdate +++ b/sysutils/etcupdate/files/etcupdate @@ -1,6 +1,6 @@ #!/bin/sh # -# $NetBSD: etcupdate,v 1.5 2001/11/22 13:20:00 martti Exp $ +# $NetBSD: etcupdate,v 1.6 2001/11/22 15:39:31 martti Exp $ # # Copyright (c) 2001 The NetBSD Foundation, Inc. # All rights reserved. @@ -58,6 +58,7 @@ PAGER="${PAGER:=/usr/bin/more}" WIDTH="${WIDTH:=80}" VERBOSE= CONTINUE= +BINARY= # Settings for post-installlation procedures NEED_MTREE= @@ -72,6 +73,7 @@ Usage: `basename $0` [options] Options: + -b binfile Location of the .tgz files -p pager Which pager to use (default: /usr/bin/more) -s srcdir Location of the source files (default: /usr/src) -t temproot Where to store temporary files (default: /tmp/temproot) @@ -242,25 +244,29 @@ USERRC="${HOME}/.`basename $0`rc" [ -r ${USERRC} ] && . ${USERRC} # Read command line arguments -ARGV=`getopt hp:s:t:vw: $*` +ARGV=`getopt b:hp:s:t:vw: $*` [ $? != 0 ] && usage set -- ${ARGV} for i; do case "${i}" in + -b) + BINARY="${BINARY} ${2}" + shift 2 + ;; -h) usage ;; -p) PAGER="${2}" - shift + shift 2 ;; -s) SRCDIR="${2}" - shift + shift 2 ;; -t) TEMPROOT="${2}" - shift + shift 2 ;; -v) VERBOSE=YES @@ -268,7 +274,7 @@ for i; do ;; -w) WIDTH="${2}" - shift + shift 2 ;; --) shift @@ -279,7 +285,7 @@ done # Last minute sanity checks if [ `id -u` -ne 0 ]; then - echo "*** WARNING: You MUST be root" + echo "*** ERROR: You MUST be root" exit 1 fi if [ -z "${SRCDIR}" -o -z "${TEMPROOT}" ]; then @@ -311,21 +317,29 @@ if [ -z "${CONTINUE}" ]; then exit 1 fi - # Populate ${TEMPROOT} from ${SRCDIR} - if [ ! -f "${SRCDIR}/etc/Makefile" ]; then - echo "*** ERROR: Unable to find ${SRCDIR}/etc/Makefile" - exit 1 - fi - echo "*** Populating ${TEMPROOT} from ${SRCDIR}" - cd ${SRCDIR}/etc - if [ -z "${VERBOSE}" ]; then - make DESTDIR="${TEMPROOT}" MTREE="mtree" \ - INSTALL_DONE=1 NO_SENDMAIL=1 \ - distribution > /dev/null + # Are we using the sources or binaries? + if [ -z "${BINARY}" ]; then + # Populate ${TEMPROOT} from ${SRCDIR} + if [ ! -f "${SRCDIR}/etc/Makefile" ]; then + echo "*** ERROR: Unable to find ${SRCDIR}/etc/Makefile" + exit 1 + fi + echo "*** Populating ${TEMPROOT} from ${SRCDIR}" + cd ${SRCDIR}/etc + if [ -z "${VERBOSE}" ]; then + make DESTDIR="${TEMPROOT}" MTREE="mtree" \ + INSTALL_DONE=1 NO_SENDMAIL=1 \ + distribution > /dev/null + else + make DESTDIR="${TEMPROOT}" MTREE="mtree" \ + INSTALL_DONE=1 NO_SENDMAIL=1 \ + distribution + fi else - make DESTDIR="${TEMPROOT}" MTREE="mtree" \ - INSTALL_DONE=1 NO_SENDMAIL=1 \ - distribution + for i in ${BINARY}; do + echo "*** Extracting ${i} to ${TEMPROOT}" + tar xzf "${i}" -C "${TEMPROOT}" + done fi # Ignore the following files during comparision diff --git a/sysutils/etcupdate/files/etcupdate.8 b/sysutils/etcupdate/files/etcupdate.8 index 51dd7171626..897f08dcabe 100644 --- a/sysutils/etcupdate/files/etcupdate.8 +++ b/sysutils/etcupdate/files/etcupdate.8 @@ -1,4 +1,4 @@ -.\" $NetBSD: etcupdate.8,v 1.3 2001/11/21 11:58:07 martti Exp $ +.\" $NetBSD: etcupdate.8,v 1.4 2001/11/22 15:39:31 martti Exp $ .\" .\" Copyright (c) 2001 The NetBSD Foundation, Inc. .\" All rights reserved. @@ -43,6 +43,7 @@ .Pa /etc .Sh SYNOPSIS .Nm +.Op Fl b Ar binfile .Op Fl h .Op Fl p Ar pager .Op Fl s Ar srcdir @@ -53,28 +54,34 @@ .Nm is a tool to update the configuration and startup files in .Pa /etc +(and some other directories like +.Pa /dev +and +.Pa /root ) without the need of manually checking and modifying every file. The user should run this script after performing an operating system update (e.g. after running .Pa make build in -.Pa /usr/src ) -to use the latest configuration and startup files during reboot. +.Pa /usr/src +or after extracting the binary distribution files) +to use the latest configuration and startup files. .Pp .Nm will first create a copy of the new configuration and startup files -(by running +(by either running .Pa make distribution in -.Pa /usr/src/etc ) -and compare these against the currently installed files. The user is given -the option of installing, merging or deleting each modified or missing file. +.Pa /usr/src/etc +or extracting the given binary distribution files) and compare these +against the currently installed files. The user is given the option +of installing, merging or deleting each modified or missing file. .Pp .Nm also detects if the user installs certain special files and performs -corresponding tasks like remaking the device nodes or rebuilding a database +corresponding tasks like remaking device nodes or rebuilding a database from the -.Pa /etc/mail/aliases +.Xr aliases 5 file. .Sh ENVIRONMENT .Bl -tag -width TEMPROOT @@ -132,21 +139,29 @@ settings. You have just upgraded your .Nx host from 1.5.2 to 1.5.3 and now it's time -to update the configuration files as well. This can be done with the -following command: +to update the configuration files as well. +To update the configuration files from the sources (if you have the +.Pa /usr/src +directory): .Dl etcupdate .Pp -To get a better idea what's going on, use the -.Fl v -flag: -.Dl etcupdate -v -.Pp The default location of the source files is .Pa /usr/src but this may be overridden with the .Fl s Ar srcdir command line argument: .Dl etcupdate -s /some/where/src +.Pp +To update the configuration files from binary distribution packages +(note that you can specify more than one +.Fl b Ar binfile +argument): +.Dl etcupdate -b /some/where/etc.tgz +.Pp +To get a better idea what's going on, use the +.Fl v +flag: +.Dl etcupdate -v .Sh AUTHORS The script was written by Martti Kuparinen <martti@netbsd.org> and |