add a sanity check for diff before using it #48184
authorMike Frysinger <vapier@gentoo.org>
Sun, 18 Sep 2005 04:38:36 +0000 (04:38 -0000)
committerMike Frysinger <vapier@gentoo.org>
Sun, 18 Sep 2005 04:38:36 +0000 (04:38 -0000)
svn path=/main/branches/2.0/; revision=1998

ChangeLog
bin/etc-update

index 21141fc12dfa9914acdf8cfa5503817b212fe0fd..bedbc095c91654c59fa267661b8cdc7d7f65a685 100644 (file)
--- a/ChangeLog
+++ b/ChangeLog
@@ -7,6 +7,9 @@
     2. /var/cache/edb/world is now /var/lib/portage/world.
     3. /etc/portage/profile/virtuals is _USER_ configs only.
 
+  18 Sep 2005; Mike Frysinger <vapier@gentoo.org> bin/etc-update:
+  Make sure diff works before checking config files #48184.
+
   08 Sep 2005; Brian Harring <ferringb@gentoo.org> bin/ebuild.sh: Fixed 
   unpack so that it actually works now.  ${tarvars} placement was a bit 
   wrong, which is odd considering it shouldn't have changed.
index fb09ea9d0fd698779da1ab93cb2784d3cc5608da..24af6dccc5f69d522649dd15ab0d8d14647f55a5 100755 (executable)
 
 export PORTAGE_CALLER="etc-update"
 
-eval $(python -c 'import portage; print "export PORTAGE_TMPDIR="+portage.settings["PORTAGE_TMPDIR"]; print "export USERLAND="+portage.settings["USERLAND"]')
+eval $(python -c 'import portage; print "export PORTAGE_TMPDIR="+portage.settings["PORTAGE_TMPDIR"];')
 
-if [ "$USERLAND" == "BSD" ] ; then
-       function sed() { gsed "$@"; }
-elif [ "$USERLAND" == "Darwin" ] && [ -x /bin/gsed ]; then
+if type -p gsed >/dev/null ; then
        function sed() { gsed "$@"; }
 fi
 
@@ -38,6 +36,12 @@ function scan() {
        count=0
        input=0
        
+       # Sanity check to make sure diff exists and works
+       if ! diff -v &>/dev/null ; then
+               echo "ERROR: 'diff' does not seem to work, aborting"
+               exit 1
+       fi
+
        for path in ${CONFIG_PROTECT}; do if [ -d ${path} ]; then
                ofile=""
                for file in `find ${path}/ -iname "._cfg????_*" |