Source-Changes-HG archive

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index][Old Index]

[src/trunk]: src/usr.sbin/etcupdate Keep track of whether anything was change...



details:   https://anonhg.NetBSD.org/src/rev/f627a001feeb
branches:  trunk
changeset: 796616:f627a001feeb
user:      apb <apb%NetBSD.org@localhost>
date:      Thu Jun 12 13:42:05 2014 +0000

description:
Keep track of whether anything was changed (or needs to be changed),
and print a message at the end if nothing needs to be done.

diffstat:

 usr.sbin/etcupdate/etcupdate |  10 +++++++++-
 1 files changed, 9 insertions(+), 1 deletions(-)

diffs (54 lines):

diff -r fd480972fe81 -r f627a001feeb usr.sbin/etcupdate/etcupdate
--- a/usr.sbin/etcupdate/etcupdate      Thu Jun 12 13:40:43 2014 +0000
+++ b/usr.sbin/etcupdate/etcupdate      Thu Jun 12 13:42:05 2014 +0000
@@ -1,6 +1,6 @@
 #!/bin/sh
 #
-# $NetBSD: etcupdate,v 1.54 2014/06/12 13:40:43 apb Exp $
+# $NetBSD: etcupdate,v 1.55 2014/06/12 13:42:05 apb Exp $
 #
 # Copyright (c) 2001-2008 The NetBSD Foundation, Inc.
 # All rights reserved.
@@ -70,6 +70,7 @@
 export MACHINE_ARCH
 
 # Settings for post-installation procedures
+NEED_ANYTHING=false
 NEED_MAKEDEV=false
 NEED_MTREE=false
 NEED_NEWALIASES=false
@@ -153,6 +154,7 @@
 install_dir() {
        # $1 = target directory
 
+       NEED_ANYTHING=true
        if yesno "Create ${1}"; then
                verbose "Creating ${1}"
                mkdir -p "${1}" || exit 1
@@ -163,6 +165,7 @@
 install_file() {
        # $1 = target file
 
+       NEED_ANYTHING=true
        # Install the new file
        verbose "Installing ${1}"
        cp -p "${TEMPROOT}${1}" "${1}" && rm -f "${TEMPROOT}${1}"
@@ -192,6 +195,7 @@
 
        ${AUTOMATIC} || return
 
+       NEED_ANYTHING=true
        D="$(dirname "${1}")"
        mkdir -p "/var/etcupdate/${D}"
        verbose "Saving MD5 checksum for ${1} to /var/etcupdate/${1}"
@@ -637,6 +641,10 @@
        echo ""
        echo "${REMAINING}" | sed -e 's/^/  /'
        echo ""
+elif ! ${NEED_ANYTHING}; then
+       echo ""
+       echo "*** No changes were needed"
+       echo ""
 fi
 if yesno "Remove ${TEMPROOT}"; then
        echo "*** Removing ${TEMPROOT}"



Home | Main Index | Thread Index | Old Index